Closed
Description
The following program compiles and throws a ClassCastException when executed. One might be tempted to try to rule out the obviously bad intersection T & U
but we know from our work on DOT that there are ways to engineer bad bounds that cannot be detected locally. So the culprit is the projection
X#A
.
object Test {
trait C { type A }
type T = C { type A >: Any }
type U = C { type A <: Nothing }
type X = T & U
def main(args: Array[String]) = {
val y: X#A = 1
val z: String = y
}
}