ruby-changes:39038
From: usa <ko1@a...>
Date: Fri, 3 Jul 2015 17:56:03 +0900 (JST)
Subject: [ruby-changes:39038] usa:r51119 (ruby_2_1): merge revision(s) 50430, 50440: [Backport #11117]
usa 2015-07-03 17:55:40 +0900 (Fri, 03 Jul 2015) New Revision: 51119 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51119 Log: merge revision(s) 50430,50440: [Backport #11117] * vm_eval.c (rb_method_call_status): undefined refined method is not callable unless using. [ruby-core:69064] [Bug #11117] * vm_eval.c (rb_method_call_status): resolve refined method entry to check if undefined. [ruby-core:69064] [Bug #11117] Modified directories: branches/ruby_2_1/ Modified files: branches/ruby_2_1/ChangeLog branches/ruby_2_1/test/ruby/test_refinement.rb branches/ruby_2_1/version.h branches/ruby_2_1/vm_eval.c Index: ruby_2_1/ChangeLog =================================================================== --- ruby_2_1/ChangeLog (revision 51118) +++ ruby_2_1/ChangeLog (revision 51119) @@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1 +Fri Jul 3 17:53:43 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] + +Fri Jul 3 17:53:43 2015 Nobuyoshi Nakada <nobu@r...> + + * vm_eval.c (rb_method_call_status): undefined refined method is + not callable unless using. [ruby-core:69064] [Bug #11117] + Fri Jul 3 17:44:27 2015 Nobuyoshi Nakada <nobu@r...> * file.c (rb_file_load_ok): try opening file without gvl not to Index: ruby_2_1/vm_eval.c =================================================================== --- ruby_2_1/vm_eval.c (revision 51118) +++ ruby_2_1/vm_eval.c (revision 51119) @@ -533,8 +533,13 @@ rb_method_call_status(rb_thread_t *th, c https://github.com/ruby/ruby/blob/trunk/ruby_2_1/vm_eval.c#L533 int noex; 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: ruby_2_1/version.h =================================================================== --- ruby_2_1/version.h (revision 51118) +++ ruby_2_1/version.h (revision 51119) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1 #define RUBY_VERSION "2.1.7" #define RUBY_RELEASE_DATE "2015-07-03" -#define RUBY_PATCHLEVEL 370 +#define RUBY_PATCHLEVEL 371 #define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_MONTH 7 Index: ruby_2_1/test/ruby/test_refinement.rb =================================================================== --- ruby_2_1/test/ruby/test_refinement.rb (revision 51118) +++ ruby_2_1/test/ruby/test_refinement.rb (revision 51119) @@ -1399,6 +1399,33 @@ class TestRefinement < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_refinement.rb#L1399 INPUT end + def test_check_funcall_undefined + bug11117 = '[ruby-core:69064] [Bug #11117]' + + x = Class.new + Module.new do + refine x do + def to_regexp + // + end + end + end + + assert_nothing_raised(NoMethodError, bug11117) { + assert_nil(Regexp.try_convert(x.new)) + } + 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) Property changes on: ruby_2_1 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r50430,50440 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/