Skip to content

Commit 5ae693e

Browse files
KenoKristofferC
authored andcommitted
Fix corner case of double module import (#57892)
Fixes a regression introduced in #57755 seen on PkgEval in #57755 (comment) (cherry picked from commit 1d2e165)
1 parent 85f6749 commit 5ae693e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/toplevel.c

Lines changed: 1 addition & 1 deletion
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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4250,3 +4250,10 @@ out = let
42504250
end
42514251
end
42524252
@test M57574.out === M57574.A
4253+
4254+
# Double import of CONST_IMPORT symbol
4255+
module DoubleImport
4256+
import Test: Random
4257+
import Random
4258+
end
4259+
@test DoubleImport.Random === Test.Random

0 commit comments

Comments
 (0)