Backport #3680: Splatting calls to_ary instead of to_a in some cases
http://redmine.ruby-lang.org/issues/show/3680

Author: Tomas Matousek
Status: Open, Priority: Normal
Category: core

In some cases to_ary is called to splat an array. Shouldn't to_a be always called?

class C
  def respond_to? name
    p name
    false
  end
end

p [1,*C.new]
p(*C.new)

x,y = C.new
p x,y

proc {|a,b| p [a,b] }.call(C.new)

ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32]
:to_a
[1, #<C:0x1984aa0>]
:to_a
#<C:0x1984900>
:to_ary
#<C:0x1984820>
nil
:to_ary
[#<C:0x1984680>, nil]


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