aboutsummaryrefslogtreecommitdiff
path: root/tests/neg/variances.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-03-31 11:50:49 +0200
committerMartin Odersky <odersky@gmail.com>2016-03-31 11:50:49 +0200
commit7871236ec02d8fbf4cc16c329c737d9e2ee682f3 (patch)
treef62d5b05f495d2b89b47643afa49c02f2c78aaca /tests/neg/variances.scala
parent5bd08d437c1365bd8a81cb1b6b9801b443fde96b (diff)
downloaddotty-7871236ec02d8fbf4cc16c329c737d9e2ee682f3.tar.gz
dotty-7871236ec02d8fbf4cc16c329c737d9e2ee682f3.tar.bz2
dotty-7871236ec02d8fbf4cc16c329c737d9e2ee682f3.zip
merge variances and Variances
Diffstat (limited to 'tests/neg/variances.scala')
-rw-r--r--tests/neg/variances.scala15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/neg/variances.scala b/tests/neg/variances.scala
index 71ee504bc..d732bb6db 100644
--- a/tests/neg/variances.scala
+++ b/tests/neg/variances.scala
@@ -41,4 +41,19 @@ object Test2 extends App {
}
+trait HasY { type Y }
+
+// These are neg-tests corresponding to the pos-test Variances.scala
+// where all the variance annotations have been inverted.
+trait Foo1[+X] { def bar[Y <: X](y: Y) = y } // error
+trait Foo2[+X] { def bar(x: HasY { type Y <: X })(y: x.Y) = y } // error
+trait Foo3[-X] { def bar[Y >: X](y: Y) = y } // error
+trait Foo4[-X] { def bar(x: HasY { type Y >: X })(y: x.Y) = y } // error
+
+// These are neg-tests corresponding to the pos-test Variances.scala
+// where all the bounds have been flipped.
+trait Foo5[-X] { def bar[Y >: X](y: Y) = y } // error
+trait Foo6[-X] { def bar(x: HasY { type Y >: X })(y: x.Y) = y } // error
+trait Foo7[+X] { def bar[Y <: X](y: Y) = y } // error
+trait Foo8[+X] { def bar(x: HasY { type Y <: X })(y: x.Y) = y } // error