-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Open
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorcompiler:loweringSyntax lowering (compiler front end, 2nd stage)Syntax lowering (compiler front end, 2nd stage)macros@macros@macros
Description
We unintentionally leak x
as a global here:
julia> macro _macroexpand(x, m=__module__)
:($__source__; macroexpand($m, Expr(:var"hygienic-scope", $(esc(Expr(:quote, x))), $m)))
end
@_macroexpand (macro with 2 methods)
julia> @_macroexpand f((x,)) = x
:(Main.f((Main.x,)) = begin
#= REPL[4]:1 =#
Main.x
end)
Not only does this have potentially bad side effects, but it also worsens performance due to converting x
to a global. Property destructuring has the same issue, but currently errors loudly until #48726 is addressed.
Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorcompiler:loweringSyntax lowering (compiler front end, 2nd stage)Syntax lowering (compiler front end, 2nd stage)macros@macros@macros