Skip to content

wrong import lookup with dependent names after #57965 #58272

@benlorenz

Description

@benlorenz

Consider the following example:

julia> module ModA
       
         const x = 1
       
         module ModB
           const y = 3
           const x = 2
         end
       
       end;

julia> import Main.ModA: ModB.y, x

julia> x
2

julia> x === Main.ModA.ModB.x
true

julia> x === Main.ModA.x
false

Importing ModB.y first changes some state and causes x to be imported from ModB instead of ModA directly.
Switching to Main.ModA: x, ModB.y fixes the import.

This even happens when ModB.x doesn't exist:

julia> module ModA
       
         const x = 1
       
         module ModB
           const y = 3
           
         end
       
       end;

julia> import Main.ModA: ModB.y, x
WARNING: Imported binding ModB.x was undeclared at import time during import to Main.

This does not happen on 1.11 or 1.12 and has appeared with #57965 (@xal-0).

It does not happen on the previous commit 0b40de7:

julia> module ModA
       
         const x = 1
       
         module ModB
           const y = 3
           const x = 2
         end
       
       end;

julia> import Main.ModA: ModB.y, x

julia> x
1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions