JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.93k stars 5.49k forks source link

macro hygiene: Module name does not like being renamed #55677

Open Keno opened 3 months ago

Keno commented 3 months ago
julia> macro foo()
       Expr(:toplevel, :(baremodule $(gensym()); end))
       end
@foo (macro with 2 methods)

julia> @foo()
ERROR: TypeError: in module, expected Symbol, got a value of type GlobalRef
Stacktrace:
 [1] top-level scope
   @ REPL[7]:1
Keno commented 3 months ago

While we're at it, using .$(GlobalRef(Foo, :Bar)) should probably also work.