diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | test/ruby/test_refinement.rb | 10 | ||||
-rw-r--r-- | vm_eval.c | 8 |
3 files changed, 21 insertions, 2 deletions
@@ -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) @@ -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; |