Skip to content

Commit 02562c3

Browse files
committed
Substring.index(_:offsetBy:) is allowed offset of 0
1 parent 5d185d1 commit 02562c3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

stdlib/public/core/Substring.swift.gyb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public struct Substring : RangeReplaceableCollection, BidirectionalCollection {
5757
let result = _slice.index(i, offsetBy: n)
5858
// FIXME(strings): slice types currently lack necessary bound checks
5959
_precondition(
60-
(_slice._startIndex ..< _slice.endIndex).contains(result),
60+
(_slice._startIndex ... _slice.endIndex).contains(result),
6161
"Operation results in an invalid index")
6262
return result
6363
}
@@ -68,7 +68,7 @@ public struct Substring : RangeReplaceableCollection, BidirectionalCollection {
6868
let result = _slice.index(i, offsetBy: n, limitedBy: limit)
6969
// FIXME(strings): slice types currently lack necessary bound checks
7070
_precondition(result.map {
71-
(_slice._startIndex ..< _slice.endIndex).contains($0)
71+
(_slice._startIndex ... _slice.endIndex).contains($0)
7272
} ?? true,
7373
"Operation results in an invalid index")
7474
return result

0 commit comments

Comments
 (0)