Skip to content

Commit

Permalink
isdeprecated does not resolve binding
Browse files Browse the repository at this point in the history
  • Loading branch information
pfitzseb committed Nov 8, 2018
1 parent 5922b5e commit 0a4ea24
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,11 @@ JL_DLLEXPORT void jl_deprecate_binding(jl_module_t *m, jl_sym_t *var, int flag)

JL_DLLEXPORT int jl_is_binding_deprecated(jl_module_t *m, jl_sym_t *var)
{
jl_binding_t *b = jl_get_binding(m, var);
return b && b->deprecated;
if (jl_binding_resolved_p(m, var)) {
jl_binding_t *b = jl_get_binding(m, var);
return b && b->deprecated;
}
return 0;
}

extern const char *jl_filename;
Expand Down
4 changes: 4 additions & 0 deletions test/reflection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -809,3 +809,7 @@ f20872(::Val, ::Val) = false
@test which(f20872, Tuple{Val,Val}).sig == Tuple{typeof(f20872), Val, Val}
@test which(f20872, Tuple{Val,Val{N}} where N).sig == Tuple{typeof(f20872), Val, Val}
@test_throws ErrorException which(f20872, Tuple{Any,Val{N}} where N)

module M29962 end
# make sure checking if a binding is deprecated does not resolve it
@test !Base.isdeprecated(M29962, :sin) && !Base.isbindingresolved(M29962, :sin)

0 comments on commit 0a4ea24

Please sign in to comment.