From 932626471f90c038511647400518d8c32607315b Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Sun, 23 Mar 2014 16:43:35 +0100 Subject: SI-8437 macro runtime now also picks inherited macro implementations Previously it didn't matter much that we used Class.getDeclaredMethods instead of just getMethods, but with the introduction of macro bundles it can make a difference which is fixed in this commit. I'd also like to note that the fact that getMethods only returns public methods and getDeclaredMethods also sees private methods, doesn't make a difference, because macro implementations must be public. --- test/files/run/t8437.check | 2 ++ test/files/run/t8437/Macros_1.scala | 18 ++++++++++++++++++ test/files/run/t8437/Test_2.scala | 4 ++++ 3 files changed, 24 insertions(+) create mode 100644 test/files/run/t8437.check create mode 100644 test/files/run/t8437/Macros_1.scala create mode 100644 test/files/run/t8437/Test_2.scala (limited to 'test/files/run') diff --git a/test/files/run/t8437.check b/test/files/run/t8437.check new file mode 100644 index 0000000000..fd3c81a4d7 --- /dev/null +++ b/test/files/run/t8437.check @@ -0,0 +1,2 @@ +5 +5 diff --git a/test/files/run/t8437/Macros_1.scala b/test/files/run/t8437/Macros_1.scala new file mode 100644 index 0000000000..6286ea2a8c --- /dev/null +++ b/test/files/run/t8437/Macros_1.scala @@ -0,0 +1,18 @@ +import scala.language.experimental.macros +import scala.reflect.macros._ + +abstract class AbstractBundle(val c: blackbox.Context) { + import c.Expr + import c.universe._ + def foo: Expr[Int] = Expr[Int](q"5") +} + +class ConcreteBundle(override val c: blackbox.Context) extends AbstractBundle(c) { + import c.Expr + val bar: Expr[Int] = foo +} + +object InvokeBundle { + def foo: Int = macro ConcreteBundle.foo // nope + def bar: Int = macro ConcreteBundle.bar // yep +} \ No newline at end of file diff --git a/test/files/run/t8437/Test_2.scala b/test/files/run/t8437/Test_2.scala new file mode 100644 index 0000000000..47bb84ad0e --- /dev/null +++ b/test/files/run/t8437/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + println(InvokeBundle.foo) + println(InvokeBundle.bar) +} \ No newline at end of file -- cgit v1.2.3