ExplicitImports.jl
ExplicitImports.jl copied to clipboard
Name shadowing of an import when assigning it to a function argument causes spurious unused import diagnostics
The following module causes a warning about an unused import but it is in fact used.
module M
using Base: wrap_string
function f(wrap_string = wrap_string("foo", UInt32(1)))
print(wrap_string)
end
end
ExplicitImports.jl says:
However, module Main.M has stale explicit imports for this 1 unused name:
• wrap_string is unused but it was imported from Base at M.jl:3:13
which is not true.
Happened for https://github.com/JuliaLang/Pkg.jl/blob/ffdb668b81658f1c46041fc921fa03d2fdb9527a/src/Registry/Registry.jl#L51 in the wild.
This is my bad ad-hoc implementation of lowering/scoping; hoping switching to JuliaLowering for scope resolution can fix this. (Or maybe we can improve the existing implementation)
this is the same as #129 in retrospect; I didn't realize it was a regression until that issue
oops, it's a different issue, nvm