UnboundMethod only refer defined_class - #6855
Merged
Merged
Conversation
UnboundMethod records caller's class, like `D` or `E` on the following case: ```ruby class C def foo = :foo end class D < C end class E < C end d = D.instance_method(:foo) e = E.instance_method(:foo) ``` But `d` and `e` only refers `C#foo` so that UnboundMethod doesn't record `D` or `E`. This behavior changes the following methods: * `UnboundMethod#inspect` (doesn't show caller's class) * `UnboundMethod#==` (`d == e` for example) fix https://bugs.ruby-lang.org/issues/18798
ko1
force-pushed
the
unbound_method_class
branch
from
December 2, 2022 21:13
cb03464 to
f2d3530
Compare
ko1
marked this pull request as ready for review
December 2, 2022 21:14
rwstauner
added a commit
to Shopify/truffleruby
that referenced
this pull request
Feb 2, 2024
We're only concerned with where the method was declared (rather than the receiver of the instance_method call). See ruby/ruby#6855 and https://bugs.ruby-lang.org/issues/18798 Co-authored-by: Manef Zahra <[email protected]> Co-authored-by: Patrick Lin <[email protected]>
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.
UnboundMethod records caller's class, like
DorEon the following case:But
dandeonly refersC#fooso that UnboundMethod doesn't recordDorE. This behavior changes the following methods:UnboundMethod#inspect(doesn't show caller's class)UnboundMethod#==(d == efor example)fix https://bugs.ruby-lang.org/issues/18798