Project

General

Profile

Actions

Bug #20324

closed

`(1..).overlap?('foo'..)` returns true

Added by kyanagi (Kouhei Yanagita) 8 months ago. Updated 5 months ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin22]
[ruby-core:117047]

Description

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'..?)

Actions #1

Updated by nobu (Nobuyoshi Nakada) 8 months ago

  • Backport changed from 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN to 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: REQUIRED
Actions #2

Updated by nobu (Nobuyoshi Nakada) 8 months ago

  • Status changed from Open to Closed

Applied in changeset git|b176315827d1082f43628013a7d89fda02724d33.


[Bug #20324] Uncomparable ranges are not overlapping

Updated by k0kubun (Takashi Kokubun) 5 months ago

  • 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 6d6818883b8.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0