Bug #2053
closed`for` No Longer Splats When RHS Returns More Values Than LHS Expects
Description
=begin
$ cat /tmp/for.rb
class OFor
def each
[[1,2,3], [4,5,6]].each do |a|
yield(a[0],a[1],a[2])
end
end
end
o = OFor.new
qs = []
for q in o
qs << q
end
p qs
p q
$ ruby8 -v /tmp/for.rb
ruby 1.8.8dev (2009-09-04) [i686-linux]
/tmp/for.rb:11: warning: multiple values for a block parameter (3 for 1)
from /tmp/for.rb:4
/tmp/for.rb:11: warning: multiple values for a block parameter (3 for 1)
from /tmp/for.rb:4
[[1, 2, 3], [4, 5, 6]]
[4, 5, 6]
$ ruby -v /tmp/for.rb
ruby 1.9.2dev (2009-09-05 trunk 24762) [i686-linux]
[1, 4]
4
=end
Updated by yugui (Yuki Sonoda) about 15 years ago
- Assignee set to matz (Yukihiro Matsumoto)
- Priority changed from Normal to 3
- Target version set to 1.9.2
=begin
=end
Updated by nobu (Nobuyoshi Nakada) about 15 years ago
=begin
Hi,
At Sun, 6 Sep 2009 02:17:17 +0900,
Run Paint Run Run wrote in [ruby-core:25414]:
$ cat /tmp/for.rb
class OFor
def each
[[1,2,3], [4,5,6]].each do |a|
yield(a[0],a[1],a[2])
end
end
endo = OFor.new
qs = []
for q in o
qs << q
end
p qs
p q
It should be an intentional change, I think.
--
Nobu Nakada
=end
Updated by runpaint (Run Paint Run Run) about 15 years ago
=begin
Thanks, nobu. I've updated the spec. Don't leave this ticket open on my account. :-)
=end
Updated by nobu (Nobuyoshi Nakada) about 15 years ago
- Status changed from Open to Closed
=begin
=end