ruby-changes:53707
From: nobu <ko1@a...>
Date: Thu, 22 Nov 2018 18:18:45 +0900 (JST)
Subject: [ruby-changes:53707] nobu:r65923 (trunk): Revert r63030
nobu 2018-11-22 18:18:40 +0900 (Thu, 22 Nov 2018) New Revision: 65923 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65923 Log: Revert r63030 * array.c (rb_ary_collect): no longer splat sole array for lambda. [ruby-core:89734] [Bug #15285] Modified files: trunk/array.c trunk/test/ruby/test_array.rb Index: array.c =================================================================== --- array.c (revision 65922) +++ array.c (revision 65923) @@ -3010,7 +3010,7 @@ rb_ary_collect(VALUE ary) https://github.com/ruby/ruby/blob/trunk/array.c#L3010 RETURN_SIZED_ENUMERATOR(ary, 0, 0, ary_enum_length); collect = rb_ary_new2(RARRAY_LEN(ary)); for (i = 0; i < RARRAY_LEN(ary); i++) { - rb_ary_push(collect, rb_yield_force_blockarg(RARRAY_AREF(ary, i))); + rb_ary_push(collect, rb_yield(RARRAY_AREF(ary, i))); } return collect; } Index: test/ruby/test_array.rb =================================================================== --- test/ruby/test_array.rb (revision 65922) +++ test/ruby/test_array.rb (revision 65923) @@ -549,7 +549,9 @@ class TestArray < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_array.rb#L549 assert_kind_of Enumerator, @cls[1, 2, 3].collect - assert_equal([[1, 2, 3]], [[1, 2, 3]].collect(&->(a, b, c) {[a, b, c]})) + assert_raise(ArgumentError) { + assert_equal([[1, 2, 3]], [[1, 2, 3]].collect(&->(a, b, c) {[a, b, c]})) + } end # also update map! -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/