File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ trait HasY { type Y }
2
+
3
+ // These are neg-tests corresponding to the pos-test Variances.scala
4
+ // where all the variance annotations have been inverted.
5
+ trait Foo1 [+ X ] { def bar [Y <: X ](y : Y ) = y } // error
6
+ trait Foo2 [+ X ] { def bar (x : HasY { type Y <: X })(y : x.Y ) = y } // error
7
+ trait Foo3 [- X ] { def bar [Y >: X ](y : Y ) = y } // error
8
+ trait Foo4 [- X ] { def bar (x : HasY { type Y >: X })(y : x.Y ) = y } // error
9
+
10
+ // These are neg-tests corresponding to the pos-test Variances.scala
11
+ // where all the bounds have been flipped.
12
+ trait Foo5 [- X ] { def bar [Y >: X ](y : Y ) = y } // error
13
+ trait Foo6 [- X ] { def bar (x : HasY { type Y >: X })(y : x.Y ) = y } // error
14
+ trait Foo7 [+ X ] { def bar [Y <: X ](y : Y ) = y } // error
15
+ trait Foo8 [+ X ] { def bar (x : HasY { type Y <: X })(y : x.Y ) = y } // error
Original file line number Diff line number Diff line change
1
+ trait HasY { type Y }
2
+
3
+ // This works in scalac.
4
+ trait Foo1 [- X ] { def bar [Y <: X ](y : Y ) = y }
5
+
6
+ // A variant of the Foo1 using a dependent method type (doesn't work
7
+ // using scalac)
8
+ trait Foo2 [- X ] { def bar (x : HasY { type Y <: X })(y : x.Y ) = y }
9
+
10
+ // This works in scalac.
11
+ trait Foo3 [+ X ] { def bar [Y >: X ](y : Y ) = y }
12
+
13
+ // A variant of the Foo4 using a dependent method type (doesn't work
14
+ // using scalac)
15
+ trait Foo4 [+ X ] { def bar (x : HasY { type Y >: X })(y : x.Y ) = y }
You can’t perform that action at this time.
0 commit comments