blob: 79e18757b89751055cf21dfadce378f988da9d4a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
import tools.partest.DirectTest
import reflect.internal.util._
// mimic the resident compiler failure by recompiling
// the class with new run of same global.
object Test extends DirectTest {
override def code = """
object Main {
def main(args: Array[String]): Unit = {
Surf xmain args
import trial.core.Rankable
object Surf {
def xmain(args: Array[String]): Unit = println(new Strategy("win").rank)
}
class Strategy(name:String) extends Rankable
}
}
"""
override def show(): Unit = {
// first, compile the interface
val dependency = """
|package trial
|
|object core {
| trait Rankable {
| val rank: String = "high"
| }
|}
|""".stripMargin
assert(compileString(newCompiler())(dependency))
// a resident global
val g = newCompiler()
assert(compileString(g)(code))
ScalaClassLoader(getClass.getClassLoader) run ("Main", Nil)
assert(compileString(g)(code))
ScalaClassLoader(getClass.getClassLoader) run ("Main", Nil)
}
override def extraSettings = s"-usejavacp -d ${testOutput.path}"
}
|