@@ -994,8 +994,8 @@ object Parsers {
994994 skipParams()
995995 lookahead.isColon
996996 && {
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
999999 // Example:
10001000 // given C:
10011001 // def f = ...
@@ -1833,7 +1833,7 @@ object Parsers {
18331833 infixOps(t, canStartInfixTypeTokens, operand, Location .ElseWhere , ParseKind .Type ,
18341834 isOperator = ! followingIsVararg()
18351835 && ! isPureArrow
1836- && ! (isIdent(nme.as) && in.featureEnabled( Feature .modularity ))
1836+ && ! (isIdent(nme.as) && sourceVersion.isAtLeast(`3.6` ))
18371837 && nextCanFollowOperator(canStartInfixTypeTokens))
18381838
18391839 /** RefinedType ::= WithType {[nl] Refinement} [`^` CaptureSet]
@@ -2226,18 +2226,19 @@ object Parsers {
22262226 def contextBound (pname : TypeName ): Tree =
22272227 val t = toplevelTyp()
22282228 val ownName =
2229- if isIdent(nme.as) && in.featureEnabled( Feature .modularity ) then
2229+ if isIdent(nme.as) && sourceVersion.isAtLeast(`3.6` ) then
22302230 in.nextToken()
22312231 ident()
22322232 else EmptyTermName
22332233 ContextBoundTypeTree (t, pname, ownName)
22342234
2235- /** ContextBounds ::= ContextBound | `{` ContextBound {`,` ContextBound} `}`
2235+ /** ContextBounds ::= ContextBound [`:` ContextBounds]
2236+ * | `{` ContextBound {`,` ContextBound} `}`
22362237 */
22372238 def contextBounds (pname : TypeName ): List [Tree ] =
22382239 if in.isColon then
22392240 in.nextToken()
2240- if in.token == LBRACE && in.featureEnabled( Feature .modularity )
2241+ if in.token == LBRACE && sourceVersion.isAtLeast(`3.6` )
22412242 then inBraces(commaSeparated(() => contextBound(pname)))
22422243 else contextBound(pname) :: contextBounds(pname)
22432244 else if in.token == VIEWBOUND then
@@ -4189,7 +4190,7 @@ object Parsers {
41894190 def givenDef (start : Offset , mods : Modifiers , givenMod : Mod ) = atSpan(start, nameStart) {
41904191 var mods1 = addMod(mods, givenMod)
41914192 val nameStart = in.offset
4192- var newSyntaxAllowed = in.featureEnabled( Feature .modularity )
4193+ var newSyntaxAllowed = sourceVersion.isAtLeast(`3.6` )
41934194 val hasEmbeddedColon = ! in.isColon && followingIsGivenDefWithColon()
41944195 val name = if isIdent && hasEmbeddedColon then ident() else EmptyTermName
41954196
@@ -4293,11 +4294,6 @@ object Parsers {
42934294 // old-style abstract given
42944295 if name.isEmpty then
42954296 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)
43014297 DefDef (name, adjustDefParams(joinParams(tparams, vparamss)), parents.head, EmptyTree )
43024298 else
43034299 // structural instance
0 commit comments