diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-01-10 07:51:35 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-01-10 07:51:35 +0000 |
commit | 4707fdea0171aab43a1178d4344725d8ca145ada (patch) | |
tree | a9aeecfff79835c0c6d9dee91a591122a6ebfdd4 /vm_insnhelper.c | |
parent | a5ddc2e1966a6a3af5653b1af45ccb379e346414 (diff) |
* vm_insnhelper.c (vm_search_super_method): raise a TypeError
instead of a NotImplementError if self is not an instance of the
current class. [ruby-dev:39772] [Bug #2402]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r-- | vm_insnhelper.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 6e00edde07..d82ffb3d1d 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -1943,7 +1943,13 @@ vm_search_super_method(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_call_inf if (!FL_TEST(current_defined_class, RMODULE_INCLUDED_INTO_REFINEMENT) && !rb_obj_is_kind_of(ci->recv, current_defined_class)) { - rb_raise(rb_eNotImpError, "super from singleton method that is defined to multiple classes is not supported; this will be fixed in 2.0.0 or later"); + VALUE m = RB_TYPE_P(current_defined_class, T_ICLASS) ? + RBASIC(current_defined_class)->klass : current_defined_class; + + rb_raise(rb_eTypeError, + "self has wrong type to call super in this context: " + "%s (expected %s)", + rb_obj_classname(ci->recv), rb_class2name(m)); } vm_search_superclass(GET_CFP(), iseq, sigval, ci); |