From 75d5eee8c7f4d83dd64bca989027925e5ff081b6 Mon Sep 17 00:00:00 2001 From: Dmitry Petrashko Date: Mon, 15 Jun 2015 18:19:06 +0200 Subject: Move tests that have " macro" or "reify" to disabled. --- .../run/macro-reify-chained1/Impls_Macros_1.scala | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 tests/disabled/macro/run/macro-reify-chained1/Impls_Macros_1.scala (limited to 'tests/disabled/macro/run/macro-reify-chained1/Impls_Macros_1.scala') diff --git a/tests/disabled/macro/run/macro-reify-chained1/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-reify-chained1/Impls_Macros_1.scala new file mode 100644 index 000000000..7f877b272 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-chained1/Impls_Macros_1.scala @@ -0,0 +1,47 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.macros.blackbox.Context +import scala.language.experimental.macros + +case class Utils[C <: Context]( c:C ) { + import c.universe._ + import c.{Tree=>_} + object removeDoubleReify extends c.universe.Transformer { + def apply( tree:Tree ) = transform(tree) + override def transform(tree: Tree): Tree = { + super.transform { + tree match { + case Apply(TypeApply(Select(_this, termname), _), reification::Nil ) + if termname.toString == "factory" => c.unreifyTree(reification) + case Apply(Select(_this, termname), reification::Nil ) + if termname.toString == "factory" => c.unreifyTree(reification) + case _ => tree + } + } + } + } +} +object QueryableMacros{ + def _helper[C <: Context,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = { + import c.universe._ + import internal._ + val element_type = implicitly[c.WeakTypeTag[S]].tpe + val foo = c.Expr[ru.Expr[Queryable[S]]]( + c.reifyTree( gen.mkRuntimeUniverseRef, EmptyTree, c.typecheck( + Utils[c.type](c).removeDoubleReify( + Apply(Select(c.prefix.tree, TermName( name )), List( projection.tree )) + ).asInstanceOf[Tree] + ))) + c.universe.reify{ Queryable.factory[S]( foo.splice )} + } + def map[T:c.WeakTypeTag, S:c.WeakTypeTag] + (c: Context) + (projection: c.Expr[T => S]): c.Expr[Queryable[S]] = _helper[c.type,S]( c )( "_map", projection ) +} +class Queryable[T]{ + def _map[S]( projection: T => S ) : Queryable[S] = ??? + def map[S]( projection: T => S ) : Queryable[S] = macro QueryableMacros.map[T,S] +} +object Queryable{ + def factory[S]( projection:ru.Expr[Queryable[S]] ) : Queryable[S] = null +} \ No newline at end of file -- cgit v1.2.3