File tree 5 files changed +34
-29
lines changed
5 files changed +34
-29
lines changed Original file line number Diff line number Diff line change
1
+ // Could become a run test if we had totality checking for erased arguments
2
+
3
+ object Test {
4
+
5
+ def main (args : Array [String ]): Unit = {
6
+ println(fun(new Bar ))
7
+ }
8
+
9
+ def fun (erased foo : Foo ): foo.X = { // error
10
+ null .asInstanceOf [foo.X ] // error
11
+ }
12
+
13
+ def fun2 (erased foo : Foo )(erased bar : foo.B ): bar.X = { // error // error
14
+ null .asInstanceOf [bar.X ] // error
15
+ }
16
+ }
17
+
18
+ class Foo {
19
+ type X
20
+ type B <: Bar
21
+ }
22
+
23
+ class Bar extends Foo {
24
+ type X = String
25
+ }
Original file line number Diff line number Diff line change
1
+ // Could become a neg test if we had totality checking for erased arguments
2
+
1
3
object Test {
2
4
3
5
fun1(new Bar )
4
6
fun2(new Bar )
5
7
fun3(new Bar )
6
8
7
- def fun1 [F >: Bar <: Foo ](erased f : F ): f.X = null .asInstanceOf [f.X ]
8
- def fun2 [F >: Bar <: Foo ](erased f : F )(erased bar : f.B ): f.B = null .asInstanceOf [f.B ]
9
- def fun3 [F >: Bar <: Foo ](erased f : F )(erased b : f.B ): b.X = null .asInstanceOf [b.X ]
9
+ def fun1 [F >: Bar <: Foo ](erased f : F ): f.X = null .asInstanceOf [f.X ] // error // error
10
+ def fun2 [F >: Bar <: Foo ](erased f : F )(erased bar : f.B ): f.B = null .asInstanceOf [f.B ] // error // error // error
11
+ def fun3 [F >: Bar <: Foo ](erased f : F )(erased b : f.B ): b.X = null .asInstanceOf [b.X ] // error // error // error
10
12
}
11
13
12
14
class Foo {
Original file line number Diff line number Diff line change
1
+ // Could become a neg test if we had totality checking for erased arguments
2
+
1
3
object Test {
2
4
3
5
type F >: Bar <: Foo
4
6
5
7
class A (erased val f : F ) {
6
- type F1 <: f.X
7
- type F2 [Z <: f.X ]
8
+ type F1 <: f.X // error
9
+ type F2 [Z <: f.X ] // error
8
10
}
9
11
10
12
}
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments