From c85435d91e26b97e22470af74138b4e8d4c3ae41 Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Thu, 13 Feb 2014 02:34:14 +0100 Subject: SI-8270 unconfuses bundles and vanilla macros This fixes a mistake in macro impl ref typechecking that used to have an heuristic to figure out whether it looks at a bundle method ref or at a vanilla object method ref. Under some circumstances the heuristic could fail, and then the macro engine would reject perfectly good macro impls. Now every macro impl ref is typechecked twice - once as a bundle method ref and once as a vanilla object method ref. Results are then analyzed, checked against ambiguities (which are now correctly reported instead of incorrectly prioritizing towards bundles) and delivered to the macro engine. The only heuristic left in place is the one that's used to report errors. If both bundle and vanilla typechecks fail, then if a bundle candidate looks sufficiently similar to a bundle, a bundle typecheck error is reported providing some common bundle definition hints. --- test/files/neg/macro-bundle-ambiguous.scala | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 test/files/neg/macro-bundle-ambiguous.scala (limited to 'test/files/neg/macro-bundle-ambiguous.scala') diff --git a/test/files/neg/macro-bundle-ambiguous.scala b/test/files/neg/macro-bundle-ambiguous.scala new file mode 100644 index 0000000000..92c359d9a9 --- /dev/null +++ b/test/files/neg/macro-bundle-ambiguous.scala @@ -0,0 +1,14 @@ +import scala.reflect.macros.whitebox._ +import scala.language.experimental.macros + +class Macros(val c: Context) { + def impl = ??? +} + +object Macros { + def impl(c: Context) = ??? +} + +object Test extends App { + def foo: Unit = macro Macros.impl +} \ No newline at end of file -- cgit v1.2.3