Actions
Bug #1626
closedSet Raises NoMethodError for Non-Enumerable Arguments
Description
=begin
Attempting to construct a Set on 1.9 with a non-Enumerable argument causes a NoMethodError to be raised, which is unintuitive.
$ ruby -rset -ve 'Set.new 3'
ruby 1.9.2dev (2009-06-13 trunk 23682) [i686-linux]
/usr/local/lib/ruby/1.9.1/set.rb:282:in `merge': undefined method `each' for 3:Fixnum (NoMethodError)
from /usr/local/lib/ruby/1.9.1/set.rb:75:in `initialize'
from -e:1:in `new'
from -e:1:in `<main>'
1.8 raises an ArgumentError for this scenario, which is far more sensible.
$ ruby1.8 -rset -ve 'Set.new 3'
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
/usr/lib/ruby/1.8/set.rb:262:in `merge': value must be enumerable (ArgumentError)
from /usr/lib/ruby/1.8/set.rb:75:in `initialize'
from -e:1:in `new'
from -e:1
=end
Actions
Like0
Like0Like0Like0