diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-03-12 23:35:29 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-03-12 23:35:29 +0000 |
commit | 75aba10d7ae24126b0f9aa561855020bdfcd8c9d (patch) | |
tree | 04e4125dd9bc628c2a03ffafe70d11bc5e63c366 | |
parent | 0fd238c72f2952c5fa22841c1828c39e8c2faa95 (diff) |
merge revision(s) 66436: [Backport #15427]
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/branches/ruby_2_5@67238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | test/ruby/test_module.rb | 18 | ||||
-rw-r--r-- | version.h | 2 | ||||
-rw-r--r-- | vm_insnhelper.c | 2 |
3 files changed, 20 insertions, 2 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index cc5894433a..076ea0901f 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -2290,6 +2290,24 @@ class TestModule < Test::Unit::TestCase 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) @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.5.4" #define RUBY_RELEASE_DATE "2019-03-13" -#define RUBY_PATCHLEVEL 150 +#define RUBY_PATCHLEVEL 151 #define RUBY_RELEASE_YEAR 2019 #define RUBY_RELEASE_MONTH 3 diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 0a2eb94753..6214d35ab9 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -2276,7 +2276,7 @@ vm_call_method_each_type(rb_execution_context_t *ec, rb_control_frame_t *cfp, st 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); |