Issue #6994 has been updated by headius (Charles Nutter).


This can be closed.
----------------------------------------
Bug #6994: yield plus splat unwraps too much
https://bugs.ruby-lang.org/issues/6994#change-30670

Author: headius (Charles Nutter)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: 2.0.0dev and 1.9.3p253


I don't see how anyone could argue that 1.9.3 and 2.0.0 are correct here:

system ~/projects/jruby $ ruby-1.8.7-p358 -e "def foo; yield *[1]; end; foo {|a, b, *c| p [a,b,c]}"
[1, nil, []]

system ~/projects/jruby $ ruby-1.8.7-p358 -e "def foo; yield *[[1]]; end; foo {|a, b, *c| p [a,b,c]}"
[[1], nil, []]

system ~/projects/jruby $ ruby-1.8.7-p358 -e "def foo; yield *[[[1]]]; end; foo {|a, b, *c| p [a,b,c]}"
[[[1]], nil, []]

system ~/projects/jruby $ ruby-1.9.3 -e "def foo; yield *[1]; end; foo {|a, b, *c| p [a,b,c]}"
[1, nil, []]

system ~/projects/jruby $ ruby-1.9.3 -e "def foo; yield *[[1]]; end; foo {|a, b, *c| p [a,b,c]}"
[1, nil, []]

system ~/projects/jruby $ ruby-1.9.3 -e "def foo; yield *[[[1]]]; end; foo {|a, b, *c| p [a,b,c]}"
[[1], nil, []]

system ~/projects/jruby $ ruby-2.0.0 -e "def foo; yield *[1]; end; foo {|a, b, *c| p [a,b,c]}"
[1, nil, []]

system ~/projects/jruby $ ruby-2.0.0 -e "def foo; yield *[[1]]; end; foo {|a, b, *c| p [a,b,c]}"
[1, nil, []]

system ~/projects/jruby $ ruby-2.0.0 -e "def foo; yield *[[[1]]]; end; foo {|a, b, *c| p [a,b,c]}"
[[1], nil, []]

system ~/projects/jruby $ ruby-1.9.3 -v
ruby 1.9.3p253 (2012-07-04 revision 36307) [x86_64-darwin11.4.0]

system ~/projects/jruby $ ruby-2.0.0 -v
ruby 2.0.0dev (2012-08-27 trunk 36833) [x86_64-darwin11.4.0]

JRuby behaves like 1.8 in both 1.8 and 1.9 modes. I would feel pretty dirty fixing it, since I think the 1.9.3/2.0.0 behavior is wrong.


-- 
http://bugs.ruby-lang.org/