summaryrefslogtreecommitdiff
path: root/test/files/pos/macro-bundle-disambiguate-bundle.scala
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2014-02-13 02:34:14 +0100
committerEugene Burmako <xeno.by@gmail.com>2014-02-13 04:06:06 +0100
commitc85435d91e26b97e22470af74138b4e8d4c3ae41 (patch)
tree9f2d9e7b2dda559db2faadf4deb20aa07f2c858f /test/files/pos/macro-bundle-disambiguate-bundle.scala
parent00067482917cbe7ac337550e1f565fea966c2d78 (diff)
downloadscala-c85435d91e26b97e22470af74138b4e8d4c3ae41.tar.gz
scala-c85435d91e26b97e22470af74138b4e8d4c3ae41.tar.bz2
scala-c85435d91e26b97e22470af74138b4e8d4c3ae41.zip
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.
Diffstat (limited to 'test/files/pos/macro-bundle-disambiguate-bundle.scala')
-rw-r--r--test/files/pos/macro-bundle-disambiguate-bundle.scala14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/files/pos/macro-bundle-disambiguate-bundle.scala b/test/files/pos/macro-bundle-disambiguate-bundle.scala
new file mode 100644
index 0000000000..04809317e1
--- /dev/null
+++ b/test/files/pos/macro-bundle-disambiguate-bundle.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)(x: c.Tree) = ???
+}
+
+object Test extends App {
+ def foo: Unit = macro Macros.impl
+} \ No newline at end of file