mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
proc.c: skip prepended modules
* proc.c (method_super_method): skip prepended modules and continue from the super class of the original class. [ruby-core:81666] [Bug #13656] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e6d9e4c8c6
commit
dbf67bf02d
2 changed files with 12 additions and 1 deletions
2
proc.c
2
proc.c
|
@ -2652,7 +2652,7 @@ method_super_method(VALUE method)
|
|||
const rb_method_entry_t *me;
|
||||
|
||||
TypedData_Get_Struct(method, struct METHOD, &method_data_type, data);
|
||||
super_class = RCLASS_SUPER(method_entry_defined_class(data->me));
|
||||
super_class = RCLASS_SUPER(RCLASS_ORIGIN(method_entry_defined_class(data->me)));
|
||||
if (!super_class) return Qnil;
|
||||
me = (rb_method_entry_t *)rb_callable_method_entry_without_refinements(super_class, data->me->called_id);
|
||||
if (!me) return Qnil;
|
||||
|
|
|
@ -901,6 +901,17 @@ class TestMethod < Test::Unit::TestCase
|
|||
assert_nil(m)
|
||||
end
|
||||
|
||||
def test_super_method_with_prepended_module
|
||||
bug = '[ruby-core:81666] [Bug #13656]'
|
||||
c1 = EnvUtil.labeled_class("C1") {def m; end}
|
||||
c2 = EnvUtil.labeled_class("C2", c1) {def m; end}
|
||||
c2.prepend(EnvUtil.labeled_module("M"))
|
||||
m = c2.instance_method(:m)
|
||||
assert_equal(c2, m.owner)
|
||||
m = m.super_method
|
||||
assert_equal(c1, m.owner, bug)
|
||||
end
|
||||
|
||||
def rest_parameter(*rest)
|
||||
rest
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue