File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
compiler/src/dotty/tools/dotc/ast Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -297,7 +297,11 @@ object desugar {
297
297
// This is not watertight, but `extends AnyVal` will be replaced by `inline` later.
298
298
299
299
val originalTparams =
300
- if (isEnumCase && parents.isEmpty) reconstitutedEnumTypeParams(cdef.pos.startPos)
300
+ if (isEnumCase && parents.isEmpty) {
301
+ if (constr1.tparams.nonEmpty)
302
+ ctx.error(em " case with type parameters needs extends clause " , constr1.tparams.head.pos)
303
+ reconstitutedEnumTypeParams(cdef.pos.startPos)
304
+ }
301
305
else constr1.tparams
302
306
val originalVparamss = constr1.vparamss
303
307
val constrTparams = originalTparams.map(toDefParam)
Original file line number Diff line number Diff line change 1
1
enum List [+ T ] {
2
2
case Cons (x : T , xs : List [T ])
3
3
case Nil // error: illegal enum value
4
+ case Snoc [U ](xs : List [U ], x : U ) // error: case with type parameters needs extends clause // error // error // error
4
5
}
5
6
6
7
enum class X {
You can’t perform that action at this time.
0 commit comments