Skip to content

Commit 1ec425a

Browse files
committed
Drop with in front of template syntax
This was no longer supported but still recognized by the parser
1 parent dbbf588 commit 1ec425a

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

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

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2310,7 +2310,7 @@ object Parsers {
23102310
possibleTemplateStart()
23112311
val parents =
23122312
if in.isNestedStart then Nil
2313-
else constrApps(commaOK = false, templateCanFollow = true)
2313+
else constrApps(commaOK = false)
23142314
colonAtEOLOpt()
23152315
possibleTemplateStart(isNew = true)
23162316
parents match {
@@ -3493,7 +3493,7 @@ object Parsers {
34933493
val parents =
34943494
if (in.token == EXTENDS) {
34953495
in.nextToken()
3496-
constrApps(commaOK = true, templateCanFollow = false)
3496+
constrApps(commaOK = true)
34973497
}
34983498
else Nil
34993499
Template(constr, parents, Nil, EmptyValDef, Nil)
@@ -3537,7 +3537,7 @@ object Parsers {
35373537
val noParams = tparams.isEmpty && vparamss.isEmpty
35383538
if !(name.isEmpty && noParams) then
35393539
accept(nme.as)
3540-
val parents = constrApps(commaOK = true, templateCanFollow = true)
3540+
val parents = constrApps(commaOK = true)
35413541
if in.token == EQUALS && parents.length == 1 && parents.head.isType then
35423542
accept(EQUALS)
35433543
mods1 |= Final
@@ -3617,19 +3617,12 @@ object Parsers {
36173617

36183618
/** ConstrApps ::= ConstrApp {(‘,’ | ‘with’) ConstrApp}
36193619
*/
3620-
def constrApps(commaOK: Boolean, templateCanFollow: Boolean): List[Tree] =
3620+
def constrApps(commaOK: Boolean): List[Tree] =
36213621
val t = constrApp()
36223622
val ts =
3623-
if in.token == WITH then
3623+
if in.token == WITH || commaOK && in.token == COMMA then
36243624
in.nextToken()
3625-
newLineOptWhenFollowedBy(LBRACE)
3626-
if templateCanFollow && (in.token == LBRACE || in.token == INDENT) then
3627-
Nil
3628-
else
3629-
constrApps(commaOK, templateCanFollow)
3630-
else if commaOK && in.token == COMMA then
3631-
in.nextToken()
3632-
constrApps(commaOK, templateCanFollow)
3625+
constrApps(commaOK)
36333626
else Nil
36343627
t :: ts
36353628

@@ -3646,7 +3639,7 @@ object Parsers {
36463639
in.sourcePos())
36473640
Nil
36483641
}
3649-
else constrApps(commaOK = true, templateCanFollow = true)
3642+
else constrApps(commaOK = true)
36503643
}
36513644
else Nil
36523645
newLinesOptWhenFollowedBy(nme.derives)

0 commit comments

Comments
 (0)