ruby-changes:54709
From: naruse <ko1@a...>
Date: Sat, 26 Jan 2019 16:59:58 +0900 (JST)
Subject: [ruby-changes:54709] naruse:r66925 (ruby_2_6): merge revision(s) 66658: [Backport #15489]
naruse 2019-01-26 16:59:54 +0900 (Sat, 26 Jan 2019) New Revision: 66925 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66925 Log: merge revision(s) 66658: [Backport #15489] vm_args.c: search symbol proc in super classes * vm_args.c (refine_sym_proc_call): traverse ancestors to search inherited methods for symbol proc. [ruby-dev:50741] [Bug #15489] Modified directories: branches/ruby_2_6/ Modified files: branches/ruby_2_6/test/ruby/test_symbol.rb branches/ruby_2_6/version.h branches/ruby_2_6/vm_args.c Index: ruby_2_6/version.h =================================================================== --- ruby_2_6/version.h (revision 66924) +++ ruby_2_6/version.h (revision 66925) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_6/version.h#L1 #define RUBY_VERSION "2.6.1" #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR -#define RUBY_PATCHLEVEL 27 +#define RUBY_PATCHLEVEL 28 #define RUBY_RELEASE_YEAR 2019 #define RUBY_RELEASE_MONTH 1 Index: ruby_2_6/vm_args.c =================================================================== --- ruby_2_6/vm_args.c (revision 66924) +++ ruby_2_6/vm_args.c (revision 66925) @@ -853,6 +853,7 @@ refine_sym_proc_call(RB_BLOCK_CALL_FUNC_ https://github.com/ruby/ruby/blob/trunk/ruby_2_6/vm_args.c#L853 rb_execution_context_t *ec; const VALUE symbol = RARRAY_AREF(callback_arg, 0); const VALUE refinements = RARRAY_AREF(callback_arg, 1); + VALUE klass; if (argc-- < 1) { rb_raise(rb_eArgError, "no receiver given"); @@ -860,8 +861,13 @@ refine_sym_proc_call(RB_BLOCK_CALL_FUNC_ https://github.com/ruby/ruby/blob/trunk/ruby_2_6/vm_args.c#L861 obj = *argv++; mid = SYM2ID(symbol); - me = rb_callable_method_entry(CLASS_OF(obj), mid); - me = rb_resolve_refined_method_callable(refinements, me); + for (klass = CLASS_OF(obj); klass; klass = RCLASS_SUPER(klass)) { + me = rb_callable_method_entry(klass, mid); + if (me) { + me = rb_resolve_refined_method_callable(refinements, me); + if (me) break; + } + } ec = GET_EC(); if (!NIL_P(blockarg)) { Index: ruby_2_6/test/ruby/test_symbol.rb =================================================================== --- ruby_2_6/test/ruby/test_symbol.rb (revision 66924) +++ ruby_2_6/test/ruby/test_symbol.rb (revision 66925) @@ -191,6 +191,12 @@ class TestSymbol < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_6/test/ruby/test_symbol.rb#L191 assert_equal(:hogehoge, _test_to_proc_arg_with_refinements_call(&:hoge)) end + def test_to_proc_arg_with_refinements_undefined + assert_raise(NoMethodError) do + _test_to_proc_arg_with_refinements_call(&:foo) + end + end + private def return_from_proc Proc.new { return 1 }.tap(&:call) end Index: ruby_2_6 =================================================================== --- ruby_2_6 (revision 66924) +++ ruby_2_6 (revision 66925) Property changes on: ruby_2_6 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r66658 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/