diff options
author | Martin Odersky <odersky@gmail.com> | 2011-09-21 16:24:12 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2011-09-21 16:24:12 +0000 |
commit | dfd19afc50a7e8a93656c5678acf687745eb6706 (patch) | |
tree | 70d63f4b32477a4a86cd2d8d2d0bc887476ca130 /test/disabled | |
parent | 4e3a9a64a866df42ca3fd99dfc76a2cd9f1f7562 (diff) | |
download | scala-dfd19afc50a7e8a93656c5678acf687745eb6706.tar.gz scala-dfd19afc50a7e8a93656c5678acf687745eb6706.tar.bz2 scala-dfd19afc50a7e8a93656c5678acf687745eb6706.zip |
Started work on compiler toolbox that can compi...
Started work on compiler toolbox that can compile reflect trees at
runtime.
Diffstat (limited to 'test/disabled')
-rw-r--r-- | test/disabled/pos/code.scala | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/test/disabled/pos/code.scala b/test/disabled/pos/code.scala index 707dda3e3b..57292c32df 100644 --- a/test/disabled/pos/code.scala +++ b/test/disabled/pos/code.scala @@ -1,7 +1,22 @@ +import reflect.runtime.Mirror.ToolBox +import scala.tools.nsc.reporters._ + object Test extends App { def foo[T](ys: List[T]) = { val fun: reflect.Code[Int => Int] = x => x + ys.length fun } - println(foo(List(2)).tree) + val code = foo(List(2)) + val tree = foo(List(2)code.tree.asInstanceOf[scala.reflect.runtime.Mirror.Tree] + val targetType = code.manifest.tpe + val reporter = new StoreReporter + val toolbox = new ToolBox(reporter) + val ttree = toolbox.typeCheck(tree, targetType) + if (reporter.infos.nonEmpty) { + reporter.infos foreach println + println("compilaton failed") + } else { + println("result = "+ttree) + } } + |