diff options
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r-- | vm_insnhelper.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c index c8ea3f9b1b..8487886886 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -3126,16 +3126,17 @@ vm_search_super_method(const rb_control_frame_t *reg_cfp, struct rb_call_data *c } if (BUILTIN_TYPE(current_defined_class) != T_MODULE && - BUILTIN_TYPE(current_defined_class) != T_ICLASS && /* bound UnboundMethod */ !FL_TEST(current_defined_class, RMODULE_INCLUDED_INTO_REFINEMENT) && !rb_obj_is_kind_of(recv, current_defined_class)) { VALUE m = RB_TYPE_P(current_defined_class, T_ICLASS) ? - RBASIC(current_defined_class)->klass : current_defined_class; + RCLASS_INCLUDER(current_defined_class) : current_defined_class; - rb_raise(rb_eTypeError, - "self has wrong type to call super in this context: " - "%"PRIsVALUE" (expected %"PRIsVALUE")", - rb_obj_class(recv), m); + if (m) { /* not bound UnboundMethod */ + rb_raise(rb_eTypeError, + "self has wrong type to call super in this context: " + "%"PRIsVALUE" (expected %"PRIsVALUE")", + rb_obj_class(recv), m); + } } if (me->def->type == VM_METHOD_TYPE_BMETHOD && (ci->flag & VM_CALL_ZSUPER)) { |