aboutsummaryrefslogtreecommitdiff
path: root/tests/pos/variances.scala
blob: 7ab9fe72a1ebbd68cac811704bea407c8058152a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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 }