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 projectionX#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
}
}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4