Skip to content

Renamed submodules does not play well with precompilation #39405

@fredrikekre

Description

@fredrikekre

This package code:

module ForgetImports

    import Pkg.PlatformEngines as pe
    import Pkg as p

    function test()
        println("Pkg = ", p)
    end

    function test2()
        println("PlatformEngines = ", pe)
    end

end # module

results in the following error if the module is precompiled

$ julia -q
julia> using ForgetImports

julia> ForgetImports.test()
Pkg = Pkg

julia> ForgetImports.test2()
ERROR: UndefVarError: pe not defined
Stacktrace:
 [1] test2()
   @ ForgetImports /tmp/tmp.wXr6KYv8f2/ForgetImports/src/ForgetImports.jl:11
 [2] top-level scope
   @ REPL[3]:1

Works fine without precompilation:

$ julia --compiled-modules=no -q                           
julia> using ForgetImports

julia> ForgetImports.test()
Pkg = Pkg

julia> ForgetImports.test2()
PlatformEngines = Pkg.PlatformEngines

(Tentatively putting on 1.6 milestone since the rename feature is new for 1.6).

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or unintended behaviormodules

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions