From 9393efc68a2c057a9b6e7d1c148355024d46a8aa Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Sun, 4 Dec 2011 20:27:06 +0100 Subject: Reification of classes now produces trees that can be compiled and run. Multiple minor fixes to Martin's implementation of reflection infrastructure. Dominating theme is allowing for the fact that compilation via reflection involves numerous exports/imports between various reflection universes. Fixes SI-5230. Review by @odersky. --- test/files/run/t5230.check | 2 ++ test/files/run/t5230.scala | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 test/files/run/t5230.check create mode 100644 test/files/run/t5230.scala (limited to 'test/files/run') diff --git a/test/files/run/t5230.check b/test/files/run/t5230.check new file mode 100644 index 0000000000..5db6ec9b38 --- /dev/null +++ b/test/files/run/t5230.check @@ -0,0 +1,2 @@ +2 +evaluated = null diff --git a/test/files/run/t5230.scala b/test/files/run/t5230.scala new file mode 100644 index 0000000000..5aab8f9290 --- /dev/null +++ b/test/files/run/t5230.scala @@ -0,0 +1,19 @@ +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{ + class C { + val x = 2 + } + + println(new C().x) + }; + + val reporter = new ConsoleReporter(new Settings) + val toolbox = new ToolBox(reporter) + val ttree = toolbox.typeCheck(code.tree) + val evaluated = toolbox.runExpr(ttree) + println("evaluated = " + evaluated) +} -- cgit v1.2.3