summaryrefslogtreecommitdiff
path: root/test/files/run/macro-undetparams-consfromsls
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2013-10-17 19:12:59 +0200
committerEugene Burmako <xeno.by@gmail.com>2013-10-18 16:58:51 +0200
commit3b4dc75710ac51de729224929690422d1b44e3ad (patch)
tree27337cd2a0a66e98650488a5cbff4e4dcb499745 /test/files/run/macro-undetparams-consfromsls
parent54707cb45018170e31eb188a9a694ab9b0728f71 (diff)
downloadscala-3b4dc75710ac51de729224929690422d1b44e3ad.tar.gz
scala-3b4dc75710ac51de729224929690422d1b44e3ad.tar.bz2
scala-3b4dc75710ac51de729224929690422d1b44e3ad.zip
deprecates raw tree manipulation facilities in macros.Context
Diffstat (limited to 'test/files/run/macro-undetparams-consfromsls')
-rw-r--r--test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala18
1 files changed, 12 insertions, 6 deletions
diff --git a/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala b/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala
index bcbd12817b..6695a297ea 100644
--- a/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala
+++ b/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala
@@ -2,14 +2,20 @@ import scala.reflect.runtime.universe._
import scala.reflect.macros.Context
object Macros {
- def cons_impl[A: c.WeakTypeTag](c: Context)(x: c.Expr[A], xs: c.Expr[List[A]]): c.Expr[List[A]] = c.universe.reify {
- println("A = " + c.literal(implicitly[c.WeakTypeTag[A]].toString).splice)
- x.splice :: xs.splice
+ def cons_impl[A: c.WeakTypeTag](c: Context)(x: c.Expr[A], xs: c.Expr[List[A]]): c.Expr[List[A]] = {
+ import c.universe._
+ reify {
+ println("A = " + c.Expr[String](Literal(Constant(implicitly[c.WeakTypeTag[A]].toString))).splice)
+ x.splice :: xs.splice
+ }
}
- def nil_impl[B: c.WeakTypeTag](c: Context): c.Expr[List[B]] = c.universe.reify {
- println("B = " + c.literal(implicitly[c.WeakTypeTag[B]].toString).splice)
- Nil
+ def nil_impl[B: c.WeakTypeTag](c: Context): c.Expr[List[B]] = {
+ import c.universe._
+ reify {
+ println("B = " + c.Expr[String](Literal(Constant(implicitly[c.WeakTypeTag[B]].toString))).splice)
+ Nil
+ }
}
def cons[A](x: A, xs: List[A]): List[A] = macro cons_impl[A]