Skip to content

Commit d725391

Browse files
authored
Merge pull request swiftlang#37955 from amartini51/doc_comment_fixes
Doc comment fixes
2 parents 45699ce + d0d4a88 commit d725391

10 files changed

+48
-57
lines changed

stdlib/public/Concurrency/AsyncIteratorProtocol.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import Swift
1414

15-
/// A type that that asychronously supplies the values of a sequence one at a
15+
/// A type that asynchronously supplies the values of a sequence one at a
1616
/// time.
1717
///
1818
/// The `AsyncIteratorProtocol` defines the type returned by the

stdlib/public/Concurrency/AsyncSequence.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ extension AsyncSequence {
236236
/// The predicate executes each time the asynchronous sequence produces an
237237
/// element, until either the predicate returns `false` or the sequence ends.
238238
///
239+
/// If the asynchronous sequence is empty, this method returns `true`.
240+
///
239241
/// - Parameter predicate: A closure that takes an element of the asynchronous
240242
/// sequence as its argument and returns a Boolean value that indicates
241243
/// whether the passed element satisfies a condition.

stdlib/public/Concurrency/AsyncThrowingPrefixWhileSequence.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ extension AsyncSequence {
4343
/// }
4444
/// // Prints: 1 2 3 4 Error: MyError()
4545
///
46-
/// - Parameter isIncluded: A error-throwing closure that takes an element of
46+
/// - Parameter predicate: A error-throwing closure that takes an element of
4747
/// the asynchronous sequence as its argument and returns a Boolean value
4848
/// that indicates whether to include the element in the modified sequence.
4949
/// - Returns: An asynchronous sequence that contains, in order, the elements

stdlib/public/Concurrency/CheckedContinuation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ extension CheckedContinuation {
259259
/// - function: A string identifying the declaration that is the notional
260260
/// source for the continuation, used to identify the continuation in
261261
/// runtime diagnostics related to misuse of this continuation.
262-
/// - body: A closure that takes an `UnsafeContinuation` parameter.
262+
/// - body: A closure that takes a `CheckedContinuation` parameter.
263263
/// You must resume the continuation exactly once.
264264
@available(SwiftStdlib 5.5, *)
265265
public func withCheckedContinuation<T>(

stdlib/public/Concurrency/PartialAsyncTask.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public struct UnownedJob {
4444
/// `resume(with:)`,
4545
/// or `resume()` method.
4646
///
47-
/// - Important: You must call a resume methods exactly once
47+
/// - Important: You must call a resume method exactly once
4848
/// on every execution path throughout the program.
4949
/// Resuming from a continuation more than once is undefined behavior.
5050
/// Never resuming leaves the task in a suspended state indefinitely,
@@ -243,7 +243,7 @@ internal func _resumeUnsafeThrowingContinuationWithError<T>(
243243
#endif
244244

245245
/// Suspends the current task,
246-
/// then calls the given closure with the an unsafe continuation for the current task.
246+
/// then calls the given closure with an unsafe continuation for the current task.
247247
///
248248
/// - Parameter fn: A closure that takes an `UnsafeContinuation` parameter.
249249
/// You must resume the continuation exactly once.
@@ -260,7 +260,7 @@ public func withUnsafeContinuation<T>(
260260
}
261261

262262
/// Suspends the current task,
263-
/// then calls the given closure with the an unsafe throwing continuation for the current task.
263+
/// then calls the given closure with an unsafe throwing continuation for the current task.
264264
///
265265
/// - Parameter fn: A closure that takes an `UnsafeContinuation` parameter.
266266
/// You must resume the continuation exactly once.

stdlib/public/Concurrency/Task.swift

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -84,31 +84,17 @@ extension Task {
8484
/// If the awaited on task gets cancelled externally the `get()` will throw
8585
/// a cancellation error.
8686
///
87-
/// If the task gets cancelled internally, e.g. by checking for cancellation
88-
/// and throwing a specific error or using `checkCancellation` the error
89-
/// thrown out of the task will be re-thrown here.
87+
/// If the task gets cancelled internally --
88+
/// for example, by checking for cancellation
89+
/// and throwing a specific error, or by calling `checkCancellation()`,
90+
/// then the error thrown by the task is rethrown here.
9091
public var value: Success {
9192
get async throws {
9293
return try await _taskFutureGetThrowing(_task)
9394
}
9495
}
9596

96-
/// Wait for the task to complete, returning (or throwing) its result.
97-
///
98-
/// ### Priority
99-
/// If the task has not completed yet, its priority will be elevated to the
100-
/// priority of the current task. Note that this may not be as effective as
101-
/// creating the task with the "right" priority to in the first place.
102-
///
103-
/// ### Cancellation
104-
/// If the awaited on task gets cancelled externally the `get()` will throw
105-
/// a cancellation error.
106-
///
107-
/// If the task gets cancelled internally, e.g. by checking for cancellation
108-
/// and throwing a specific error or using `checkCancellation` the error
109-
/// thrown out of the task will be re-thrown here.
110-
111-
/// Wait for the task to complete, returning its `Result`.
97+
/// Wait for the task to complete, returning its result.
11298
///
11399
/// ### Priority
114100
/// If the task has not completed yet, its priority will be elevated to the
@@ -119,9 +105,10 @@ extension Task {
119105
/// If the awaited on task gets cancelled externally the `get()` will throw
120106
/// a cancellation error.
121107
///
122-
/// If the task gets cancelled internally, e.g. by checking for cancellation
123-
/// and throwing a specific error or using `checkCancellation` the error
124-
/// thrown out of the task will be re-thrown here.
108+
/// If the task gets cancelled internally --
109+
/// for example, by checking for cancellation
110+
/// and throwing a specific error, or by calling `checkCancellation()`,
111+
/// then the error thrown by the task is returned here.
125112
public var result: Result<Success, Failure> {
126113
get async {
127114
do {

stdlib/public/Concurrency/TaskGroup.swift

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ import Swift
1616
// ==== TaskGroup --------------------------------------------------------------
1717

1818
/// Starts a new task group which provides a scope in which a dynamic number of
19-
/// tasks may be spawned.
19+
/// tasks may be created.
2020
///
2121
/// When the group returns,
22-
/// it implicitly waits for all spawned tasks to complete.
22+
/// it implicitly waits for all child tasks to complete.
2323
/// The tasks are canceled only if `cancelAll()` was invoked before returning,
2424
/// if the group's task was canceled.
2525
///
@@ -50,14 +50,14 @@ import Swift
5050
/// Canceling the task in which the group is running
5151
/// also cancels the group and all of its child tasks.
5252
///
53-
/// If you call `spawn(priority:operation:)` to create a new task in a canceled group,
53+
/// If you call `async(priority:operation:)` to create a new task in a canceled group,
5454
/// that task is immediately canceled after creation.
55-
/// Alternatively, you can call `spawnUnlessCancelled(priority:operation:)`,
56-
/// which doesn't spawn the task if the group has already been canceled
55+
/// Alternatively, you can call `asyncUnlessCancelled(priority:operation:)`,
56+
/// which doesn't create the task if the group has already been canceled
5757
/// Choosing between these two functions
5858
/// lets you control how to react to cancellation within a group:
5959
/// some child tasks need to run regardless of cancellation
60-
/// and others are better not even being spawned
60+
/// and others are better not even being created
6161
/// knowing they can't produce useful results.
6262
///
6363
/// Because the tasks you add to a group with this method are nonthrowing,
@@ -91,10 +91,10 @@ public func withTaskGroup<ChildTaskResult, GroupResult>(
9191
#endif
9292
}
9393

94-
/// Starts a new scope in which a dynamic number of throwing tasks can be spawned.
94+
/// Starts a new scope in which a dynamic number of throwing tasks can be created.
9595
///
9696
/// When the group returns,
97-
/// it implicitly waits for all spawned tasks to complete.
97+
/// it implicitly waits for all child tasks to complete.
9898
/// The tasks are canceled only if `cancelAll()` was invoked before returning,
9999
/// if the group's task was canceled,
100100
/// or if the group's body throws an error.
@@ -126,14 +126,14 @@ public func withTaskGroup<ChildTaskResult, GroupResult>(
126126
/// Canceling the task in which the group is running
127127
/// also cancels the group and all of its child tasks.
128128
///
129-
/// If you call `spawn(priority:operation:)` to create a new task in a canceled group,
129+
/// If you call `async(priority:operation:)` to create a new task in a canceled group,
130130
/// that task is is immediately canceled after being created.
131-
/// Alternatively, you can call `spawnUnlessCancelled(priority:operation:)`,
132-
/// which doesn't spawn the task if the group has already been canceled
131+
/// Alternatively, you can call `asyncUnlessCancelled(priority:operation:)`,
132+
/// which doesn't create the task if the group has already been canceled
133133
/// Choosing between these two functions
134134
/// lets you control how to react to cancellation within a group:
135135
/// some child tasks need to run regardless of cancellation
136-
/// and others are better not even being spawned
136+
/// and others are better not even being created
137137
/// knowing they can't produce useful results.
138138
///
139139
/// Throwing an error in one of the tasks of a task group
@@ -145,14 +145,14 @@ public func withTaskGroup<ChildTaskResult, GroupResult>(
145145
/// nothing is canceled and the group doesn't throw an error:
146146
///
147147
/// withThrowingTaskGroup { group in
148-
/// group.spawn { throw SomeError() }
148+
/// group.async { throw SomeError() }
149149
/// }
150150
///
151151
/// In contrast, this example throws `SomeError`
152152
/// and cancels all of the tasks in the group:
153153
///
154154
/// withThrowingTaskGroup { group in
155-
/// group.spawn { throw SomeError() }
155+
/// group.async { throw SomeError() }
156156
/// try group.next()
157157
/// }
158158
///
@@ -194,7 +194,7 @@ public func withThrowingTaskGroup<ChildTaskResult, GroupResult>(
194194
#endif
195195
}
196196

197-
/// A task group serves as storage for dynamically spawned child tasks.
197+
/// A task group serves as storage for dynamically created child tasks.
198198
///
199199
/// To create a task group,
200200
/// call the `withTaskGroup(of:returning:body:)` method.
@@ -315,8 +315,8 @@ public struct TaskGroup<ChildTaskResult> {
315315
/// not in the order that those tasks were added to the task group.
316316
/// For example:
317317
///
318-
/// group.spawn { 1 }
319-
/// group.spawn { 2 }
318+
/// group.async { 1 }
319+
/// group.async { 2 }
320320
///
321321
/// print(await group.next())
322322
/// // Prints either "2" or "1".
@@ -424,7 +424,7 @@ public struct TaskGroup<ChildTaskResult> {
424424
// proofing, in case we'd ever have typed errors, however unlikely this may be.
425425
// Today the throwing task group failure is simply automatically bound to `Error`.
426426

427-
/// A task group serves as storage for dynamically spawned,
427+
/// A task group serves as storage for dynamically created,
428428
/// potentially throwing, child tasks.
429429
///
430430
@available(SwiftStdlib 5.5, *)
@@ -454,7 +454,7 @@ public struct ThrowingTaskGroup<ChildTaskResult, Failure: Error> {
454454
}
455455
}
456456

457-
/// Spawn, unconditionally, a child task in the group.
457+
/// Unconditionally create a child task in the group.
458458
///
459459
/// ### Error handling
460460
/// Operations are allowed to `throw`, in which case the `try await next()`
@@ -550,8 +550,8 @@ public struct ThrowingTaskGroup<ChildTaskResult, Failure: Error> {
550550
/// not in the order that those tasks were added to the task group.
551551
/// For example:
552552
///
553-
/// group.spawn { 1 }
554-
/// group.spawn { 2 }
553+
/// group.async { 1 }
554+
/// group.async { 2 }
555555
///
556556
/// await print(group.next())
557557
/// // Prints either "2" or "1".
@@ -610,8 +610,8 @@ public struct ThrowingTaskGroup<ChildTaskResult, Failure: Error> {
610610
/// not in the order that those tasks were added to the task group.
611611
/// For example:
612612
///
613-
/// group.spawn { 1 }
614-
/// group.spawn { 2 }
613+
/// group.async { 1 }
614+
/// group.async { 2 }
615615
///
616616
/// guard let result = await group.nextResult() else {
617617
/// return // No task to wait on, which won't happen in this example.
@@ -710,9 +710,9 @@ extension TaskGroup: AsyncSequence {
710710
/// which you can use to continue iterating over the group's results.
711711
/// For example:
712712
///
713-
/// group.spawn { 1 }
714-
/// group.spawn { throw SomeError }
715-
/// group.spawn { 2 }
713+
/// group.async { 1 }
714+
/// group.async { throw SomeError }
715+
/// group.async { 2 }
716716
///
717717
/// do {
718718
/// // Assuming the child tasks complete in order, this prints "1"

stdlib/public/core/Collection.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,8 +1467,8 @@ extension Collection {
14671467
/// }
14681468
/// // Prints "[10, 20, 30, 40]"
14691469
///
1470-
/// - Parameter end: The index of the last element to include in the
1471-
/// resulting subsequence. `end` must be a valid index of the collection
1470+
/// - Parameter position: The index of the last element to include in the
1471+
/// resulting subsequence. `position` must be a valid index of the collection
14721472
/// that is not equal to the `endIndex` property.
14731473
/// - Returns: A subsequence up to, and including, the `end` position.
14741474
///

stdlib/public/core/Policy.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public typealias Float64 = Double
7474
//===----------------------------------------------------------------------===//
7575
/// The default type for an otherwise-unconstrained integer literal.
7676
public typealias IntegerLiteralType = Int
77-
/// The default type for an otherwise-unconstrained floating point literal.
77+
/// The default type for an otherwise-unconstrained floating-point literal.
7878
public typealias FloatLiteralType = Double
7979

8080
/// The default type for an otherwise-unconstrained Boolean literal.

stdlib/public/core/SequenceAlgorithms.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,8 @@ extension Sequence {
529529
/// let allHaveAtLeastFive = names.allSatisfy({ $0.count >= 5 })
530530
/// // allHaveAtLeastFive == true
531531
///
532+
/// If the sequence is empty, this method returns `true`.
533+
///
532534
/// - Parameter predicate: A closure that takes an element of the sequence
533535
/// as its argument and returns a Boolean value that indicates whether
534536
/// the passed element satisfies a condition.

0 commit comments

Comments
 (0)