Skip to content

Commit

Permalink
isdeprecated does not resolve binding (#29962)
Browse files Browse the repository at this point in the history
(cherry picked from commit a3599e9)
  • Loading branch information
pfitzseb authored and KristofferC committed Dec 12, 2018
1 parent be5a92b commit ef03e0b
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
Expand Up @@ -508,8 +508,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
Expand Up @@ -805,3 +805,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 ef03e0b

Please sign in to comment.