Skip to content

Commit d82cc9a

Browse files
committed
Add empty case class params check. Add test.
1 parent 36707c7 commit d82cc9a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2396,7 +2396,15 @@ object Parsers {
23962396
}
23972397
else Nil
23982398
}
2399-
recur(firstClause = true, 0, ofInstance)
2399+
2400+
val start = in.lastOffset
2401+
val params = recur(firstClause = true, 0, ofInstance)
2402+
2403+
if(ofCaseClass && params.isEmpty)
2404+
syntaxError( "case classes without a parameter list are not allowed;\n"+
2405+
"use either case objects or case classes with an explicit `()' as a parameter list.", start)
2406+
2407+
params
24002408
}
24012409

24022410
/* -------- DEFS ------------------------------------------- */

0 commit comments

Comments
 (0)