diff options
Diffstat (limited to 'test/files/run/macro-bodyexpandstoimpl')
-rw-r--r-- | test/files/run/macro-bodyexpandstoimpl/Impls_1.scala | 14 | ||||
-rw-r--r-- | test/files/run/macro-bodyexpandstoimpl/Macros_Test_2.scala | 4 |
2 files changed, 11 insertions, 7 deletions
diff --git a/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala b/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala index 0ca0be5a48..d46af4952d 100644 --- a/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala +++ b/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala @@ -1,12 +1,16 @@ -import scala.reflect.macros.{Context => Ctx} +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.{Context => BlackboxContext} +import scala.reflect.macros.whitebox.{Context => WhiteboxContext} object Impls { - def foo(c: Ctx)(x: c.Expr[Int]) = x + def foo(c: BlackboxContext)(x: c.Expr[Int]) = x - def refToFoo(dummy: Int) = macro refToFoo_impl - def refToFoo_impl(c: Ctx)(dummy: c.Expr[Int]) = { + def refToFoo(dummy: Int): Int = macro refToFoo_impl + def refToFoo_impl(c: WhiteboxContext)(dummy: c.Expr[Int]) = { import c.universe._ - val body = Select(Ident(newTermName("Impls")), newTermName("foo")) + val body = Select(Ident(TermName("Impls")), TermName("foo")) + val global = c.universe.asInstanceOf[scala.tools.nsc.Global] + global.analyzer.markMacroImplRef(body.asInstanceOf[global.Tree]) c.Expr[Int](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-bodyexpandstoimpl/Macros_Test_2.scala b/test/files/run/macro-bodyexpandstoimpl/Macros_Test_2.scala index b589d4be03..486e1de090 100644 --- a/test/files/run/macro-bodyexpandstoimpl/Macros_Test_2.scala +++ b/test/files/run/macro-bodyexpandstoimpl/Macros_Test_2.scala @@ -1,7 +1,7 @@ -import scala.reflect.macros.{Context => Ctx} +import scala.language.experimental.macros object Macros { - def foo(x: Int) = macro Impls.refToFoo(42) + def foo(x: Int): Int = macro Impls.refToFoo(42) } object Test extends App { |