Skip to content

Commit 1fd91be

Browse files
committed
Extra tests for Phantoms 1.
1 parent 9bf1dbc commit 1fd91be

File tree

6 files changed

+96
-0
lines changed

6 files changed

+96
-0
lines changed

tests/run/phantom-methods-10.check

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

tests/run/phantom-methods-10.scala

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

tests/run/phantom-methods-8.check

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

tests/run/phantom-methods-8.scala

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

tests/run/phantom-methods-9.check

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

tests/run/phantom-methods-9.scala

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

0 commit comments

Comments
 (0)