From: "zverok (Victor Shepelev) via ruby-core" Date: 2023-09-06T12:34:02+00:00 Subject: [ruby-core:114654] [Ruby master Bug#19864] Ruby 3.2 Changed Behavior With One Sided Ranges Issue #19864 has been updated by zverok (Victor Shepelev). Seems to be a bug indeed. Originates from [this commit](https://github.com/ruby/ruby/commit/04a92a6764bf678919cf4b68a27496a39d6b886a), which fixed behavior for semi-open Ranges `#include?` but also [added semi-openness](https://github.com/ruby/ruby/commit/04a92a6764bf678919cf4b68a27496a39d6b886a#diff-3e202665cd48326cc6415f1139a8ec7acd9a1833c51630644b126f49718e6cffR1805) check to `range_string_cover_internal`. cc @jeremyevans0 ---------------------------------------- Bug #19864: Ruby 3.2 Changed Behavior With One Sided Ranges https://bugs.ruby-lang.org/issues/19864#change-104483 * Author: Aesthetikx (John DeSilva) * Status: Open * Priority: Normal * ruby -v: 3.3.0 * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- Thank you for taking the time to read my issue. I know there has been some previous discussion here https://bugs.ruby-lang.org/issues/19533 regarding a similar issue, although I think this is different. I apologize if this has already been addressed. Prior to Ruby 3.2, you could use a beginless or endless range, and use === (or a case statement) to determine if a given date matched that range. For example, (..today) === yesterday would have returned true, and (tomorrow..) === today would have returned false. Please see my attached file for a more concrete example. Starting with Ruby 3.2, this results in "`===': cannot determine inclusion in beginless/endless ranges (TypeError)". I can imagine that there is difficulty and ambiguity with these infinite ranges and non numeric objects, however I do feel that these examples with dates should work, especially since (..Date.today).cover?(Date.today) still works as expected. ---Files-------------------------------- range_test.rb (928 Bytes) range_test_2.rb (411 Bytes) range_test_3.rb (162 Bytes) -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/