Closed
Description
The following produces a type error:
enum Foo3[T](x: T) {
case Bar[S, T](y: T) extends Foo3[y.type](y)
}
See discussion in #3903 for details. The problem is that the expansion of Bar
's apply
method does not typecheck:
def apply[S, T](y: T): Foo3[y.type] = new Foo3.Bar[S, T](y)
A proper fix would require #3920 to be addressed. We could try to prevent code like this by restricting enum case parents, but maybe it's simpler to just accept that the expansion need not
always be type correct.
Metadata
Metadata
Assignees
Labels
No labels