Skip to content

Commit 7be57bb

Browse files
committed
[SDK] Fix broken rangeIndex test for IndexSet.Index comparisons
It was always testing `rhs` against `rhs`, so it could never fail. But we don't actually need the test at all, because the `value` field is sufficient to compare indices.
1 parent 76fe9ea commit 7be57bb

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

stdlib/public/SDK/Foundation/IndexSet.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,23 @@ import _SwiftFoundationOverlayShims
1515

1616
extension IndexSet.Index {
1717
public static func ==(lhs: IndexSet.Index, rhs: IndexSet.Index) -> Bool {
18-
return lhs.value == rhs.value && rhs.rangeIndex == rhs.rangeIndex
18+
return lhs.value == rhs.value
1919
}
2020

2121
public static func <(lhs: IndexSet.Index, rhs: IndexSet.Index) -> Bool {
22-
return lhs.value < rhs.value && rhs.rangeIndex <= rhs.rangeIndex
22+
return lhs.value < rhs.value
2323
}
2424

2525
public static func <=(lhs: IndexSet.Index, rhs: IndexSet.Index) -> Bool {
26-
return lhs.value <= rhs.value && rhs.rangeIndex <= rhs.rangeIndex
26+
return lhs.value <= rhs.value
2727
}
2828

2929
public static func >(lhs: IndexSet.Index, rhs: IndexSet.Index) -> Bool {
30-
return lhs.value > rhs.value && rhs.rangeIndex >= rhs.rangeIndex
30+
return lhs.value > rhs.value
3131
}
3232

3333
public static func >=(lhs: IndexSet.Index, rhs: IndexSet.Index) -> Bool {
34-
return lhs.value >= rhs.value && rhs.rangeIndex >= rhs.rangeIndex
34+
return lhs.value >= rhs.value
3535
}
3636
}
3737

0 commit comments

Comments
 (0)