-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
area:match-typesitype:bugitype:soundnessSoundness bug (it lets us compile code that crashes at runtime with a ClassCastException)Soundness bug (it lets us compile code that crashes at runtime with a ClassCastException)regressionThis worked in a previous version but doesn't anymoreThis worked in a previous version but doesn't anymore
Milestone
Description
Match type with no cases reduces to unreported ErrorType
Compiler version
3.4.2-RC1
Minimized code
trait T[N]:
type M = N match
case 0 => Any // or anything else
val t: T[Double] = new T[Double] {}
val x: t.M = "hello"
val y: Boolean = x // compiles + ClassCastException
We also have the same issue when using a projection:
val z: T[Double]#M = "hello"
val _: Boolean = z // compiles + ClassCastException
Minimised from @Gedochao's #19936 (comment)
Gedochao and lbialy
Metadata
Metadata
Assignees
Labels
area:match-typesitype:bugitype:soundnessSoundness bug (it lets us compile code that crashes at runtime with a ClassCastException)Soundness bug (it lets us compile code that crashes at runtime with a ClassCastException)regressionThis worked in a previous version but doesn't anymoreThis worked in a previous version but doesn't anymore