mirror of
https://github.com/ruby/ruby.git
synced 2025-09-23 20:44:00 +02:00
should use defined_class.
* vm_insnhelper.c (vm_call_method_each_type): we should use me->defined_class instead of me->owner because me->owner doesn't has correct ancestors list. [Bug #15427] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66436 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
84b49707d6
commit
2103333e78
2 changed files with 19 additions and 1 deletions
|
@ -2352,6 +2352,24 @@ class TestModule < Test::Unit::TestCase
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_private_extended_module
|
||||||
|
assert_separately [], %q{
|
||||||
|
class Object
|
||||||
|
def bar; "Object#bar"; end
|
||||||
|
end
|
||||||
|
module M1
|
||||||
|
def bar; super; end
|
||||||
|
end
|
||||||
|
module M2
|
||||||
|
include M1
|
||||||
|
private(:bar)
|
||||||
|
def foo; bar; end
|
||||||
|
end
|
||||||
|
extend M2
|
||||||
|
assert_equal 'Object#bar', foo
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def assert_top_method_is_private(method)
|
def assert_top_method_is_private(method)
|
||||||
|
|
|
@ -2292,7 +2292,7 @@ vm_call_method_each_type(rb_execution_context_t *ec, rb_control_frame_t *cfp, st
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VM_METHOD_TYPE_ZSUPER:
|
case VM_METHOD_TYPE_ZSUPER:
|
||||||
return vm_call_zsuper(ec, cfp, calling, ci, cc, RCLASS_ORIGIN(cc->me->owner));
|
return vm_call_zsuper(ec, cfp, calling, ci, cc, RCLASS_ORIGIN(cc->me->defined_class));
|
||||||
|
|
||||||
case VM_METHOD_TYPE_REFINED: {
|
case VM_METHOD_TYPE_REFINED: {
|
||||||
const rb_cref_t *cref = rb_vm_get_cref(cfp->ep);
|
const rb_cref_t *cref = rb_vm_get_cref(cfp->ep);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue