From eadf1d2080e0ce763e4c1920a26b80c8b8609ca0 Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Wed, 19 Sep 2012 13:15:22 +0200 Subject: prepping for the refactoring Reification (both tree-based and type-based) should be avoided before we release 2.10.0-final, since it impairs reflection refactorings like the upcoming one. Also the upcoming refactoring moves tag materialization anchors, and we have to add them to fast track in advance, so that they are treated as macros later. --- src/partest/scala/tools/partest/package.scala | 35 ++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 6 deletions(-) (limited to 'src/partest') diff --git a/src/partest/scala/tools/partest/package.scala b/src/partest/scala/tools/partest/package.scala index ebd3e46b7c..df1c296d47 100644 --- a/src/partest/scala/tools/partest/package.scala +++ b/src/partest/scala/tools/partest/package.scala @@ -93,11 +93,34 @@ package object partest { import scala.reflect.macros.Context def traceImpl[A: c.WeakTypeTag](c: Context)(a: c.Expr[A]): c.Expr[A] = { import c.universe._ - val exprCode = c.literal(show(a.tree)) - val exprType = c.literal(show(a.actualType)) - reify { - println(s"trace> ${exprCode.splice}\nres: ${exprType.splice} = ${a.splice}\n") - a.splice - } + import definitions._ + + // xeno.by: reify shouldn't be used explicitly before the final release of 2.10.0, + // because this impairs reflection refactorings + // + // val exprCode = c.literal(show(a.tree)) + // val exprType = c.literal(show(a.actualType)) + // reify { + // println(s"trace> ${exprCode.splice}\nres: ${exprType.splice} = ${a.splice}\n") + // a.splice + // } + + c.Expr(Block( + List(Apply( + Select(Ident(PredefModule), newTermName("println")), + List(Apply( + Select(Apply( + Select(Ident(ScalaPackage), newTermName("StringContext")), + List( + Literal(Constant("trace> ")), + Literal(Constant("\\nres: ")), + Literal(Constant(" = ")), + Literal(Constant("\\n")))), + newTermName("s")), + List( + Literal(Constant(show(a.tree))), + Literal(Constant(show(a.actualType))), + a.tree))))), + a.tree)) } } -- cgit v1.2.3