aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-08 03:11:35 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-08 03:11:35 +0000
commitbd872a544c1149bbc94d5b3b79066318683fbedd (patch)
treeefe7ecc353ddb1ebf1846b0fa653183755dcd048
parentdaed91295479ff3e981bcc9e395721ba4057c79e (diff)
downloadruby-bd872a544c1149bbc94d5b3b79066318683fbedd.tar.gz
vm_eval.c: resolve refined method entry
* vm_eval.c (rb_method_call_status): resolve refined method entry to check if undefined. [ruby-core:69064] [Bug #11117] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--test/ruby/test_refinement.rb10
-rw-r--r--vm_eval.c8
3 files changed, 21 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index d763030a88..88c35076f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri May 8 12:11:33 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_eval.c (rb_method_call_status): resolve refined method entry
+ to check if undefined. [ruby-core:69064] [Bug #11117]
+
Thu May 7 22:22:59 2015 Sho Hashimoto <sho-h@ruby-lang.org>
* proc.c: [DOC] fix Binding#local_variable_set example. [ci skip]
diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb
index 0a8f6e45cb..fa8de1b85e 100644
--- a/test/ruby/test_refinement.rb
+++ b/test/ruby/test_refinement.rb
@@ -1445,6 +1445,16 @@ class TestRefinement < Test::Unit::TestCase
}
end
+ def test_funcall_inherited
+ bug11117 = '[ruby-core:69064] [Bug #11117]'
+
+ Module.new {refine(Dir) {def to_s; end}}
+ x = Class.new(Dir).allocate
+ assert_nothing_raised(NoMethodError, bug11117) {
+ x.inspect
+ }
+ end
+
private
def eval_using(mod, s)
diff --git a/vm_eval.c b/vm_eval.c
index f31a60aa80..95b1e8e9fa 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -559,10 +559,14 @@ rb_method_call_status(rb_thread_t *th, const rb_method_entry_t *me, call_type sc
ID oid;
int noex;
- if (UNDEFINED_METHOD_ENTRY_P(me) ||
- UNDEFINED_REFINED_METHOD_P(me->def)) {
+ if (UNDEFINED_METHOD_ENTRY_P(me)) {
+ undefined:
return scope == CALL_VCALL ? NOEX_VCALL : 0;
}
+ if (me->def->type == VM_METHOD_TYPE_REFINED) {
+ me = rb_resolve_refined_method(Qnil, me, NULL);
+ if (UNDEFINED_METHOD_ENTRY_P(me)) goto undefined;
+ }
klass = me->klass;
oid = me->def->original_id;
noex = me->flag;