aboutsummaryrefslogtreecommitdiff
path: root/tests/pos/variances.scala
diff options
context:
space:
mode:
Diffstat (limited to 'tests/pos/variances.scala')
-rw-r--r--tests/pos/variances.scala15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/pos/variances.scala b/tests/pos/variances.scala
index db858fd5d..7ab9fe72a 100644
--- a/tests/pos/variances.scala
+++ b/tests/pos/variances.scala
@@ -1,3 +1,18 @@
trait C[+T <: C[T, U], -U <: C[T, U]] {
}
+trait HasY { type Y }
+
+// This works in scalac.
+trait Foo1[-X] { def bar[Y <: X](y: Y) = y }
+
+// A variant of Foo1 using a dependent method type (doesn't work using
+// scalac)
+trait Foo2[-X] { def bar(x: HasY { type Y <: X })(y: x.Y) = y }
+
+// This works in scalac.
+trait Foo3[+X] { def bar[Y >: X](y: Y) = y }
+
+// A variant of Foo3 using a dependent method type (doesn't work
+// using scalac)
+trait Foo4[+X] { def bar(x: HasY { type Y >: X })(y: x.Y) = y }