From: eregontp@... Date: 2020-12-21T10:37:32+00:00 Subject: [ruby-core:101576] [Ruby master Bug#17409] Endless range of dates stuck on include? when miss Issue #17409 has been updated by Eregon (Benoit Daloze). Maybe there should be some `Class#<=>_consistent_with_succ?`/`Class#compare_consistent_with_succ?` method, then we'd be able to use `cover?` semantics for `Range#include?` for all types where it makes sense. String is a bit special in that it holds for e.g., 'a'...'z' (and Range is optimized for that case), but it doesn't hold for 'z'..'aa'. ---------------------------------------- Bug #17409: Endless range of dates stuck on include? when miss https://bugs.ruby-lang.org/issues/17409#change-89361 * Author: gsmetal (Sergey G) * Status: Rejected * Priority: Normal * ruby -v: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- This code stucks (on latest ruby 2.7.1): ```ruby require 'date' (Date.today..).include?(Date.today - 1) ``` But it works well with `cover?`: ```ruby 2.7.1 :001 > require 'date' => true 2.7.1 :002 > (Date.today..).cover?(Date.today - 1) => false ``` -- https://bugs.ruby-lang.org/ Unsubscribe: