-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
isdeprecated
should not resolve binding
#29962
Conversation
Looks good to me but @JeffBezanson should really take a quick look. |
Yes, I think this is ok, as long as uses of |
src/module.c
Outdated
jl_binding_t *b = jl_get_binding(m, var); | ||
return b && b->deprecated; | ||
if (jl_binding_resolved_p(m, var)) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see other if
statements in this file for the style we use.
test/reflection.jl
Outdated
@@ -809,3 +809,6 @@ 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) | |||
|
|||
# make sure checking if a binding is deprecated does not resolve it | |||
@test !(!Base.isdeprecated(Main, :sin) && !Base.isbindingresolved(Main, :sin)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend making an empty module for this purpose so it doesn't depend on Main
, which will be unpredictable.
b662ed4
to
d15116e
Compare
d15116e
to
0a4ea24
Compare
Thanks for the comments, should be addressed now :)
Well, this for example will call |
That's true, but as of now that code is almost a bug --- there should never be a need to call |
Failures are #29923 |
(cherry picked from commit a3599e9)
(cherry picked from commit a3599e9)
(cherry picked from commit a3599e9)
(cherry picked from commit a3599e9)
This is one way to fix https://discourse.julialang.org/t/inconsistent-base-method-overwrite-behaviour/15367 and related issues. Without this PR the following rather undesirable things happen:
I think this behaviour is more sensible than making sure to write
to avoid accidentally resolving bindings.