Skip to content

Commit 1071067

Browse files
committed
Extra tests for Phantoms 2.
1 parent 1fd91be commit 1071067

6 files changed

+90
-0
lines changed

tests/run/phantom-lazy-val.check

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
1
2+
foo
3+
2

tests/run/phantom-lazy-val.scala

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
/* Run this test with
3+
* `run tests/run/xyz.scala -Xprint-diff-del -Xprint:arrayConstructors,phantomTermErasure,phantomTypeErasure,erasure`
4+
* to see the the diffs after PhantomRefErasure, PhantomDeclErasure and Erasure.
5+
*/
6+
7+
object Test {
8+
import Boo._
9+
10+
def main(args: Array[String]): Unit = {
11+
println(1)
12+
foo
13+
println(2)
14+
foo
15+
}
16+
17+
lazy val foo = {
18+
println("foo")
19+
any
20+
}
21+
22+
}
23+
24+
object Boo extends Phantom {
25+
type BooAny = this.Any
26+
def any: BooAny = assume[BooAny]
27+
}

tests/run/phantom-val.check

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
foo
2+
1

tests/run/phantom-val.scala

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
/* Run this test with
3+
* `run tests/run/xyz.scala -Xprint-diff-del -Xprint:arrayConstructors,phantomTermErasure,phantomTypeErasure,erasure`
4+
* to see the the diffs after PhantomRefErasure, PhantomDeclErasure and Erasure.
5+
*/
6+
7+
object Test {
8+
import Boo._
9+
10+
def main(args: Array[String]): Unit = {
11+
println(1)
12+
foo
13+
foo
14+
15+
}
16+
17+
val foo = {
18+
println("foo")
19+
any
20+
}
21+
}
22+
23+
object Boo extends Phantom {
24+
type BooAny = this.Any
25+
def any: BooAny = assume[BooAny]
26+
}

tests/run/phantom-var.check

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
foo
2+
foo2

tests/run/phantom-var.scala

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
/* Run this test with
3+
* `run tests/run/xyz.scala -Xprint-diff-del -Xprint:arrayConstructors,phantomTermErasure,phantomTypeErasure,erasure`
4+
* to see the the diffs after PhantomRefErasure, PhantomDeclErasure and Erasure.
5+
*/
6+
7+
object Test {
8+
import Boo._
9+
10+
def main(args: Array[String]): Unit = {
11+
foo
12+
foo
13+
foo = {
14+
println("foo2")
15+
any
16+
}
17+
foo
18+
19+
}
20+
21+
var foo = {
22+
println("foo")
23+
any
24+
}
25+
}
26+
27+
object Boo extends Phantom {
28+
type BooAny = this.Any
29+
def any: BooAny = assume[BooAny]
30+
}

0 commit comments

Comments
 (0)