blob: c13c130721c42b7795c83ce28e4bdf49fbda8123 (
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
}
|