Skip to content

Commit f85eed4

Browse files
committed
Bring back TaskGroup.next() and ThrowingTaskGroup.next() as public API
With the introduction of `next(isolation:)` into the task group types, we removed the public APIs for the no-argument `next()` versions, leaving them only as `@usableFromInline internal` entrypoints for the ABI. Because the `next(isolation:)` versions have a default argument, this was sufficient for providing source compatibility for calls, but not for protocol conformances. Bring these APIs back publicly. Fixes rdar://127499568.
1 parent bbd7863 commit f85eed4

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

stdlib/public/Concurrency/TaskGroup.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -574,10 +574,8 @@ public struct TaskGroup<ChildTaskResult: Sendable> {
574574
return try! await _taskGroupWaitNext(group: _group) // !-safe cannot throw, we're a non-throwing TaskGroup
575575
}
576576

577-
@usableFromInline
578577
@available(SwiftStdlib 5.1, *)
579-
@_silgen_name("$sScG4nextxSgyYaF")
580-
internal mutating func __abi_next() async -> ChildTaskResult? {
578+
public mutating func next() async -> ChildTaskResult? {
581579
// try!-safe because this function only exists for Failure == Never,
582580
// and as such, it is impossible to spawn a throwing child task.
583581
return try! await _taskGroupWaitNext(group: _group) // !-safe cannot throw, we're a non-throwing TaskGroup
@@ -1035,10 +1033,8 @@ public struct ThrowingTaskGroup<ChildTaskResult: Sendable, Failure: Error> {
10351033
return try await _taskGroupWaitNext(group: _group)
10361034
}
10371035

1038-
@usableFromInline
10391036
@available(SwiftStdlib 5.1, *)
1040-
@_silgen_name("$sScg4nextxSgyYaKF")
1041-
internal mutating func __abi_next() async throws -> ChildTaskResult? {
1037+
public mutating func next() async throws -> ChildTaskResult? {
10421038
return try await _taskGroupWaitNext(group: _group)
10431039
}
10441040

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify
2+
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=targeted
3+
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=complete
4+
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -enable-upcoming-feature RegionBasedIsolation
5+
6+
// REQUIRES: concurrency
7+
// REQUIRES: asserts
8+
// REQUIRES: libdispatch
9+
10+
@available(SwiftStdlib 5.1, *)
11+
@rethrows
12+
protocol TGP: AsyncSequence, AsyncIteratorProtocol { }
13+
14+
@available(SwiftStdlib 5.1, *)
15+
extension TaskGroup: TGP { }
16+
// expected-warning@-1{{extension declares a conformance of imported type 'TaskGroup' to imported protocol 'AsyncIteratorProtocol'}}
17+
// expected-note@-2{{add '@retroactive' to silence this warning}}
18+
19+
@available(SwiftStdlib 5.1, *)
20+
extension ThrowingTaskGroup: TGP { }
21+
// expected-warning@-1{{extension declares a conformance of imported type 'ThrowingTaskGroup' to imported protocol 'AsyncIteratorProtocol'}}
22+
// expected-note@-2{{add '@retroactive' to silence this warning}}

0 commit comments

Comments
 (0)