diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-02-02 14:39:44 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-02-02 14:39:44 +0100 |
commit | d940371bd50098c4146e52941880ccdbcb4ea47a (patch) | |
tree | 2d4f7093fad48fcaf44ac491bf3a13e3cc2bcbe0 /src/partest | |
parent | 3aebe255b87f534239f0c46a2a6e0d696c8a31d4 (diff) | |
download | scala-d940371bd50098c4146e52941880ccdbcb4ea47a.tar.gz scala-d940371bd50098c4146e52941880ccdbcb4ea47a.tar.bz2 scala-d940371bd50098c4146e52941880ccdbcb4ea47a.zip |
Miscellaneous fixes to reification
More specifically:
* Importers now preserve wasEmpty and original
* ToolBoxes no longer auto-evaluate nullary functions returned by runExpr
* All local symbols from previous typechecks are now correctly erased by ResetAttrs
* Originals are now reified
Diffstat (limited to 'src/partest')
-rw-r--r-- | src/partest/scala/tools/partest/utils/CodeTest.scala | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/partest/scala/tools/partest/utils/CodeTest.scala b/src/partest/scala/tools/partest/utils/CodeTest.scala index c90168a313..c236d89bbd 100644 --- a/src/partest/scala/tools/partest/utils/CodeTest.scala +++ b/src/partest/scala/tools/partest/utils/CodeTest.scala @@ -24,11 +24,17 @@ object CodeTest { def apply[T](code: Code[T], args: Array[String] = Array()) = { println("testing: "+code.tree) + println("type is: "+code.manifest.tpe) + val isNullary = code.manifest.tpe.typeSymbol == scala.reflect.mirror.definitions.FunctionClass(0) val reporter = new ConsoleReporter(new Settings) val toolbox = new ToolBox(reporter, args mkString " ") val ttree = toolbox.typeCheck(code.tree, code.manifest.tpe) - println("result = " + toolbox.showAttributed(ttree)) - val evaluated = toolbox.runExpr(ttree) + println("result = " + toolbox.showAttributed(ttree, printTypes = true, printIds = false)) + var evaluated = toolbox.runExpr(ttree) + if (evaluated != null && isNullary) { + val applyMeth = evaluated.getClass.getMethod("apply") + evaluated = applyMeth.invoke(evaluated) + } println("evaluated = "+evaluated) evaluated } |