aboutsummaryrefslogtreecommitdiff
path: root/tests/disabled/macro/run/macro-reify-freevars
diff options
context:
space:
mode:
Diffstat (limited to 'tests/disabled/macro/run/macro-reify-freevars')
-rw-r--r--tests/disabled/macro/run/macro-reify-freevars/Macros_1.scala20
-rw-r--r--tests/disabled/macro/run/macro-reify-freevars/Test_2.scala11
2 files changed, 31 insertions, 0 deletions
diff --git a/tests/disabled/macro/run/macro-reify-freevars/Macros_1.scala b/tests/disabled/macro/run/macro-reify-freevars/Macros_1.scala
new file mode 100644
index 000000000..912f602c6
--- /dev/null
+++ b/tests/disabled/macro/run/macro-reify-freevars/Macros_1.scala
@@ -0,0 +1,20 @@
+package scala.collection.slick
+
+object QueryableMacros{
+ def map[T:c.WeakTypeTag, S:c.WeakTypeTag]
+ (c: scala.reflect.macros.blackbox.Context)
+ (projection: c.Expr[T => S])
+ : c.Expr[scala.collection.slick.Queryable[S]] = {
+ import c.universe._
+ val code = EmptyTree
+ c.universe.reify{
+ Queryable.factory[S]( code.asInstanceOf[reflect.runtime.universe.Tree] )
+ }
+ }
+}
+class Queryable[T]{
+ def map[S]( projection: T => S ) : Queryable[S] = macro QueryableMacros.map[T,S]
+}
+object Queryable{
+ def factory[S]( projection:reflect.runtime.universe.Tree ) : Queryable[S] = null
+} \ No newline at end of file
diff --git a/tests/disabled/macro/run/macro-reify-freevars/Test_2.scala b/tests/disabled/macro/run/macro-reify-freevars/Test_2.scala
new file mode 100644
index 000000000..11c8128cd
--- /dev/null
+++ b/tests/disabled/macro/run/macro-reify-freevars/Test_2.scala
@@ -0,0 +1,11 @@
+object Test extends dotty.runtime.LegacyApp {
+ import scala.reflect.runtime.universe._
+ import scala.reflect.runtime.{currentMirror => cm}
+ import scala.tools.reflect.ToolBox
+ val q = New(AppliedTypeTree(Select(Select(Select(Ident(TermName("scala")), TermName("collection")), TermName("slick")), TypeName("Queryable")), List(Ident(TermName("Int")))))
+ val x = ValDef(NoMods, TermName("x"), Ident(TermName("Int")), EmptyTree)
+ val fn = Function(List(x), Apply(Select(Ident(TermName("x")), TermName("$plus")), List(Literal(Constant("5")))))
+ val tree = Apply(Select(q, TermName("map")), List(fn))
+ try cm.mkToolBox().eval(tree)
+ catch { case ex: Throwable => println(ex.getMessage) }
+} \ No newline at end of file