From 8f2d318ee2e09baee4e42da73aafb6999ff3874c Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Sun, 25 Dec 2011 11:06:04 +0100 Subject: A handful of tests for closures under reification --- test/pending/run/reify_closure5a.scala | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 test/pending/run/reify_closure5a.scala (limited to 'test/pending/run/reify_closure5a.scala') diff --git a/test/pending/run/reify_closure5a.scala b/test/pending/run/reify_closure5a.scala new file mode 100644 index 0000000000..0ac53d5479 --- /dev/null +++ b/test/pending/run/reify_closure5a.scala @@ -0,0 +1,20 @@ +import scala.tools.nsc.reporters._ +import scala.tools.nsc.Settings +import reflect.runtime.Mirror.ToolBox + +object Test extends App { + def foo[T](ys: List[T]): Int => Int = { + val fun: reflect.Code[Int => Int] = x => { + x + ys.length + } + + val reporter = new ConsoleReporter(new Settings) + val toolbox = new ToolBox(reporter) + val ttree = toolbox.typeCheck(fun.tree) + val dyn = toolbox.runExpr(ttree) + dyn.asInstanceOf[Int => Int] + } + + println(foo(List(1, 2, 3))(10)) + println(foo(List(1, 2, 3, 4))(10)) +} -- cgit v1.2.3