Actions
Bug #21446
closedStackOverflow when changing visibility in reopened refinement
Bug #21446:
StackOverflow when changing visibility in reopened refinement
Actions
Added by luke-gru (Luke Gruber) over 1 year ago. Updated 6 months ago.
I found that you don't even need to change the visibility twice. This issue affects all refinement visibility change methods where the method whose visibility is changed by the refinement is in an ancestor of the refined class. Here's a simplified example:
class A
private def a
:a
end
end
class B < A
end
module R
refine B do
public :a
end
end
using R
p B.new.a
I've submitted a pull request that handles this case: https://github.com/ruby/ruby/pull/14817
Applied in changeset git|1e7cf7b2bc1f9b356b2e980e1e18548618da6363.
Fix refinement modification of method visibility in superclass
Previously, this didn't work correctly, resulting in a
SystemStackError. This fixes the issue by finding the related
superclass method entry, and updating the orig_me in the
refinement method to point to the superclass method.
Fixes [Bug #21446]
ruby_3_4 7edff469e14541a480a6156efc1cc6e3b526e7bd merged revision(s) 1e7cf7b2bc1f9b356b2e980e1e18548618da6363.
ruby_3_3 c675ec66e912b3000e05d65bba473e8bf6e18c96 merged revision(s) 1e7cf7b2bc1f9b356b2e980e1e18548618da6363.