@@ -1011,7 +1011,7 @@ object Parsers {
1011
1011
skipParams()
1012
1012
lookahead.isColon
1013
1013
&& {
1014
- ! sourceVersion.isAtLeast(`3.6`)
1014
+ ! sourceVersion.enablesNewGivens
1015
1015
|| { // in the new given syntax, a `:` at EOL after an identifier represents a single identifier given
1016
1016
// Example:
1017
1017
// given C:
@@ -1870,7 +1870,7 @@ object Parsers {
1870
1870
infixOps(t, canStartInfixTypeTokens, operand, Location .ElseWhere , ParseKind .Type ,
1871
1871
isOperator = ! followingIsVararg()
1872
1872
&& ! isPureArrow
1873
- && ! (isIdent(nme.as) && sourceVersion.isAtLeast(`3.6`) && inContextBound)
1873
+ && ! (isIdent(nme.as) && sourceVersion.enablesNewGivens && inContextBound)
1874
1874
&& nextCanFollowOperator(canStartInfixTypeTokens))
1875
1875
1876
1876
/** RefinedType ::= WithType {[nl] Refinement} [`^` CaptureSet]
@@ -2263,7 +2263,7 @@ object Parsers {
2263
2263
def contextBound (pname : TypeName ): Tree =
2264
2264
val t = toplevelTyp(inContextBound = true )
2265
2265
val ownName =
2266
- if isIdent(nme.as) && sourceVersion.isAtLeast(`3.6`) then
2266
+ if isIdent(nme.as) && sourceVersion.enablesNewGivens then
2267
2267
in.nextToken()
2268
2268
ident()
2269
2269
else EmptyTermName
@@ -2276,7 +2276,7 @@ object Parsers {
2276
2276
def contextBounds (pname : TypeName ): List [Tree ] =
2277
2277
if in.isColon then
2278
2278
in.nextToken()
2279
- if in.token == LBRACE && sourceVersion.isAtLeast(`3.6`)
2279
+ if in.token == LBRACE && sourceVersion.enablesNewGivens
2280
2280
then inBraces(commaSeparated(() => contextBound(pname)))
2281
2281
else
2282
2282
val bound = contextBound(pname)
@@ -3500,7 +3500,7 @@ object Parsers {
3500
3500
val hkparams = typeParamClauseOpt(ParamOwner .Hk )
3501
3501
val bounds =
3502
3502
if paramOwner.acceptsCtxBounds then typeAndCtxBounds(name)
3503
- else if sourceVersion.isAtLeast(`3.6`) && paramOwner == ParamOwner .Type then typeAndCtxBounds(name)
3503
+ else if sourceVersion.enablesNewGivens && paramOwner == ParamOwner .Type then typeAndCtxBounds(name)
3504
3504
else typeBounds()
3505
3505
TypeDef (name, lambdaAbstract(hkparams, bounds)).withMods(mods)
3506
3506
}
@@ -4069,7 +4069,7 @@ object Parsers {
4069
4069
case SEMI | NEWLINE | NEWLINES | COMMA | RBRACE | OUTDENT | EOF =>
4070
4070
makeTypeDef(typeAndCtxBounds(tname))
4071
4071
case _ if (staged & StageKind .QuotedPattern ) != 0
4072
- || sourceVersion.isAtLeast(`3.6`) && in.isColon =>
4072
+ || sourceVersion.enablesNewGivens && in.isColon =>
4073
4073
makeTypeDef(typeAndCtxBounds(tname))
4074
4074
case _ =>
4075
4075
syntaxErrorOrIncomplete(ExpectedTypeBoundOrEquals (in.token))
@@ -4244,7 +4244,7 @@ object Parsers {
4244
4244
def givenDef (start : Offset , mods : Modifiers , givenMod : Mod ) = atSpan(start, nameStart) {
4245
4245
var mods1 = addMod(mods, givenMod)
4246
4246
val nameStart = in.offset
4247
- var newSyntaxAllowed = sourceVersion.isAtLeast(`3.6`)
4247
+ var newSyntaxAllowed = sourceVersion.enablesNewGivens
4248
4248
val hasEmbeddedColon = ! in.isColon && followingIsGivenDefWithColon()
4249
4249
val name = if isIdent && hasEmbeddedColon then ident() else EmptyTermName
4250
4250
0 commit comments