diff --git a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala index eea9977aad21..e496faa8aaf5 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala @@ -1282,9 +1282,11 @@ object Parsers { def possibleTemplateStart(isNew: Boolean = false): Unit = in.observeColonEOL() if in.token == COLONEOL then - in.nextToken() - if in.token != INDENT then - syntaxErrorOrIncomplete(i"indented definitions expected") + if in.lookahead.isIdent(nme.end) then in.token = NEWLINE + else + in.nextToken() + if in.token != INDENT then + syntaxErrorOrIncomplete(i"indented definitions expected, ${in}") else newLineOptWhenFollowedBy(LBRACE) diff --git a/tests/pos/i10080.scala b/tests/pos/i10080.scala new file mode 100644 index 000000000000..81146e18ed82 --- /dev/null +++ b/tests/pos/i10080.scala @@ -0,0 +1,5 @@ +trait Foo: +end Foo + +trait Bar +end Bar