ruby-changes:54215
From: ko1 <ko1@a...>
Date: Tue, 18 Dec 2018 17:33:26 +0900 (JST)
Subject: [ruby-changes:54215] ko1:r66436 (trunk): should use defined_class.
ko1 2018-12-18 17:33:20 +0900 (Tue, 18 Dec 2018) New Revision: 66436 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66436 Log: 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] Modified files: trunk/test/ruby/test_module.rb trunk/vm_insnhelper.c Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 66435) +++ vm_insnhelper.c (revision 66436) @@ -2292,7 +2292,7 @@ vm_call_method_each_type(rb_execution_co https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2292 break; 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: { const rb_cref_t *cref = rb_vm_get_cref(cfp->ep); Index: test/ruby/test_module.rb =================================================================== --- test/ruby/test_module.rb (revision 66435) +++ test/ruby/test_module.rb (revision 66436) @@ -2352,6 +2352,24 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_module.rb#L2352 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 def assert_top_method_is_private(method) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/