@@ -994,8 +994,8 @@ object Parsers {
994
994
skipParams()
995
995
lookahead.isColon
996
996
&& {
997
- ! in.featureEnabled( Feature .modularity )
998
- || { // with modularity language import , a `:` at EOL after an identifier represents a single identifier given
997
+ ! sourceVersion.isAtLeast(`3.6` )
998
+ || { // in the new given syntax , a `:` at EOL after an identifier represents a single identifier given
999
999
// Example:
1000
1000
// given C:
1001
1001
// def f = ...
@@ -1833,7 +1833,7 @@ object Parsers {
1833
1833
infixOps(t, canStartInfixTypeTokens, operand, Location .ElseWhere , ParseKind .Type ,
1834
1834
isOperator = ! followingIsVararg()
1835
1835
&& ! isPureArrow
1836
- && ! (isIdent(nme.as) && in.featureEnabled( Feature .modularity ))
1836
+ && ! (isIdent(nme.as) && sourceVersion.isAtLeast(`3.6` ))
1837
1837
&& nextCanFollowOperator(canStartInfixTypeTokens))
1838
1838
1839
1839
/** RefinedType ::= WithType {[nl] Refinement} [`^` CaptureSet]
@@ -2226,18 +2226,19 @@ object Parsers {
2226
2226
def contextBound (pname : TypeName ): Tree =
2227
2227
val t = toplevelTyp()
2228
2228
val ownName =
2229
- if isIdent(nme.as) && in.featureEnabled( Feature .modularity ) then
2229
+ if isIdent(nme.as) && sourceVersion.isAtLeast(`3.6` ) then
2230
2230
in.nextToken()
2231
2231
ident()
2232
2232
else EmptyTermName
2233
2233
ContextBoundTypeTree (t, pname, ownName)
2234
2234
2235
- /** ContextBounds ::= ContextBound | `{` ContextBound {`,` ContextBound} `}`
2235
+ /** ContextBounds ::= ContextBound [`:` ContextBounds]
2236
+ * | `{` ContextBound {`,` ContextBound} `}`
2236
2237
*/
2237
2238
def contextBounds (pname : TypeName ): List [Tree ] =
2238
2239
if in.isColon then
2239
2240
in.nextToken()
2240
- if in.token == LBRACE && in.featureEnabled( Feature .modularity )
2241
+ if in.token == LBRACE && sourceVersion.isAtLeast(`3.6` )
2241
2242
then inBraces(commaSeparated(() => contextBound(pname)))
2242
2243
else contextBound(pname) :: contextBounds(pname)
2243
2244
else if in.token == VIEWBOUND then
@@ -4189,7 +4190,7 @@ object Parsers {
4189
4190
def givenDef (start : Offset , mods : Modifiers , givenMod : Mod ) = atSpan(start, nameStart) {
4190
4191
var mods1 = addMod(mods, givenMod)
4191
4192
val nameStart = in.offset
4192
- var newSyntaxAllowed = in.featureEnabled( Feature .modularity )
4193
+ var newSyntaxAllowed = sourceVersion.isAtLeast(`3.6` )
4193
4194
val hasEmbeddedColon = ! in.isColon && followingIsGivenDefWithColon()
4194
4195
val name = if isIdent && hasEmbeddedColon then ident() else EmptyTermName
4195
4196
@@ -4293,11 +4294,6 @@ object Parsers {
4293
4294
// old-style abstract given
4294
4295
if name.isEmpty then
4295
4296
syntaxError(em " Anonymous given cannot be abstract, or maybe you want to define a concrete given and are missing a `()` argument? " , in.lastOffset)
4296
- if newSyntaxAllowed then
4297
- warning(
4298
- em """ This defines an abstract given, which is deprecated. Use a `deferred` given instead.
4299
- |Or, if you intend to define a concrete given, follow the type with `()` arguments. """ ,
4300
- in.lastOffset)
4301
4297
DefDef (name, adjustDefParams(joinParams(tparams, vparamss)), parents.head, EmptyTree )
4302
4298
else
4303
4299
// structural instance
0 commit comments