aboutsummaryrefslogtreecommitdiff
path: root/tests/disabled/macro/run/macro-reify-unreify
diff options
context:
space:
mode:
Diffstat (limited to 'tests/disabled/macro/run/macro-reify-unreify')
-rw-r--r--tests/disabled/macro/run/macro-reify-unreify/Macros_1.scala20
-rw-r--r--tests/disabled/macro/run/macro-reify-unreify/Test_2.scala3
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/disabled/macro/run/macro-reify-unreify/Macros_1.scala b/tests/disabled/macro/run/macro-reify-unreify/Macros_1.scala
new file mode 100644
index 000000000..d92dfa3e2
--- /dev/null
+++ b/tests/disabled/macro/run/macro-reify-unreify/Macros_1.scala
@@ -0,0 +1,20 @@
+import scala.reflect.macros.blackbox.Context
+
+object Macros {
+ def foo(s: String) = macro Impls.foo
+
+ object Impls {
+ def foo(c: Context)(s: c.Expr[String]) = {
+ import c.universe._
+ import internal._
+
+ val world = c.reifyTree(gen.mkRuntimeUniverseRef, EmptyTree, s.tree)
+ val greeting = c.reifyTree(gen.mkRuntimeUniverseRef, EmptyTree, c.typecheck(Apply(Select(Literal(Constant("hello ")), TermName("$plus")), List(c.unreifyTree(world)))))
+ val typedGreeting = c.Expr[String](greeting)
+
+ c.universe.reify {
+ println("hello " + s.splice + " = " + typedGreeting.splice)
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/disabled/macro/run/macro-reify-unreify/Test_2.scala b/tests/disabled/macro/run/macro-reify-unreify/Test_2.scala
new file mode 100644
index 000000000..26b2c7d9f
--- /dev/null
+++ b/tests/disabled/macro/run/macro-reify-unreify/Test_2.scala
@@ -0,0 +1,3 @@
+object Test extends dotty.runtime.LegacyApp {
+ Macros.foo("world")
+} \ No newline at end of file