diff options
Diffstat (limited to 'vm_method.c')
-rw-r--r-- | vm_method.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/vm_method.c b/vm_method.c index a681df569f..68bebb600a 100644 --- a/vm_method.c +++ b/vm_method.c @@ -1166,7 +1166,7 @@ rb_attr(VALUE klass, ID id, int read, int write, int ex) void rb_undef(VALUE klass, ID id) { - rb_method_entry_t *me; + const rb_method_entry_t *me; if (NIL_P(klass)) { rb_raise(rb_eTypeError, "no class to undef method"); @@ -1177,6 +1177,9 @@ rb_undef(VALUE klass, ID id) } me = search_method(klass, id, 0); + if (me && me->def->type == VM_METHOD_TYPE_REFINED) { + me = rb_resolve_refined_method(Qnil, me); + } if (UNDEFINED_METHOD_ENTRY_P(me) || UNDEFINED_REFINED_METHOD_P(me->def)) { |