From a6152b4c2c0a26835e60a8ef209cca87bec8510e Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Wed, 7 Dec 2011 21:18:25 +0100 Subject: Fix reflective toolbox producing invalid bytecode Wrapper method for AST undergoing a reflective compilation has been incorrectly marked as static. This was off the radars until one day the code being compiled declared a top-level method. During flatten that method got hoisted into the wrapper module, and its invocation got translated into an instance call upon the module. This led to static wrapper method trying to call an instance method, and that blew up the bytecode verifier. More info: https://issues.scala-lang.org/browse/SI-5266. Fixes SI-5266, review by @odersky. --- test/pending/run/t5266_1.check | 2 -- test/pending/run/t5266_1.scala | 23 ----------------------- test/pending/run/t5266_2.check | 2 -- test/pending/run/t5266_2.scala | 17 ----------------- 4 files changed, 44 deletions(-) delete mode 100644 test/pending/run/t5266_1.check delete mode 100644 test/pending/run/t5266_1.scala delete mode 100644 test/pending/run/t5266_2.check delete mode 100644 test/pending/run/t5266_2.scala (limited to 'test/pending') diff --git a/test/pending/run/t5266_1.check b/test/pending/run/t5266_1.check deleted file mode 100644 index 3feac16a0b..0000000000 --- a/test/pending/run/t5266_1.check +++ /dev/null @@ -1,2 +0,0 @@ -2 -evaluated = null \ No newline at end of file diff --git a/test/pending/run/t5266_1.scala b/test/pending/run/t5266_1.scala deleted file mode 100644 index 06a81a04ea..0000000000 --- a/test/pending/run/t5266_1.scala +++ /dev/null @@ -1,23 +0,0 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox - -object Test extends App { - val code = scala.reflect.Code.lift{ - def x = 2 - println(x) - }; - - val settings = new Settings - settings.debug.value = true - settings.Xshowtrees.value = true - settings.Xprint.value = List("typer") - settings.printtypes.value = true - settings.Ytyperdebug.value = true - - val reporter = new ConsoleReporter(settings) - val toolbox = new ToolBox(reporter) - val ttree = toolbox.typeCheck(code.tree) - val evaluated = toolbox.runExpr(ttree) - println("evaluated = " + evaluated) -} \ No newline at end of file diff --git a/test/pending/run/t5266_2.check b/test/pending/run/t5266_2.check deleted file mode 100644 index 3feac16a0b..0000000000 --- a/test/pending/run/t5266_2.check +++ /dev/null @@ -1,2 +0,0 @@ -2 -evaluated = null \ No newline at end of file diff --git a/test/pending/run/t5266_2.scala b/test/pending/run/t5266_2.scala deleted file mode 100644 index cd841da021..0000000000 --- a/test/pending/run/t5266_2.scala +++ /dev/null @@ -1,17 +0,0 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox - -object Test extends App { - val code = scala.reflect.Code.lift{ - def x = 2 - def y = x - println(y) - }; - - val reporter = new ConsoleReporter(settings) - val toolbox = new ToolBox(reporter) - val ttree = toolbox.typeCheck(code.tree) - val evaluated = toolbox.runExpr(ttree) - println("evaluated = " + evaluated) -} -- cgit v1.2.3