ruby-changes:39052
From: nagachika <ko1@a...>
Date: Sat, 4 Jul 2015 04:45:01 +0900 (JST)
Subject: [ruby-changes:39052] nagachika:r51133 (ruby_2_2): merge revision(s) 50430, 50440: [Backport #11117]
nagachika 2015-07-04 04:44:42 +0900 (Sat, 04 Jul 2015) New Revision: 51133 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51133 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_2/ Modified files: branches/ruby_2_2/ChangeLog branches/ruby_2_2/test/ruby/test_refinement.rb branches/ruby_2_2/version.h branches/ruby_2_2/vm_eval.c Index: ruby_2_2/ChangeLog =================================================================== --- ruby_2_2/ChangeLog (revision 51132) +++ ruby_2_2/ChangeLog (revision 51133) @@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1 +Sat Jul 4 04:35:51 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] + +Sat Jul 4 04:35:51 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] + Wed Jul 1 04:16:56 2015 SHIBATA Hiroshi <hsbt@r...> * ext/bigdecimal/bigdecimal.gemspec: Fix require paths for released gem. Index: ruby_2_2/vm_eval.c =================================================================== --- ruby_2_2/vm_eval.c (revision 51132) +++ ruby_2_2/vm_eval.c (revision 51133) @@ -557,8 +557,13 @@ rb_method_call_status(rb_thread_t *th, c https://github.com/ruby/ruby/blob/trunk/ruby_2_2/vm_eval.c#L557 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_2/version.h =================================================================== --- ruby_2_2/version.h (revision 51132) +++ ruby_2_2/version.h (revision 51133) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1 #define RUBY_VERSION "2.2.3" #define RUBY_RELEASE_DATE "2015-07-04" -#define RUBY_PATCHLEVEL 143 +#define RUBY_PATCHLEVEL 144 #define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_MONTH 7 Index: ruby_2_2/test/ruby/test_refinement.rb =================================================================== --- ruby_2_2/test/ruby/test_refinement.rb (revision 51132) +++ ruby_2_2/test/ruby/test_refinement.rb (revision 51133) @@ -1415,6 +1415,33 @@ class TestRefinement < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/ruby/test_refinement.rb#L1415 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_2 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r50430,50440 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/