ruby-changes:38359
From: nobu <ko1@a...>
Date: Fri, 8 May 2015 12:11:49 +0900 (JST)
Subject: [ruby-changes:38359] nobu:r50440 (trunk): vm_eval.c: resolve refined method entry
nobu 2015-05-08 12:11:35 +0900 (Fri, 08 May 2015) New Revision: 50440 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50440 Log: 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] Modified files: trunk/ChangeLog trunk/test/ruby/test_refinement.rb trunk/vm_eval.c Index: ChangeLog =================================================================== --- ChangeLog (revision 50439) +++ ChangeLog (revision 50440) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri May 8 12:11:33 2015 Nobuyoshi Nakada <nobu@r...> + + * 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@r...> * proc.c: [DOC] fix Binding#local_variable_set example. [ci skip] Index: vm_eval.c =================================================================== --- vm_eval.c (revision 50439) +++ vm_eval.c (revision 50440) @@ -559,10 +559,14 @@ rb_method_call_status(rb_thread_t *th, c https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L559 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; Index: test/ruby/test_refinement.rb =================================================================== --- test/ruby/test_refinement.rb (revision 50439) +++ test/ruby/test_refinement.rb (revision 50440) @@ -1445,6 +1445,16 @@ class TestRefinement < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/ruby/test_refinement.rb#L1445 } 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) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/