Infiltrator.jl icon indicating copy to clipboard operation
Infiltrator.jl copied to clipboard

Cannot access names imported as `using Foo: bar as baz`

Open lassepe opened this issue 2 years ago • 2 comments

Julia supports the syntax using Foo: bar as baz. When importing names in this way, however, they are not accessible from within the infiltrator REPL.

MWE:

using Infiltrator

module Foo

function bar()
    println("asdf")
end

end

using .Foo: bar as baz

function main()
    Infiltrator.@infiltrate
end

Output:

julia> main()
Infiltrating (on thread 1) main()
  at REPL[12]:2

infil> baz
ERROR: UndefVarError: `baz` not defined

lassepe avatar Dec 20 '23 08:12 lassepe

This is https://github.com/JuliaLang/julia/issues/36529.

I'm handling the using .Foo: bar case myself here by also checking the Foo binding, but that's not possible for bar as baz.

pfitzseb avatar Feb 12 '24 15:02 pfitzseb

On the latest master you can use names(...; usings=true) to fix this issue.

aviatesk avatar May 31 '24 06:05 aviatesk