From 62ffc9f02570c98e05d55acf89ba886b5bbd1e73 Mon Sep 17 00:00:00 2001 From: Konrad `ktoso` Malawski Date: Wed, 27 Sep 2023 12:48:34 +0900 Subject: [PATCH 1/3] Fix cut off sentence and correct Throwing discarding task group docs We cut off a sentence, this corrects that issue. resolves rdar://115519046 --- .../Concurrency/DiscardingTaskGroup.swift | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/stdlib/public/Concurrency/DiscardingTaskGroup.swift b/stdlib/public/Concurrency/DiscardingTaskGroup.swift index f2764b08b1b63..1f44603a6c19b 100644 --- a/stdlib/public/Concurrency/DiscardingTaskGroup.swift +++ b/stdlib/public/Concurrency/DiscardingTaskGroup.swift @@ -414,20 +414,25 @@ extension DiscardingTaskGroup: Sendable { } /// } /// ``` /// -/// -/// /// Generally, this suits the typical use-cases of a /// discarding task group well, however, if you wanted to prevent specific -/// errors from cancelling the group -/// -/// -/// +/// errors from cancelling the group one should catch them inside the child +/// task's body like this: /// -/// Throwing an error in one of the child tasks of a task group -/// doesn't immediately cancel the other tasks in that group. -/// However, -/// throwing out of the `body` of the `withThrowingTaskGroup` method does cancel -/// the group, and all of its child tasks. +/// ``` +/// try await withThrowingDiscardingTaskGroup { group in +/// group.addTask { +/// do { +/// try boom(1) +/// } catch is HarmlessError { +/// return +/// } +/// } +/// group.addTask { +/// try boom(2, after: .seconds(5)) +/// } +/// } +/// ``` @available(SwiftStdlib 5.9, *) @inlinable @_unsafeInheritExecutor From ecdac2e5ae3597d8d54219cdceb4ee37703a1196 Mon Sep 17 00:00:00 2001 From: Alex Martini Date: Wed, 27 Sep 2023 13:29:54 -0700 Subject: [PATCH 2/3] Remove stray whitespace at end of line. --- stdlib/public/Concurrency/DiscardingTaskGroup.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stdlib/public/Concurrency/DiscardingTaskGroup.swift b/stdlib/public/Concurrency/DiscardingTaskGroup.swift index 1f44603a6c19b..bc36958d11c8b 100644 --- a/stdlib/public/Concurrency/DiscardingTaskGroup.swift +++ b/stdlib/public/Concurrency/DiscardingTaskGroup.swift @@ -416,20 +416,20 @@ extension DiscardingTaskGroup: Sendable { } /// /// Generally, this suits the typical use-cases of a /// discarding task group well, however, if you wanted to prevent specific -/// errors from cancelling the group one should catch them inside the child +/// errors from cancelling the group one should catch them inside the child /// task's body like this: /// /// ``` /// try await withThrowingDiscardingTaskGroup { group in -/// group.addTask { +/// group.addTask { /// do { /// try boom(1) /// } catch is HarmlessError { /// return /// } /// } -/// group.addTask { -/// try boom(2, after: .seconds(5)) +/// group.addTask { +/// try boom(2, after: .seconds(5)) /// } /// } /// ``` From e8d86e879e5db9e47beea32832e3c43891b8ad38 Mon Sep 17 00:00:00 2001 From: Alex Martini Date: Wed, 27 Sep 2023 13:31:17 -0700 Subject: [PATCH 3/3] Minor adjustments for Apple style. --- stdlib/public/Concurrency/DiscardingTaskGroup.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stdlib/public/Concurrency/DiscardingTaskGroup.swift b/stdlib/public/Concurrency/DiscardingTaskGroup.swift index bc36958d11c8b..5cd8a45101e62 100644 --- a/stdlib/public/Concurrency/DiscardingTaskGroup.swift +++ b/stdlib/public/Concurrency/DiscardingTaskGroup.swift @@ -414,9 +414,9 @@ extension DiscardingTaskGroup: Sendable { } /// } /// ``` /// -/// Generally, this suits the typical use-cases of a -/// discarding task group well, however, if you wanted to prevent specific -/// errors from cancelling the group one should catch them inside the child +/// Generally, this suits the typical use cases of a +/// discarding task group well, however, if you want to prevent specific +/// errors from canceling the group you can catch them inside the child /// task's body like this: /// /// ```