diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2011-12-05 17:00:55 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2011-12-05 17:00:55 +0100 |
commit | 6e9ae187a05b1ca4fe748d8a7b45440a55ceb589 (patch) | |
tree | ecf9aadb4d8e122ebc4be30997bc3b52880b2521 /test/pending/run/t5277_1.scala | |
parent | a289465c70630719cbd3a74edf5502a156ef83c4 (diff) | |
download | scala-6e9ae187a05b1ca4fe748d8a7b45440a55ceb589.tar.gz scala-6e9ae187a05b1ca4fe748d8a7b45440a55ceb589.tar.bz2 scala-6e9ae187a05b1ca4fe748d8a7b45440a55ceb589.zip |
Another test pack for reflection
Also see https://github.com/scala/scala/pull/25.
Diffstat (limited to 'test/pending/run/t5277_1.scala')
-rw-r--r-- | test/pending/run/t5277_1.scala | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/pending/run/t5277_1.scala b/test/pending/run/t5277_1.scala new file mode 100644 index 0000000000..57acd699ff --- /dev/null +++ b/test/pending/run/t5277_1.scala @@ -0,0 +1,21 @@ +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{ + def fact(n: Int): BigInt = + if (n == 0) 1 else fact(n-1) * n + class Factorizer(n: Int) { + def ! = fact(n) + } + implicit def int2fact(n: Int) = new Factorizer(n) + + println("10! = " + (10!)) + }; + + val reporter = new ConsoleReporter(new Settings) + val toolbox = new ToolBox(reporter) + val ttree = toolbox.typeCheck(code.tree) + toolbox.runExpr(ttree) +} |