diff options
author | nagachika <nagachika@ruby-lang.org> | 2021-05-29 14:34:00 +0900 |
---|---|---|
committer | nagachika <nagachika@ruby-lang.org> | 2021-05-29 14:34:00 +0900 |
commit | 7b6a2ad04a3272a31323493133498dfc60d77d76 (patch) | |
tree | 47868bcfb63d0c5a82ad2a36b00d789807e3ad88 /vm_method.c | |
parent | 20bf397f7cebd8156d76941dd54659cf9b8c8fe7 (diff) |
merge revision(s) 4b36a597f48c857aa5eb9ed80fec0d02f6284646: [Backport #17519]
Fix setting method visibility for a refinement without an origin
class
If a class has been refined but does not have an origin class,
there is a single method entry marked with VM_METHOD_TYPE_REFINED,
but it contains the original method entry. If the original method
entry is present, we shouldn't skip the method when searching even
when skipping refined methods.
Fixes [Bug #17519]
---
test/ruby/test_module.rb | 110 ++++++++++++++++++++++++++++++++++++++++++++++-
vm_method.c | 3 +-
2 files changed, 111 insertions(+), 2 deletions(-)
Diffstat (limited to 'vm_method.c')
-rw-r--r-- | vm_method.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/vm_method.c b/vm_method.c index e72ef1a7a5..453cbed499 100644 --- a/vm_method.c +++ b/vm_method.c @@ -969,7 +969,8 @@ search_method0(VALUE klass, ID id, VALUE *defined_class_ptr, bool skip_refined) for (; klass; klass = RCLASS_SUPER(klass)) { RB_DEBUG_COUNTER_INC(mc_search_super); if ((me = lookup_method_table(klass, id)) != 0) { - if (!skip_refined || me->def->type != VM_METHOD_TYPE_REFINED) { + if (!skip_refined || me->def->type != VM_METHOD_TYPE_REFINED || + me->def->body.refined.orig_me) { break; } } |