diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-11-16 14:13:33 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-11-18 21:13:43 +0100 |
commit | 907d6ea06ee2e2116dc24838b73990dca3d4c651 (patch) | |
tree | 164959bc1c2fc2067526d699c183c39a961015bc /src/reflect | |
parent | 1a6c8597109a9eee122d01c142d8955a14f704c8 (diff) | |
download | scala-907d6ea06ee2e2116dc24838b73990dca3d4c651.tar.gz scala-907d6ea06ee2e2116dc24838b73990dca3d4c651.tar.bz2 scala-907d6ea06ee2e2116dc24838b73990dca3d4c651.zip |
SI-6673 fixes macro problems with eta expansions
Eta expansions previously caused the typer to disable macros. That was
done in order to detect eta expansion of macro defs and show the user
an appropriate error message.
Macros were disabled because to find out whether we're expanding
a macro def, we need to get its symbol, and to get a symbol of something
we need to typecheck that something. However typechecking automatically
expands macros, so, unless we disable macros, after a typecheck we won't
be able to analyze macro occurrences anymore.
Unfortunately this solution has a fatal flaw. By disabling macros we
not only prevent the eta-expandee from macro expanding, but also all
the subtrees of that eta-expandee (see SI-6673).
This commit adds a mechanism for fine-grained control over macro
expansion. Now it's possible to prohibit only the node, but not its
children from macro expanding.
Diffstat (limited to 'src/reflect')
-rw-r--r-- | src/reflect/scala/reflect/internal/StdAttachments.scala | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/reflect/scala/reflect/internal/StdAttachments.scala b/src/reflect/scala/reflect/internal/StdAttachments.scala index 9fe443bf50..c1ed33ee77 100644 --- a/src/reflect/scala/reflect/internal/StdAttachments.scala +++ b/src/reflect/scala/reflect/internal/StdAttachments.scala @@ -24,4 +24,6 @@ trait StdAttachments { case class CompoundTypeTreeOriginalAttachment(parents: List[Tree], stats: List[Tree]) case class MacroExpansionAttachment(original: Tree) + + case object SuppressMacroExpansionAttachment } |