Closed
Description
object Test {
trait A[+X] { def x: X }
class B[+X](val x: X) extends A[X]
class C[+X](x: Any) extends B[Any](x) with A[X]
def get(a: A[Int]): Int = a.x
get(new C[Int]("foo")) // class cast exception: String is not Int
}
Note that we previously came to the conclusion that we do not want to prevent inheritance like C
in general: #3989.
The likely fix would be to require C
to override B#x
- this is precisely what Scalac does.