Project

General

Profile

Backport #5212

[*nil] behaves diferently from 1.8.7 to 1.9.3

Added by mathieu (Mathieu Rousseau) almost 8 years ago. Updated 7 days ago.

Status:
Closed
Priority:
Normal
Assignee:
-
[ruby-core:<unknown>]

Description

As to_a is to be obselete, i started to migrate my code and I found a problem. I did not quite know where to fill it in.

$ rvm use 1.8.7
$ ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-linux]
$ irb

ruby-1.8.7-p352 :001 > [*nil]
=> [nil]

$ rvm use 1.9.3
$ ruby -v
ruby 1.9.3dev (2011-07-31 revision 32789) [i686-linux]
$ irb

ruby-1.9.3-preview1 :001 > [*nil]
=> []

As nil.to_a returns [] and Array(nil) returns [] as well, I deduced that [*nil] in 1.8.7 should return [] as well.

Thanks

History

#1

Updated by jeremyevans0 (Jeremy Evans) 7 days ago

  • Status changed from Open to Closed
  • Project changed from Ruby 1.8 to Backport187

Also available in: Atom PDF