summaryrefslogtreecommitdiff
path: root/test/files/run/t5230.scala
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2011-12-04 20:27:06 +0100
committerEugene Burmako <xeno.by@gmail.com>2011-12-04 20:46:58 +0100
commit9393efc68a2c057a9b6e7d1c148355024d46a8aa (patch)
tree02a4321829e1bff80b3a9c714437170e1717f0a5 /test/files/run/t5230.scala
parent3e9e4ecf360e6eda5c26f798abfcb9bb882cf772 (diff)
downloadscala-9393efc68a2c057a9b6e7d1c148355024d46a8aa.tar.gz
scala-9393efc68a2c057a9b6e7d1c148355024d46a8aa.tar.bz2
scala-9393efc68a2c057a9b6e7d1c148355024d46a8aa.zip
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.
Diffstat (limited to 'test/files/run/t5230.scala')
-rw-r--r--test/files/run/t5230.scala19
1 files changed, 19 insertions, 0 deletions
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)
+}