Skip to content

macro definition can cause modules to become undefined in certain situations #57638

@KristofferC

Description

@KristofferC

Reduced from https://s3.amazonaws.com/julialang-reports/nanosoldier/pkgeval/by_hash/c78016e_vs_d63aded/DataToolkitCommon.primary.log

module M
module I
    using ..M # comment out -> works
    macro m()
        :(a = Base.x) # remove `Base` -> works
    end
end

using .I # comment out -> works
function f()
    I.@m()
end

Base

end

now causes

ERROR: UndefVarError: `Base` not defined in `Main.M`
Hint: It looks like two or more modules export different bindings with this name, resulting in ambiguity. Try explicitly importing it from a particular module, or qualifying the name with the module it should come from.
Hint: a global variable of this name also exists in Base.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions