Skip to content

Commit 8a032f7

Browse files
PangorawKristofferC
authored and
KristofferC
committed
use name in source module when importing an aliased binding (#43291)
Co-authored-by: Simeon David Schaub <schaub@mit.edu> (cherry picked from commit 2338f5d)
1 parent 0a4a99d commit 8a032f7

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/module.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ static void module_import_(jl_module_t *to, jl_module_t *from, jl_sym_t *s, jl_s
528528
}
529529
}
530530
else {
531-
jl_binding_t *nb = new_binding(s);
531+
jl_binding_t *nb = new_binding(b->name);
532532
nb->owner = b->owner;
533533
nb->imported = (explici!=0);
534534
nb->deprecated = b->deprecated;

test/syntax.jl

+6
Original file line numberDiff line numberDiff line change
@@ -2514,6 +2514,7 @@ end
25142514
end
25152515

25162516
module Mod2
2517+
import ..Mod.x as x_from_mod
25172518
const y = 2
25182519
end
25192520

@@ -2554,6 +2555,11 @@ import .Mod.@mac as @m
25542555
@test_throws ErrorException eval(:(import .Mod.func as @notmacro))
25552556
@test_throws ErrorException eval(:(using .Mod: @mac as notmacro))
25562557
@test_throws ErrorException eval(:(using .Mod: func as @notmacro))
2558+
2559+
import .Mod2.x_from_mod
2560+
2561+
@test @isdefined(x_from_mod)
2562+
@test x_from_mod == Mod.x
25572563
end
25582564

25592565
import .TestImportAs.Mod2 as M2

0 commit comments

Comments
 (0)