Skip to content

Commit fa0a25f

Browse files
committed
Allow case classes that only have type parameters
A case class like case class C[T] is OK, it cannot be mistaken for an object.
1 parent 6b13112 commit fa0a25f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,8 @@ object desugar {
320320
val constrTparams = impliedTparams.map(toDefParam)
321321
val constrVparamss =
322322
if (originalVparamss.isEmpty) { // ensure parameter list is non-empty
323-
if (isCaseClass) ctx.error(CaseClassMissingParamList(cdef), cdef.namePos)
323+
if (isCaseClass && originalTparams.isEmpty)
324+
ctx.error(CaseClassMissingParamList(cdef), cdef.namePos)
324325
ListOfNil
325326
}
326327
else originalVparamss.nestedMap(toDefParam)

0 commit comments

Comments
 (0)