Skip to content

Commit

Permalink
use name in source module when importing an aliased binding (#43291)
Browse files Browse the repository at this point in the history

Co-authored-by: Simeon David Schaub <[email protected]>
  • Loading branch information
Pangoraw and simeonschaub committed Feb 28, 2022
1 parent 822aea5 commit 2338f5d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ static void module_import_(jl_module_t *to, jl_module_t *from, jl_sym_t *s, jl_s
}
}
else {
jl_binding_t *nb = new_binding(s);
jl_binding_t *nb = new_binding(b->name);
nb->owner = b->owner;
nb->imported = (explici!=0);
nb->deprecated = b->deprecated;
Expand Down
6 changes: 6 additions & 0 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2514,6 +2514,7 @@ end
end

module Mod2
import ..Mod.x as x_from_mod
const y = 2
end

Expand Down Expand Up @@ -2554,6 +2555,11 @@ import .Mod.@mac as @m
@test_throws ErrorException eval(:(import .Mod.func as @notmacro))
@test_throws ErrorException eval(:(using .Mod: @mac as notmacro))
@test_throws ErrorException eval(:(using .Mod: func as @notmacro))

import .Mod2.x_from_mod

@test @isdefined(x_from_mod)
@test x_from_mod == Mod.x
end

import .TestImportAs.Mod2 as M2
Expand Down

2 comments on commit 2338f5d

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your package evaluation job has completed - possible new issues were detected. A full report can be found here.

Please sign in to comment.