diff options
author | Martin Odersky <odersky@gmail.com> | 2012-04-12 18:55:13 -0700 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2012-04-12 18:55:13 -0700 |
commit | 6061a22fcd3480e18e60254ad06c8a46b2f1ce53 (patch) | |
tree | 12e7d3a1798a186d641e3de21430fc6de0470727 /test/files/run/reify_closure7.scala | |
parent | f7a0558059559305a88ffa2c28506b29b2bc57f2 (diff) | |
parent | 39a88f5680c3a16bf7ca856683989a2f5481bf69 (diff) | |
download | scala-6061a22fcd3480e18e60254ad06c8a46b2f1ce53.tar.gz scala-6061a22fcd3480e18e60254ad06c8a46b2f1ce53.tar.bz2 scala-6061a22fcd3480e18e60254ad06c8a46b2f1ce53.zip |
Merge branch 'master' into topic/sip18
Conflicts:
src/compiler/scala/reflect/internal/Definitions.scala
Various improvements to SIP 18 reporting. Made scala library and compiler feature-clean.
Diffstat (limited to 'test/files/run/reify_closure7.scala')
-rw-r--r-- | test/files/run/reify_closure7.scala | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/test/files/run/reify_closure7.scala b/test/files/run/reify_closure7.scala index 46002d8d6c..b9f87dbdeb 100644 --- a/test/files/run/reify_closure7.scala +++ b/test/files/run/reify_closure7.scala @@ -1,14 +1,12 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { var q = 0 var clo: Int => Int = null - def foo[T](ys: List[T]): Int => Int = { + def foo[T: TypeTag](ys: List[T]): Int => Int = { val z = 1 var y = 0 - val fun = reflect.Code.lift{(x: Int) => { + val fun = reify{(x: Int) => { y += 1 q += 1 println("q = " + q) @@ -17,8 +15,7 @@ object Test extends App { }} if (clo == null) { - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) + val toolbox = mkToolBox() val dyn = toolbox.runExpr(fun.tree) clo = dyn.asInstanceOf[Int => Int] } @@ -26,6 +23,8 @@ object Test extends App { clo } - println("first invocation = " + foo(List(1, 2, 3))(10)) - println("second invocation = " + foo(List(1, 2, 3, 4))(10)) + val fun1 = foo(List(1, 2, 3)) + println("first invocation = " + fun1(10)) + val fun2 = foo(List(1, 2, 3, 4)) + println("second invocation = " + fun2(10)) } |