diff options
author | Jeremy Evans <code@jeremyevans.net> | 2021-04-05 16:01:46 -0700 |
---|---|---|
committer | Jeremy Evans <code@jeremyevans.net> | 2021-04-23 16:31:18 -0700 |
commit | 4b36a597f48c857aa5eb9ed80fec0d02f6284646 (patch) | |
tree | 86f031193761e8fcdce3eba27aff556094341000 /vm_method.c | |
parent | cb78aaededb09eff2f5c38ae0f8ec0f65011a2cc (diff) |
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]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4357
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 0f25c514a8..ffb290d601 100644 --- a/vm_method.c +++ b/vm_method.c @@ -977,7 +977,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; } } |