Method#owner for alias methods doesn't include prepended modules, breaking equality #5080
I've tested this on 126.96.36.199 and the latest master.
Given the following code, I'd expect a method's owner to be equal to the class where the method is defined.
class FakeClass prepender = Module.new prepend prepender def fake_method end alias_method :other_fake_method, :fake_method end
Both of these lines should return true:
FakeClass.instance_method(:fake_method).owner == FakeClass FakeClass.instance_method(:other_fake_method).owner == FakeClass
The second line returns false:
I think it's because the
I've also tested this on MRI 2.3.1 and 2.4.3 and they behave as expected.
The text was updated successfully, but these errors were encountered:
…ect owner We discovered an issue in jruby where a method created via `alias_method` on a class with a prepended module had an owner that was different from the class on which it was defined. The jruby folks suggested adding a spec here to cover this case. See jruby/jruby#5080.