core/range.rbs in rbs-3.4.0 vs core/range.rbs in rbs-3.4.1
- old
+ new
@@ -869,18 +869,19 @@
# (4..5).overlap?(2...4) # => false
#
# (1..2).overlap?(3..4) # => false
# (1...3).overlap?(3..4) # => false
#
- # This method assumes that there is no minimum value because Ruby lacks a
- # standard method for determining minimum values. This assumption is invalid.
- # For example, there is no value smaller than `-Float::INFINITY`, making
- # `(...-Float::INFINITY)` an empty set. Consequently, `(...-Float::INFINITY)`
- # has no elements in common with itself, yet
- # `(...-Float::INFINITY).overlap?((...-Float::INFINITY))<tt> returns true due to
- # this assumption. In general, if <tt>r = (...minimum); r.overlap?(r)` returns
- # `true`, where `minimum` is a value that no value is smaller than. Such values
- # include `-Float::INFINITY`, `[]`, `""`, and classes without subclasses.
+ # Note that the method wouldn't make any assumptions about the beginless range
+ # being actually empty, even if its upper bound is the minimum possible value of
+ # its type, so all this would return `true`:
+ #
+ # (...-Float::INFINITY).overlap?(...-Float::INFINITY) # => true
+ # (..."").overlap?(..."") # => true
+ # (...[]).overlap?(...[]) # => true
+ #
+ # Even if those ranges are effectively empty (no number can be smaller than
+ # `-Float::INFINITY`), they are still considered overlapping with themselves.
#
# Related: Range#cover?.
#
def overlap?: (Range[untyped]) -> bool