Skip to content

Commit 5fb9518

Browse files
author
Dave Abrahams
committed
[stdlib] fix doc comments
1 parent 444aaf2 commit 5fb9518

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

stdlib/public/core/Collection.swift

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,12 @@ public protocol Indexable : IndexableBase {
175175
@warn_unused_result
176176
func index(_ i: Index, offsetBy n: IndexDistance) -> Index
177177

178-
/// Returns the result of advancing `i` by `n` positions, or `nil` if it
179-
/// reaches the `limit`.
178+
/// Returns the result of advancing `i` by `n` positions, or `nil`
179+
/// if doing so would pass `limit`.
180180
///
181181
/// - Returns:
182-
/// - If `n > 0`, the `n`th successor of `i` or `nil` if the `limit` has
183-
/// been reached.
184-
/// - If `n < 0`, the `n`th predecessor of `i` or `nil` if the `limit` has
185-
/// been reached.
186-
/// - Otherwise, `i` unmodified.
182+
/// - `nil` if `(limit > i) == (n > 0) && abs(distance(i, limit)) < abs(n)`
183+
/// - Otherwise, `index(i, offsetBy: n)`
187184
///
188185
/// - Precondition: `n >= 0` unless `Self` conforms to
189186
/// `BidirectionalCollection`.

stdlib/public/core/Range.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public struct CountableRange<
6868
///
6969
/// `upperBound` is not a valid argument to `subscript`, and is always
7070
/// reachable from `lowerBound` by zero or more applications of
71-
/// `location(after:)`.
71+
/// `index(after:)`.
7272
///
7373
/// Identical to `lowerBound` in an empty range.
7474
public let upperBound: Bound

0 commit comments

Comments
 (0)