Skip to content

Name shadowing of an import when assigning it to a function argument causes spurious unused import diagnostics #120

@KristofferC

Description

@KristofferC

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions