File tree 1 file changed +5
-1
lines changed
compiler/src/dotty/tools/dotc/transform
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,8 @@ class MacroAnnotations(phase: IdentityDenotTransformer):
28
28
import tpd .*
29
29
import MacroAnnotations .*
30
30
31
+ private val willBeEntered = new collection.mutable.HashSet [Symbol ]
32
+
31
33
/** Expands every macro annotation that is on this tree.
32
34
* Returns a list with transformed definition and any added definitions.
33
35
*/
@@ -144,7 +146,9 @@ class MacroAnnotations(phase: IdentityDenotTransformer):
144
146
for tree <- template.body do
145
147
if tree.symbol.owner != tdef.symbol then
146
148
report.error(em " Macro added a definition with the wrong owner - ${tree.symbol.owner} - ${tdef.symbol} in ${tree.source}" )
147
- else if ! isSymbolInDecls(tree.symbol) then
149
+ else if ! willBeEntered(tree.symbol) && ! isSymbolInDecls(tree.symbol) then
150
+ // Add a cache to avoid entering the same symbol twice in case of multiple macro annotatitions
151
+ willBeEntered.add(tree.symbol)
148
152
tree.symbol.enteredAfter(phase)
149
153
traverseChildren(tree) // Taverse before or after dealing with this class?
150
154
case _ => traverseChildren(tree)
You can’t perform that action at this time.
0 commit comments