JuliaLang / julia

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

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

Open Keno opened 1 week ago

Keno commented 1 week 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 1 week ago

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