Skip to content

Commit f80d99f

Browse files
committed
Turn tests into neg tests
1 parent edc06f5 commit f80d99f

File tree

5 files changed

+34
-29
lines changed

5 files changed

+34
-29
lines changed

tests/neg/erased-24.scala

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
}

tests/pos/erased-pathdep-1.scala tests/neg/erased-pathdep-1.scala

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
// Could become a neg test if we had totality checking for erased arguments
2+
13
object Test {
24

35
fun1(new Bar)
46
fun2(new Bar)
57
fun3(new Bar)
68

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
1012
}
1113

1214
class Foo {

tests/pos/erased-pathdep-2.scala tests/neg/erased-pathdep-2.scala

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
// Could become a neg test if we had totality checking for erased arguments
2+
13
object Test {
24

35
type F >: Bar <: Foo
46

57
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
810
}
911

1012
}

tests/run/erased-24.check

-1
This file was deleted.

tests/run/erased-24.scala

-23
This file was deleted.

0 commit comments

Comments
 (0)