diff options
author | Martin Odersky <odersky@gmail.com> | 2011-09-25 17:09:04 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2011-09-25 17:09:04 +0000 |
commit | 274ce619902b1e92ec22fcff30b965fbbece2ad3 (patch) | |
tree | bec90e01d3dbbcd47dcabb487ba0cb43d7f1b81a /test/files/pos/code.scala | |
parent | 5d5826812ae66b748342d86c5185e9bf7612fe7f (diff) | |
download | scala-274ce619902b1e92ec22fcff30b965fbbece2ad3.tar.gz scala-274ce619902b1e92ec22fcff30b965fbbece2ad3.tar.bz2 scala-274ce619902b1e92ec22fcff30b965fbbece2ad3.zip |
Getting liftCode to work.
Diffstat (limited to 'test/files/pos/code.scala')
-rw-r--r-- | test/files/pos/code.scala | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/files/pos/code.scala b/test/files/pos/code.scala new file mode 100644 index 0000000000..4def5d2f94 --- /dev/null +++ b/test/files/pos/code.scala @@ -0,0 +1,20 @@ +import reflect.runtime.Mirror.ToolBox +import scala.tools.nsc.reporters._ +import scala.tools.nsc.Settings + +object Test extends App { + def foo[T](ys: List[T]) = { + val fun: reflect.Code[Int => Int] = x => x + ys.length + fun + } + val code = foo(List(2)) + val tree = code.tree.asInstanceOf[scala.reflect.runtime.Mirror.Tree] + val targetType = code.manifest.tpe.asInstanceOf[scala.reflect.runtime.Mirror.Type] + println("testing: "+tree) + val reporter = new ConsoleReporter(new Settings) + val toolbox = new ToolBox(reporter, args mkString " ") + val ttree = toolbox.typeCheck(tree, targetType) + println("result = "+ttree) +} + + |