diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-01-17 15:53:53 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-01-17 15:53:53 +0000 |
commit | 38921417228bcf683ed5e9aee12765a1dc19be0c (patch) | |
tree | f22a9d613c1a5127ee238c353a4e43b00fd8eee8 /vm_method.c | |
parent | 223a4a5aee79d197c55525ecdc22be631b6c6ec1 (diff) |
merge revision(s) 49221: [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_2@49311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_method.c')
-rw-r--r-- | vm_method.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/vm_method.c b/vm_method.c index 97ae64f55d..e93bb71b4e 100644 --- a/vm_method.c +++ b/vm_method.c @@ -1273,7 +1273,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))) { |