Skip to content

macro hygiene escaping breaks let f(x)=... #20241

@stevengj

Description

@stevengj
julia> macro foo()
       f = esc(:f); :(let $f(x) = x; $f(3); end)
       end
@foo (macro with 1 method)

julia> @foo
ERROR: syntax: invalid function name "(escape f)"

julia> macroexpand(:(@foo))
:($(Expr(:error, "invalid function name \"(escape f)\"")))

It looks like macroexpand.scm is forgetting to unescape somewhere. @JeffBezanson, any ideas?

(I'm running into this when trying to fix a bug I found in #20164.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorcompiler:loweringSyntax lowering (compiler front end, 2nd stage)macros@macros

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions