summaryrefslogtreecommitdiff
path: root/test/disabled/pos/code.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/disabled/pos/code.scala')
-rw-r--r--test/disabled/pos/code.scala17
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)
+ }
}
+