Skip to content

Symbols defined in scripts included via Base.include(::Module, ::String) don't show up in names anymore #58286

@giordano

Description

@giordano

Julia v1.11:

julia> function main()
           m = Module(:MyModule)
           module_content = """
               f() = nothing
               """

           mktempdir() do dir
               filename = joinpath(dir, module_content)
               write(filename, module_content)
               Base.include(m, filename)
           end

           return names(m, all=true, imported=true)
       end
main (generic function with 1 method)

julia> main()
3-element Vector{Symbol}:
 Symbol("#f")
 :MyModule
 :f

Julia v1.12:

julia> function main()
           m = Module(:MyModule)
           module_content = """
               f() = nothing
               """

           mktempdir() do dir
               filename = joinpath(dir, module_content)
               write(filename, module_content)
               Base.include(m, filename)
           end

           return names(m, all=true, imported=true)
       end
main (generic function with 1 method)

julia> main()
1-element Vector{Symbol}:
 :MyModule

Notably, this breaks the script used for Julia in Compiler Explorer (the names call now only returns the module name). I'm happy to adapt the script if this isn't considered a bug, but I'd need instructions for how to adapt this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    modulesregression 1.12Regression in the 1.12 releasewon't changeIndicates that work won't continue on an issue or pull request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions