aboutsummaryrefslogtreecommitdiff
path: root/tests/disabled/macro/run/macro-expand-nullary-generic
diff options
context:
space:
mode:
Diffstat (limited to 'tests/disabled/macro/run/macro-expand-nullary-generic')
-rw-r--r--tests/disabled/macro/run/macro-expand-nullary-generic/Impls_1.scala15
-rw-r--r--tests/disabled/macro/run/macro-expand-nullary-generic/Macros_Test_2.scala15
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/disabled/macro/run/macro-expand-nullary-generic/Impls_1.scala b/tests/disabled/macro/run/macro-expand-nullary-generic/Impls_1.scala
new file mode 100644
index 000000000..9362d6c17
--- /dev/null
+++ b/tests/disabled/macro/run/macro-expand-nullary-generic/Impls_1.scala
@@ -0,0 +1,15 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def impl[T: c.WeakTypeTag](c: Context)(meth: String) = {
+ import c.universe._
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(s"$meth[${c.weakTypeOf[T]}]"))))
+ c.Expr[Unit](body)
+ }
+
+ def fooNullary[T: c.WeakTypeTag](c: Context) = impl[T](c)("fooNullary")
+ def fooEmpty[T: c.WeakTypeTag](c: Context)() = impl[T](c)("fooEmpty")
+ def barNullary[T: c.WeakTypeTag](c: Context)(x: c.Expr[Int]) = impl[T](c)("barNullary")
+ def barEmpty[T: c.WeakTypeTag](c: Context)(x: c.Expr[Int])() = impl[T](c)("barEmpty")
+} \ No newline at end of file
diff --git a/tests/disabled/macro/run/macro-expand-nullary-generic/Macros_Test_2.scala b/tests/disabled/macro/run/macro-expand-nullary-generic/Macros_Test_2.scala
new file mode 100644
index 000000000..da418c63c
--- /dev/null
+++ b/tests/disabled/macro/run/macro-expand-nullary-generic/Macros_Test_2.scala
@@ -0,0 +1,15 @@
+object Macros {
+ def foo1[T]: Unit = macro Impls.fooNullary[T]
+ def foo2[T](): Unit = macro Impls.fooEmpty[T]
+ def bar1[T](x: Int): Unit = macro Impls.barNullary[T]
+ def bar2[T](x: Int)(): Unit = macro Impls.barEmpty[T]
+}
+
+object Test extends dotty.runtime.LegacyApp {
+ Macros.foo1[Int]
+ Macros.foo2[Int]
+ Macros.foo2[Int]()
+ Macros.bar1[Int](42)
+ Macros.bar2[Int](42)()
+ println("kkthxbai")
+} \ No newline at end of file