Fix #6859. respond_to? regression with refinements.#6863
Merged
enebo merged 2 commits intojruby:masterfrom Sep 29, 2021
Merged
Conversation
respond_to? calls searchMethod and that code path ends up passing the static scope as null. RubyModule.searchWithCache notices we are dealing with a refined method yet it has no static scope so it just passes by the refinement logic. The fix is to get current static scope based on the notion current is the lexical location anything would be searching at the moment. Getting current context as the fix is a little undesirable but pushing context through all these paths would be a big change.
Member
Author
|
Ok we cannot unconditionally add the currentScope in searchWithCache since it is also used to unresolvedSuper which would I guess want to pass the scope under the currentScope. It also seems to not be the only problem. |
searchMethod which will pass in the appropriate staticScope. This probably should be used by more/all consumers?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
respond_to? calls searchMethod and that code path ends up passing
the static scope as null. RubyModule.searchWithCache notices we
are dealing with a refined method yet it has no static scope so it
just passes by the refinement logic.
The fix is to get current static scope based on the notion current
is the lexical location anything would be searching at the moment.
Getting current context as the fix is a little undesirable but pushing
context through all these paths would be a big change.