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

Non-ASCII characters are not recognized by `print_explicit_imports`

Open JoshuaLampert opened this issue 1 year ago • 3 comments

Let's say we have the following module in a file Foo.jl:

module Foo
using LinearAlgebra
bar(a, b) = a ⋅ b
end

where is exported from LinearAlgebra.jl. Running print_explicit_imports(Foo, "Foo.jl") gives

julia> print_explicit_imports(Foo, "Foo.jl")
  Module Main.Foo is relying on implicit imports for 1 name. This could be explicitly imported as follows:

  using LinearAlgebra: LinearAlgebra

However, exchanging using LinearAlgebra by the suggested using LinearAlgebra: LinearAlgebra breaks the module of course since is not available anymore. I would expect ExplicitImports.jl to suggest using LinearAlgebra: LinearAlgebra, ⋅. I have tested that the same happens with ×. So I assume this happens for non-ASCII characters.

JoshuaLampert avatar Sep 25 '24 19:09 JoshuaLampert

my guess it's something to do with how we are using JuliaSyntax and operators, not about ASCII vs non-ascii (nothing in the codebase should depend on ASCIIness).

https://github.com/JuliaLang/JuliaSyntax.jl/pull/523 has potentially fixed or changed this somehow (have not checked)

ericphanson avatar Jun 02 '25 14:06 ericphanson

Thanks for the update. To test this ExplicitImports.jl would need to allow JuliaSyntax v1. However, CompatHelper seems to be broken for this repo, also after #107 has been merged, see https://github.com/ericphanson/ExplicitImports.jl/actions/runs/15406197834/job/43349295635.

JoshuaLampert avatar Jun 03 '25 08:06 JoshuaLampert

The same is happening on the branch eph/js_v1.

JoshuaLampert avatar Jun 13 '25 12:06 JoshuaLampert