summaryrefslogtreecommitdiff
path: root/vm_method.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-28 18:13:42 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-28 18:13:42 +0000
commitf50f70259ded4e1be9c197dd04d7da9518e8ca68 (patch)
treeec329df0ce15ba81a38b2a749df20f72ce1ad145 /vm_method.c
parentc839def7cc34f858777b15d2d84cb45b585d9699 (diff)
merge revision(s) r49221: [Backport #10731]
* vm_method.c (rb_alias): raise a NameError when creating alias to a refined method if the original method of the refined method is not defined. [ruby-core:67523] [Bug #10731] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@49787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_method.c')
-rw-r--r--vm_method.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/vm_method.c b/vm_method.c
index 08946b9862..3748e92679 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -1259,7 +1259,9 @@ rb_alias(VALUE klass, ID name, ID def)
again:
orig_me = search_method(klass, def, &defined_class);
- if (UNDEFINED_METHOD_ENTRY_P(orig_me)) {
+ if (UNDEFINED_METHOD_ENTRY_P(orig_me) ||
+ (orig_me->def->type == VM_METHOD_TYPE_REFINED &&
+ UNDEFINED_METHOD_ENTRY_P(orig_me->def->body.orig_me))) {
if ((!RB_TYPE_P(klass, T_MODULE)) ||
(orig_me = search_method(rb_cObject, def, 0),
UNDEFINED_METHOD_ENTRY_P(orig_me))) {