@@ -15,9 +15,9 @@ func foo1(_ completion: @escaping () -> Void) {}
1515// FOO1-EMPTY:
1616// FOO1-NEXT: convert_async_wrapper.swift [[# @LINE-8]]:49 -> [[# @LINE-8]]:49
1717// FOO1-NEXT: func foo1() async {
18- // FOO1-NEXT: return await withCheckedContinuation { cont in
18+ // FOO1-NEXT: return await withCheckedContinuation { continuation in
1919// FOO1-NEXT: foo1() {
20- // FOO1-NEXT: cont .resume(returning: ())
20+ // FOO1-NEXT: continuation .resume(returning: ())
2121// FOO1-NEXT: }
2222// FOO1-NEXT: }
2323// FOO1-NEXT: }
@@ -33,9 +33,9 @@ func foo2(arg: String, _ completion: @escaping (String) -> Void) {}
3333// FOO2-EMPTY:
3434// FOO2-NEXT: convert_async_wrapper.swift [[# @LINE-8]]:68 -> [[# @LINE-8]]:68
3535// FOO2: func foo2(arg: String) async -> String {
36- // FOO2-NEXT: return await withCheckedContinuation { cont in
37- // FOO2-NEXT: foo2(arg: arg) { res in
38- // FOO2-NEXT: cont .resume(returning: res )
36+ // FOO2-NEXT: return await withCheckedContinuation { continuation in
37+ // FOO2-NEXT: foo2(arg: arg) { result in
38+ // FOO2-NEXT: continuation .resume(returning: result )
3939// FOO2-NEXT: }
4040// FOO2-NEXT: }
4141// FOO2-NEXT: }
@@ -44,9 +44,9 @@ func foo2(arg: String, _ completion: @escaping (String) -> Void) {}
4444func foo3( arg: String , _ arg2: Int , _ completion: @escaping ( String ? ) -> Void ) { }
4545
4646// FOO3: func foo3(arg: String, _ arg2: Int) async -> String? {
47- // FOO3-NEXT: return await withCheckedContinuation { cont in
48- // FOO3-NEXT: foo3(arg: arg, arg2) { res in
49- // FOO3-NEXT: cont .resume(returning: res )
47+ // FOO3-NEXT: return await withCheckedContinuation { continuation in
48+ // FOO3-NEXT: foo3(arg: arg, arg2) { result in
49+ // FOO3-NEXT: continuation .resume(returning: result )
5050// FOO3-NEXT: }
5151// FOO3-NEXT: }
5252// FOO3-NEXT: }
@@ -55,13 +55,13 @@ func foo3(arg: String, _ arg2: Int, _ completion: @escaping (String?) -> Void) {
5555func foo4( _ completion: @escaping ( Error ? ) -> Void ) { }
5656
5757// FOO4: func foo4() async throws {
58- // FOO4-NEXT: return try await withCheckedThrowingContinuation { cont in
59- // FOO4-NEXT: foo4() { err in
60- // FOO4-NEXT: if let err = err {
61- // FOO4-NEXT: cont .resume(throwing: err )
58+ // FOO4-NEXT: return try await withCheckedThrowingContinuation { continuation in
59+ // FOO4-NEXT: foo4() { error in
60+ // FOO4-NEXT: if let error = error {
61+ // FOO4-NEXT: continuation .resume(throwing: error )
6262// FOO4-NEXT: return
6363// FOO4-NEXT: }
64- // FOO4-NEXT: cont .resume(returning: ())
64+ // FOO4-NEXT: continuation .resume(returning: ())
6565// FOO4-NEXT: }
6666// FOO4-NEXT: }
6767// FOO4-NEXT: }
@@ -71,9 +71,9 @@ func foo4(_ completion: @escaping (Error?) -> Void) {}
7171func foo5( _ completion: @escaping ( Error ) -> Void ) { }
7272
7373// FOO5: func foo5() async -> Error {
74- // FOO5-NEXT: return await withCheckedContinuation { cont in
75- // FOO5-NEXT: foo5() { res in
76- // FOO5-NEXT: cont .resume(returning: res )
74+ // FOO5-NEXT: return await withCheckedContinuation { continuation in
75+ // FOO5-NEXT: foo5() { result in
76+ // FOO5-NEXT: continuation .resume(returning: result )
7777// FOO5-NEXT: }
7878// FOO5-NEXT: }
7979// FOO5-NEXT: }
@@ -82,16 +82,17 @@ func foo5(_ completion: @escaping (Error) -> Void) {}
8282func foo6( _ completion: @escaping ( String ? , Error ? ) -> Void ) { }
8383
8484// FOO6: func foo6() async throws -> String {
85- // FOO6-NEXT: return try await withCheckedThrowingContinuation { cont in
86- // FOO6-NEXT: foo6() { res, err in
87- // FOO6-NEXT: if let err = err {
88- // FOO6-NEXT: cont.resume(throwing: err)
85+ // FOO6-NEXT: return try await withCheckedThrowingContinuation { continuation in
86+ // FOO6-NEXT: foo6() { result, error in
87+ // FOO6-NEXT: if let error = error {
88+ // FOO6-NEXT: assert(result == nil, "Expected nil success param 'result' for non-nil error")
89+ // FOO6-NEXT: continuation.resume(throwing: error)
8990// FOO6-NEXT: return
9091// FOO6-NEXT: }
91- // FOO6-NEXT: guard let res = res else {
92- // FOO6-NEXT: fatalError("Expected non-nil success param 'res ' for nil error")
92+ // FOO6-NEXT: guard let result = result else {
93+ // FOO6-NEXT: fatalError("Expected non-nil success param 'result ' for nil error")
9394// FOO6-NEXT: }
94- // FOO6-NEXT: cont .resume(returning: res )
95+ // FOO6-NEXT: continuation .resume(returning: result )
9596// FOO6-NEXT: }
9697// FOO6-NEXT: }
9798// FOO6-NEXT: }
@@ -100,16 +101,17 @@ func foo6(_ completion: @escaping (String?, Error?) -> Void) {}
100101func foo7( _ completion: @escaping ( String ? , Int , Error ? ) -> Void ) { }
101102
102103// FOO7: func foo7() async throws -> (String, Int) {
103- // FOO7-NEXT: return try await withCheckedThrowingContinuation { cont in
104- // FOO7-NEXT: foo7() { res1, res2, err in
105- // FOO7-NEXT: if let err = err {
106- // FOO7-NEXT: cont.resume(throwing: err)
104+ // FOO7-NEXT: return try await withCheckedThrowingContinuation { continuation in
105+ // FOO7-NEXT: foo7() { result1, result2, error in
106+ // FOO7-NEXT: if let error = error {
107+ // FOO7-NEXT: assert(result1 == nil, "Expected nil success param 'result1' for non-nil error")
108+ // FOO7-NEXT: continuation.resume(throwing: error)
107109// FOO7-NEXT: return
108110// FOO7-NEXT: }
109- // FOO7-NEXT: guard let res1 = res1 else {
110- // FOO7-NEXT: fatalError("Expected non-nil success param 'res1 ' for nil error")
111+ // FOO7-NEXT: guard let result1 = result1 else {
112+ // FOO7-NEXT: fatalError("Expected non-nil success param 'result1 ' for nil error")
111113// FOO7-NEXT: }
112- // FOO7-NEXT: cont .resume(returning: (res1, res2 ))
114+ // FOO7-NEXT: continuation .resume(returning: (result1, result2 ))
113115// FOO7-NEXT: }
114116// FOO7-NEXT: }
115117// FOO7-NEXT: }
@@ -118,19 +120,21 @@ func foo7(_ completion: @escaping (String?, Int, Error?) -> Void) {}
118120func foo8( _ completion: @escaping ( String ? , Int ? , Error ? ) -> Void ) { }
119121
120122// FOO8: func foo8() async throws -> (String, Int) {
121- // FOO8-NEXT: return try await withCheckedThrowingContinuation { cont in
122- // FOO8-NEXT: foo8() { res1, res2, err in
123- // FOO8-NEXT: if let err = err {
124- // FOO8-NEXT: cont.resume(throwing: err)
123+ // FOO8-NEXT: return try await withCheckedThrowingContinuation { continuation in
124+ // FOO8-NEXT: foo8() { result1, result2, error in
125+ // FOO8-NEXT: if let error = error {
126+ // FOO8-NEXT: assert(result1 == nil, "Expected nil success param 'result1' for non-nil error")
127+ // FOO8-NEXT: assert(result2 == nil, "Expected nil success param 'result2' for non-nil error")
128+ // FOO8-NEXT: continuation.resume(throwing: error)
125129// FOO8-NEXT: return
126130// FOO8-NEXT: }
127- // FOO8-NEXT: guard let res1 = res1 else {
128- // FOO8-NEXT: fatalError("Expected non-nil success param 'res1 ' for nil error")
131+ // FOO8-NEXT: guard let result1 = result1 else {
132+ // FOO8-NEXT: fatalError("Expected non-nil success param 'result1 ' for nil error")
129133// FOO8-NEXT: }
130- // FOO8-NEXT: guard let res2 = res2 else {
131- // FOO8-NEXT: fatalError("Expected non-nil success param 'res2 ' for nil error")
134+ // FOO8-NEXT: guard let result2 = result2 else {
135+ // FOO8-NEXT: fatalError("Expected non-nil success param 'result2 ' for nil error")
132136// FOO8-NEXT: }
133- // FOO8-NEXT: cont .resume(returning: (res1, res2 ))
137+ // FOO8-NEXT: continuation .resume(returning: (result1, result2 ))
134138// FOO8-NEXT: }
135139// FOO8-NEXT: }
136140// FOO8-NEXT: }
@@ -139,9 +143,9 @@ func foo8(_ completion: @escaping (String?, Int?, Error?) -> Void) {}
139143func foo9( _ completion: @escaping ( Result < String , Error > ) -> Void ) { }
140144
141145// FOO9: func foo9() async throws -> String {
142- // FOO9-NEXT: return try await withCheckedThrowingContinuation { cont in
143- // FOO9-NEXT: foo9() { res in
144- // FOO9-NEXT: cont .resume(with: res )
146+ // FOO9-NEXT: return try await withCheckedThrowingContinuation { continuation in
147+ // FOO9-NEXT: foo9() { result in
148+ // FOO9-NEXT: continuation .resume(with: result )
145149// FOO9-NEXT: }
146150// FOO9-NEXT: }
147151// FOO9-NEXT: }
@@ -150,9 +154,9 @@ func foo9(_ completion: @escaping (Result<String, Error>) -> Void) {}
150154func foo10( arg: Int , _ completion: @escaping ( Result < ( String , Int ) , Error > ) -> Void ) { }
151155
152156// FOO10: func foo10(arg: Int) async throws -> (String, Int) {
153- // FOO10-NEXT: return try await withCheckedThrowingContinuation { cont in
154- // FOO10-NEXT: foo10(arg: arg) { res in
155- // FOO10-NEXT: cont .resume(with: res )
157+ // FOO10-NEXT: return try await withCheckedThrowingContinuation { continuation in
158+ // FOO10-NEXT: foo10(arg: arg) { result in
159+ // FOO10-NEXT: continuation .resume(with: result )
156160// FOO10-NEXT: }
157161// FOO10-NEXT: }
158162// FOO10-NEXT: }
@@ -161,9 +165,9 @@ func foo10(arg: Int, _ completion: @escaping (Result<(String, Int), Error>) -> V
161165func foo11( completion: @escaping ( Result < String , Never > ) -> Void ) { }
162166
163167// FOO11: func foo11() async -> String {
164- // FOO11-NEXT: return await withCheckedContinuation { cont in
165- // FOO11-NEXT: foo11() { res in
166- // FOO11-NEXT: cont .resume(with: res )
168+ // FOO11-NEXT: return await withCheckedContinuation { continuation in
169+ // FOO11-NEXT: foo11() { result in
170+ // FOO11-NEXT: continuation .resume(with: result )
167171// FOO11-NEXT: }
168172// FOO11-NEXT: }
169173// FOO11-NEXT: }
@@ -172,9 +176,9 @@ func foo11(completion: @escaping (Result<String, Never>) -> Void) {}
172176func foo12( completion: @escaping ( Result < String , CustomError > ) -> Void ) { }
173177
174178// FOO12: func foo12() async throws -> String {
175- // FOO12-NEXT: return try await withCheckedThrowingContinuation { cont in
176- // FOO12-NEXT: foo12() { res in
177- // FOO12-NEXT: cont .resume(with: res )
179+ // FOO12-NEXT: return try await withCheckedThrowingContinuation { continuation in
180+ // FOO12-NEXT: foo12() { result in
181+ // FOO12-NEXT: continuation .resume(with: result )
178182// FOO12-NEXT: }
179183// FOO12-NEXT: }
180184// FOO12-NEXT: }
0 commit comments