Skip to content

Commit 3e11ede

Browse files
committed
Update test case for withUnsafe(Throwing)Continuation.
1 parent 1a15eb1 commit 3e11ede

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

test/Concurrency/async_tasks.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func buyVegetables(
2626

2727
// returns 1 or more vegetables or throws an error
2828
func buyVegetables(shoppingList: [String]) async throws -> [Vegetable] {
29-
await try Task.withUnsafeThrowingContinuation { continuation in
29+
await try withUnsafeThrowingContinuation { continuation in
3030
var veggies: [Vegetable] = []
3131

3232
buyVegetables(
@@ -43,22 +43,22 @@ func buyVegetables(shoppingList: [String]) async throws -> [Vegetable] {
4343
func test_unsafeContinuations() async {
4444
// the closure should not allow async operations;
4545
// after all: if you have async code, just call it directly, without the unsafe continuation
46-
let _: String = Task.withUnsafeContinuation { continuation in // expected-error{{invalid conversion from 'async' function of type '(UnsafeContinuation<String>) async -> Void' to synchronous function type '(UnsafeContinuation<String>) -> Void'}}
46+
let _: String = withUnsafeContinuation { continuation in // expected-error{{invalid conversion from 'async' function of type '(UnsafeContinuation<String>) async -> Void' to synchronous function type '(UnsafeContinuation<String>) -> Void'}}
4747
let s = await someAsyncFunc() // rdar://70610141 for getting a better error message here
4848
continuation.resume(returning: s)
4949
}
5050

51-
let _: String = await Task.withUnsafeContinuation { continuation in
51+
let _: String = await withUnsafeContinuation { continuation in
5252
continuation.resume(returning: "")
5353
}
5454
}
5555

5656
func test_unsafeThrowingContinuations() async {
57-
let _: String = await try Task.withUnsafeThrowingContinuation { continuation in
57+
let _: String = await try withUnsafeThrowingContinuation { continuation in
5858
continuation.resume(returning: "")
5959
}
6060

61-
let _: String = await try Task.withUnsafeThrowingContinuation { continuation in
61+
let _: String = await try withUnsafeThrowingContinuation { continuation in
6262
continuation.resume(throwing: MyError())
6363
}
6464

0 commit comments

Comments
 (0)