[ruby-core:118069] [Ruby master Bug#20324] `(1..).overlap?('foo'..)` returns true
From:
"k0kubun (Takashi Kokubun) via ruby-core" <ruby-core@...>
Date:
2024-05-29 18:15:36 UTC
List:
ruby-core #118069
Issue #20324 has been updated by k0kubun (Takashi Kokubun).
Backport changed from 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: REQUIRED to 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONE
This seems to have been backported to `ruby_3_3` at commit:6d6818883b8.
----------------------------------------
Bug #20324: `(1..).overlap?('foo'..)` returns true
https://bugs.ruby-lang.org/issues/20324#change-108496
* Author: kyanagi (Kouhei Yanagita)
* Status: Closed
* ruby -v: ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin22]
* Backport: 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONE
----------------------------------------
While thinking about finding the intersection of two ranges, I found that `(1..).overlap?('foo'..)` returns true.
In the current implementation, it seems that `(a..).overlap?(b..)` or `(..a).overlap?(..b)` returns true regardless of what `a` or `b` are.
However, I think it should return true if and only if `a` and `b` are comparable.
(What is the intersection of `1..` and `'foo'..`?)
--
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/