Skip to content

Commit fec3ec3

Browse files
authored
Merge pull request #1418 from dotty-staging/fix-1353
Fix #1353 : more friendly error message for case trait
2 parents 9396006 + c44b993 commit fec3ec3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2046,7 +2046,10 @@ object Parsers {
20462046
else if (in.token == AT || isTemplateIntro || isModifier)
20472047
stats += tmplDef(in.offset, defAnnotsMods(modifierTokens))
20482048
else if (!isStatSep) {
2049-
syntaxErrorOrIncomplete("expected class or object definition")
2049+
if (in.token == CASE)
2050+
syntaxErrorOrIncomplete("only `case class` or `case object` allowed")
2051+
else
2052+
syntaxErrorOrIncomplete("expected class or object definition")
20502053
if (mustStartStat) // do parse all definitions even if they are probably local (i.e. a "}" has been forgotten)
20512054
defOrDcl(in.offset, defAnnotsMods(modifierTokens))
20522055
}

0 commit comments

Comments
 (0)