Skip to content

Callsite @inline doesn't like val argument #48910

@maleadt

Description

@maleadt

MWE:

macro foo()
    quote
        function bar(val)
            @inline identity(nothing)
        end
    end
end
@foo
ERROR: LoadError: syntax: local variable name "#9#val" conflicts with an argument

Using any other variable name than val makes this work. Probably suspect:

julia/base/expr.jl

Lines 846 to 859 in 7eb9615

function annotate_meta_def_or_block(@nospecialize(ex), meta::Symbol)
inner = unwrap_macrocalls(ex)
if is_function_def(inner)
# annotation on a definition
return esc(pushmeta!(ex, meta))
else
# annotation on a block
return Expr(:block,
Expr(meta, true),
Expr(:local, Expr(:(=), :val, esc(ex))),
Expr(meta, false),
:val)
end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviormacros@macros

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions