Skip to content

Commit

Permalink
Do not let public unexport names (#52814)
Browse files Browse the repository at this point in the history
  • Loading branch information
LilithHafner authored Jan 8, 2024
1 parent b354ce7 commit 486f434
Show file tree
Hide file tree
Showing 2 changed files with 13 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 @@ -667,7 +667,7 @@ JL_DLLEXPORT void jl_module_public(jl_module_t *from, jl_sym_t *s, int exported)
{
jl_binding_t *b = jl_get_module_binding(from, s, 1);
b->publicp = 1;
b->exportp = exported;
b->exportp |= exported;
}

JL_DLLEXPORT int jl_boundp(jl_module_t *m, jl_sym_t *var)
Expand Down
12 changes: 12 additions & 0 deletions test/reflection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1180,3 +1180,15 @@ let (src, rt) = only(code_typed(sub2ind_gen, (NTuple,Int,Int,); optimize=false))
@test any(iscall((src,sub2ind_gen_fallback)), src.code)
@test any(iscall((src,error)), src.code)
end

# marking a symbol as public should not "unexport" it
# https://github.com/JuliaLang/julia/issues/52812
module Mod52812
export a, b
public a
end

@test Base.isexported(Mod52812, :a)
@test Base.isexported(Mod52812, :b)
@test Base.ispublic(Mod52812, :a)
@test Base.ispublic(Mod52812, :b)

0 comments on commit 486f434

Please sign in to comment.