Project

General

Profile

Actions

Bug #2053

closed

`for` No Longer Splats When RHS Returns More Values Than LHS Expects

Added by runpaint (Run Paint Run Run) about 15 years ago. Updated over 13 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.2dev (2009-09-05 trunk 24762) [i686-linux]
Backport:
[ruby-core:25414]

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

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0