summaryrefslogtreecommitdiff
path: root/test/files/run/t8433.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run/t8433.scala')
-rw-r--r--test/files/run/t8433.scala46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/files/run/t8433.scala b/test/files/run/t8433.scala
new file mode 100644
index 0000000000..79e18757b8
--- /dev/null
+++ b/test/files/run/t8433.scala
@@ -0,0 +1,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}"
+}