blob: 4620f6c7de3e83212c6d5bea9a340bc0fd3d320d (
plain) (
tree)
|
|
object patternUnsoundness extends App {
class C[+T]
case class D[S](_s: S) extends C[S] {
var s: S = _s
}
val x = new D[String]("abc")
val y: C[Object] = x
y match {
case d @ D(x) => d.s = new Integer(1)
}
val z: String = x.s // ClassCast exception
}
|