Skip to content

Fix #6859. respond_to? regression with refinements.#6863

Merged
enebo merged 2 commits intojruby:masterfrom
enebo:fix_6859
Sep 29, 2021
Merged

Fix #6859. respond_to? regression with refinements.#6863
enebo merged 2 commits intojruby:masterfrom
enebo:fix_6859

Conversation

@enebo
Copy link
Member

@enebo enebo commented Sep 28, 2021

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.

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.
@enebo enebo added this to the JRuby 9.3.1.0 milestone Sep 28, 2021
@enebo
Copy link
Member Author

enebo commented Sep 28, 2021

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?
@enebo enebo merged commit 8ab861d into jruby:master Sep 29, 2021
@enebo enebo deleted the fix_6859 branch March 4, 2025 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant