Skip to content

Commit ea15ced

Browse files
committed
merge revision(s) 63030: [Backport #14639]
array.c: yield blockarg in collect * array.c (rb_ary_collect): yield in block argument semantics always to splat array elements to lambda, for the backward compatibility. [ruby-core:86362] [Bug #14639] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@64996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 49d542f commit ea15ced

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

array.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2754,7 +2754,7 @@ rb_ary_collect(VALUE ary)
27542754
RETURN_SIZED_ENUMERATOR(ary, 0, 0, ary_enum_length);
27552755
collect = rb_ary_new2(RARRAY_LEN(ary));
27562756
for (i = 0; i < RARRAY_LEN(ary); i++) {
2757-
rb_ary_push(collect, rb_yield(RARRAY_AREF(ary, i)));
2757+
rb_ary_push(collect, rb_yield_force_blockarg(RARRAY_AREF(ary, i)));
27582758
}
27592759
return collect;
27602760
}

test/ruby/test_array.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,8 @@ def test_collect
534534
# Enumerable#collect without block returns an Enumerator.
535535
#assert_equal([1, 2, 3], @cls[1, 2, 3].collect)
536536
assert_kind_of Enumerator, @cls[1, 2, 3].collect
537+
538+
assert_equal([[1, 2, 3]], [[1, 2, 3]].collect(&->(a, b, c) {[a, b, c]}))
537539
end
538540

539541
# also update map!

version.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#define RUBY_VERSION "2.5.2"
2-
#define RUBY_RELEASE_DATE "2018-10-09"
3-
#define RUBY_PATCHLEVEL 96
2+
#define RUBY_RELEASE_DATE "2018-10-11"
3+
#define RUBY_PATCHLEVEL 97
44

55
#define RUBY_RELEASE_YEAR 2018
66
#define RUBY_RELEASE_MONTH 10
7-
#define RUBY_RELEASE_DAY 9
7+
#define RUBY_RELEASE_DAY 11
88

99
#include "ruby/version.h"
1010

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy