-
-
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
fix invalidations in REPLCompletions from Static.jl #46494
Conversation
Should we just do this then? function get_value(sym::Symbol, fn)::Tuple{Any,Bool}
isdefined(fn, sym) ? (getfield(fn, sym), true) : (nothing, false)
end
get_value(sym::QuoteNode, fn)::Tuple{Any,Bool} = (sym.value, true)
get_value(sym::GlobalRef, fn)::Tuple{Any,Bool} = get_value(sym.name, sym.mod)
get_value(sym, fn)::Tuple{Any,Bool} = (sym, true) |
I don't know. Does it fix the invalidation? Or do we still need the type assertion? |
I'm pretty sure that works if every method definition available asserts that, but I don't have enough memory available right now to explicitly test this. |
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.
This type assertion seems reasonable, as the type of ex
there is only known at runtime but there are 5 possible matching methods for the get_value
. As an alternative is to define get_value(args...) = _get_value(args...)::Tuple{Any,Bool}
.
A more elegant fix might be ex, found = get_value(ex, fn)::Tuple{Any, Bool} |
Thanks! I changed the code according to your suggestion. |
(cherry picked from commit 99340fe)
This should hopefully fix quite some invalidations coming from Static.jl.
Here is the code:
As far as I can tell,
get_value
will always return aBool
as second argument.