Skip to content

Commit 4132a2a

Browse files
committed
Fix corner case of double module import
Fixes a regression introduced in #57755 seen on PkgEval in #57755 (comment)
1 parent 8b14690 commit 4132a2a

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/toplevel.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ static void import_module(jl_task_t *ct, jl_module_t *JL_NONNULL m, jl_module_t
662662
if (!jl_bkind_is_some_implicit(kind) && kind != PARTITION_KIND_DECLARED) {
663663
// Unlike regular constant declaration, we allow this as long as we eventually end up at a constant.
664664
jl_walk_binding_inplace(&b, &bpart, ct->world_age);
665-
if (jl_binding_kind(bpart) == PARTITION_KIND_CONST || jl_binding_kind(bpart) == PARTITION_KIND_BACKDATED_CONST || jl_binding_kind(bpart) == PARTITION_KIND_CONST_IMPORT) {
665+
if (jl_bkind_is_some_constant(jl_binding_kind(bpart))) {
666666
// Already declared (e.g. on another thread) or imported.
667667
if (bpart->restriction == (jl_value_t*)import)
668668
return;

test/syntax.jl

+7
Original file line numberDiff line numberDiff line change
@@ -4239,3 +4239,10 @@ out = let
42394239
end
42404240
end
42414241
@test M57574.out === M57574.A
4242+
4243+
# Double import of CONST_IMPORT symbol
4244+
module DoubleImport
4245+
import Test: Random
4246+
import Random
4247+
end
4248+
@test DoubleImport.Random === Test.Random

0 commit comments

Comments
 (0)