Skip to content

Commit a03a2fc

Browse files
committed
Address review comments
1 parent 8b00b61 commit a03a2fc

File tree

4 files changed

+8
-12
lines changed

4 files changed

+8
-12
lines changed

compiler/src/dotty/tools/dotc/config/Feature.scala

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ object Feature:
2929
val erasedDefinitions = experimental("erasedDefinitions")
3030
val symbolLiterals = deprecated("symbolLiterals")
3131
val saferExceptions = experimental("saferExceptions")
32-
val clauseInterleaving = experimental("clauseInterleaving")
3332
val pureFunctions = experimental("pureFunctions")
3433
val captureChecking = experimental("captureChecking")
3534
val into = experimental("into")

compiler/src/dotty/tools/dotc/config/SourceVersion.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ enum SourceVersion:
3434
def enablesFewerBraces = isAtLeast(`3.3`)
3535
def enablesClauseInterleaving = isAtLeast(`3.6`)
3636
def enablesNewGivens = isAtLeast(`3.6`)
37-
def enablesNamedTuples = isAtLeast(`3.6`)
37+
def enablesNamedTuples = isAtLeast(`3.7`)
3838

3939
object SourceVersion extends Property.Key[SourceVersion]:
4040
def defaultSourceVersion = `3.7`

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

+7-7
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,7 @@ object Parsers {
10111011
skipParams()
10121012
lookahead.isColon
10131013
&& {
1014-
!sourceVersion.isAtLeast(`3.6`)
1014+
!sourceVersion.enablesNewGivens
10151015
|| { // in the new given syntax, a `:` at EOL after an identifier represents a single identifier given
10161016
// Example:
10171017
// given C:
@@ -1870,7 +1870,7 @@ object Parsers {
18701870
infixOps(t, canStartInfixTypeTokens, operand, Location.ElseWhere, ParseKind.Type,
18711871
isOperator = !followingIsVararg()
18721872
&& !isPureArrow
1873-
&& !(isIdent(nme.as) && sourceVersion.isAtLeast(`3.6`) && inContextBound)
1873+
&& !(isIdent(nme.as) && sourceVersion.enablesNewGivens && inContextBound)
18741874
&& nextCanFollowOperator(canStartInfixTypeTokens))
18751875

18761876
/** RefinedType ::= WithType {[nl] Refinement} [`^` CaptureSet]
@@ -2263,7 +2263,7 @@ object Parsers {
22632263
def contextBound(pname: TypeName): Tree =
22642264
val t = toplevelTyp(inContextBound = true)
22652265
val ownName =
2266-
if isIdent(nme.as) && sourceVersion.isAtLeast(`3.6`) then
2266+
if isIdent(nme.as) && sourceVersion.enablesNewGivens then
22672267
in.nextToken()
22682268
ident()
22692269
else EmptyTermName
@@ -2276,7 +2276,7 @@ object Parsers {
22762276
def contextBounds(pname: TypeName): List[Tree] =
22772277
if in.isColon then
22782278
in.nextToken()
2279-
if in.token == LBRACE && sourceVersion.isAtLeast(`3.6`)
2279+
if in.token == LBRACE && sourceVersion.enablesNewGivens
22802280
then inBraces(commaSeparated(() => contextBound(pname)))
22812281
else
22822282
val bound = contextBound(pname)
@@ -3500,7 +3500,7 @@ object Parsers {
35003500
val hkparams = typeParamClauseOpt(ParamOwner.Hk)
35013501
val bounds =
35023502
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)
35043504
else typeBounds()
35053505
TypeDef(name, lambdaAbstract(hkparams, bounds)).withMods(mods)
35063506
}
@@ -4069,7 +4069,7 @@ object Parsers {
40694069
case SEMI | NEWLINE | NEWLINES | COMMA | RBRACE | OUTDENT | EOF =>
40704070
makeTypeDef(typeAndCtxBounds(tname))
40714071
case _ if (staged & StageKind.QuotedPattern) != 0
4072-
|| sourceVersion.isAtLeast(`3.6`) && in.isColon =>
4072+
|| sourceVersion.enablesNewGivens && in.isColon =>
40734073
makeTypeDef(typeAndCtxBounds(tname))
40744074
case _ =>
40754075
syntaxErrorOrIncomplete(ExpectedTypeBoundOrEquals(in.token))
@@ -4244,7 +4244,7 @@ object Parsers {
42444244
def givenDef(start: Offset, mods: Modifiers, givenMod: Mod) = atSpan(start, nameStart) {
42454245
var mods1 = addMod(mods, givenMod)
42464246
val nameStart = in.offset
4247-
var newSyntaxAllowed = sourceVersion.isAtLeast(`3.6`)
4247+
var newSyntaxAllowed = sourceVersion.enablesNewGivens
42484248
val hasEmbeddedColon = !in.isColon && followingIsGivenDefWithColon()
42494249
val name = if isIdent && hasEmbeddedColon then ident() else EmptyTermName
42504250

tests/pos/interleavingExperimental.scala

-3
This file was deleted.

0 commit comments

Comments
 (0)