aboutsummaryrefslogtreecommitdiff
path: root/tests/neg
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-11-09 19:00:14 +0100
committerMartin Odersky <odersky@gmail.com>2013-11-09 19:00:14 +0100
commita7b60116c30677eeff310b81af2fa714bf1950d6 (patch)
tree40de9fd78f40b0adfc6d2600b4f60f5b7721519b /tests/neg
parent3bc8f5dceba014ddd0c7e5cc8080009439c5b363 (diff)
downloaddotty-a7b60116c30677eeff310b81af2fa714bf1950d6.tar.gz
dotty-a7b60116c30677eeff310b81af2fa714bf1950d6.tar.bz2
dotty-a7b60116c30677eeff310b81af2fa714bf1950d6.zip
New tests.
Diffstat (limited to 'tests/neg')
-rw-r--r--tests/neg/patternUnsoundness.scala17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/neg/patternUnsoundness.scala b/tests/neg/patternUnsoundness.scala
new file mode 100644
index 000000000..b3d699a5c
--- /dev/null
+++ b/tests/neg/patternUnsoundness.scala
@@ -0,0 +1,17 @@
+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
+} \ No newline at end of file