mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
36 lines
788 B
Swift
36 lines
788 B
Swift
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=complete
|
|
|
|
// REQUIRES: concurrency
|
|
// REQUIRES: libdispatch
|
|
|
|
@MainActor
|
|
class MyActor {
|
|
func check() async throws {
|
|
await withTaskGroup(of: Int.self) { group in
|
|
group.addTask {
|
|
2
|
|
}
|
|
await group.waitForAll()
|
|
}
|
|
|
|
try await withThrowingTaskGroup(of: Int.self) { throwingGroup in
|
|
throwingGroup.addTask {
|
|
2
|
|
}
|
|
try await throwingGroup.waitForAll()
|
|
}
|
|
|
|
await withDiscardingTaskGroup { discardingGroup in
|
|
discardingGroup.addTask {
|
|
()
|
|
}
|
|
}
|
|
|
|
try await withThrowingDiscardingTaskGroup { throwingDiscardingGroup in
|
|
throwingDiscardingGroup.addTask {
|
|
()
|
|
}
|
|
}
|
|
}
|
|
}
|