[#74190] [Ruby trunk Feature#12134] Comparison between `true` and `false` — duerst@...
Issue #12134 has been updated by Martin D端rst.
3 messages
2016/03/07
[#74269] Type systems for Ruby — Rob Blanco <ml@...>
Dear ruby-core,
5 messages
2016/03/10
[#74395] [Ruby trunk Feature#12142] Hash tables with open addressing — shyouhei@...
Issue #12142 has been updated by Shyouhei Urabe.
3 messages
2016/03/17
[ruby-core:74691] [Ruby trunk Bug#12003] Unexpected behavior of === with Range of Date objects
From:
naruse@...
Date:
2016-03-29 13:53:52 UTC
List:
ruby-core #74691
Issue #12003 has been updated by Yui NARUSE. Backport changed from 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: DONTNEED, 2.3: REQUIRED to 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: DONTNEED, 2.3: DONE ruby_2_3 r54403 merged revision(s) 53635. ---------------------------------------- Bug #12003: Unexpected behavior of === with Range of Date objects https://bugs.ruby-lang.org/issues/12003#change-57820 * Author: Ross Kaffenberger * Status: Closed * Priority: Normal * Assignee: * ruby -v: * Backport: 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: DONTNEED, 2.3: DONE ---------------------------------------- In Ruby 2.2, a Range of Date objects will return true when matched with === for a new Date that falls in the range: ~~~ puts ENV['RUBY_VERSION'] # => '2.2.3' require 'date' date_range = Date.new(1980, 1, 1)..Date.new(1990, 1, 10) # => #<Date: 1980-01-01 ((2444240j,0s,0n),+0s,2299161j)>..#<Date: 1990-01-10 ((2447902j,0s,0n),+0s,2299161j)> puts date_range.cover? Date.new(1989, 10, 13) # => true puts date_range === Date.new(1989, 10, 13) # => true ~~~ In Ruby 2.3.0, === returns false for the same date and date range: ~~~ puts ENV['RUBY_VERSION'] # => '2.3.0' require 'date' date_range = Date.new(1980, 1, 1)..Date.new(1990, 1, 10) # => #<Date: 1980-01-01 ((2444240j,0s,0n),+0s,2299161j)>..#<Date: 1990-01-10 ((2447902j,0s,0n),+0s,2299161j)> puts date_range.cover? Date.new(1989, 10, 13) # => true puts date_range === Date.new(1989, 10, 13) # => false ~~~ In both Ruby 2.2.3 and Ruby 2.3.0, date comparisons with === return true, i.e, Date.new(1980, 1, 1) === Date.new(1980, 1, 1) # => true. I believe this may be a regression in the === implementation of Range. -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>