@@ -133,28 +133,28 @@ func testReturn2() -> Int {
133133
134134func tryDo1( ) -> Int {
135135 try do { 0 }
136- // expected-error @-1 {{'try' may not be used on 'do' expression}}
136+ // expected-warning @-1 {{'try' has no effect on 'do' expression}}
137137}
138138
139139func tryDo2( ) -> Int {
140140 let x = try do { 0 }
141- // expected-error @-1 {{'try' may not be used on 'do' expression}}
141+ // expected-warning @-1 {{'try' has no effect on 'do' expression}}
142142 return x
143143}
144144
145145func tryDo3( ) -> Int {
146146 return try do { 0 }
147- // expected-error @-1 {{'try' may not be used on 'do' expression}}
147+ // expected-warning @-1 {{'try' has no effect on 'do' expression}}
148148}
149149
150150func tryDo4( ) throws -> Int {
151151 return try do { 0 }
152- // expected-error @-1 {{'try' may not be used on 'do' expression}}
152+ // expected-warning @-1 {{'try' has no effect on 'do' expression}}
153153}
154154
155155func tryDo5( ) throws -> Int {
156156 return try do { tryDo4 ( ) }
157- // expected-error @-1 {{'try' may not be used on 'do' expression}}
157+ // expected-warning @-1 {{'try' has no effect on 'do' expression}}
158158 // expected-error@-2 {{call can throw but is not marked with 'try'}}
159159 // expected-note@-3 {{did you mean to use 'try'?}}
160160 // expected-note@-4 {{did you mean to handle error as optional value?}}
@@ -163,7 +163,7 @@ func tryDo5() throws -> Int {
163163
164164func tryDo6( ) throws -> Int {
165165 try do { tryDo4 ( ) }
166- // expected-error @-1 {{'try' may not be used on 'do' expression}}
166+ // expected-warning @-1 {{'try' has no effect on 'do' expression}}
167167 // expected-error@-2 {{call can throw but is not marked with 'try'}}
168168 // expected-note@-3 {{did you mean to use 'try'?}}
169169 // expected-note@-4 {{did you mean to handle error as optional value?}}
@@ -172,7 +172,7 @@ func tryDo6() throws -> Int {
172172
173173func tryDo7( ) throws -> Int {
174174 let x = try do { tryDo4 ( ) }
175- // expected-error @-1 {{'try' may not be used on 'do' expression}}
175+ // expected-warning @-1 {{'try' has no effect on 'do' expression}}
176176 // expected-error@-2 {{call can throw but is not marked with 'try'}}
177177 // expected-note@-3 {{did you mean to use 'try'?}}
178178 // expected-note@-4 {{did you mean to handle error as optional value?}}
@@ -182,23 +182,23 @@ func tryDo7() throws -> Int {
182182
183183func tryDo8( ) throws -> Int {
184184 return try do { try tryDo4 ( ) }
185- // expected-error @-1 {{'try' may not be used on 'do' expression}}
185+ // expected-warning @-1 {{'try' has no effect on 'do' expression}}
186186}
187187
188188func tryDo9( ) throws -> Int {
189189 try do { try tryDo4 ( ) }
190- // expected-error @-1 {{'try' may not be used on 'do' expression}}
190+ // expected-warning @-1 {{'try' has no effect on 'do' expression}}
191191}
192192
193193func tryDo10( ) throws -> Int {
194194 let x = try do { try tryDo4 ( ) }
195- // expected-error @-1 {{'try' may not be used on 'do' expression}}
195+ // expected-warning @-1 {{'try' has no effect on 'do' expression}}
196196 return x
197197}
198198
199199func tryDo11( ) throws -> Int {
200200 let x = try do { try tryDo4 ( ) } catch { tryDo4 ( ) }
201- // expected-error @-1 {{'try' may not be used on 'do-catch' expression}}
201+ // expected-warning @-1 {{'try' has no effect on 'do-catch' expression}}
202202 // expected-error@-2 {{call can throw but is not marked with 'try'}}
203203 // expected-note@-3 {{did you mean to use 'try'?}}
204204 // expected-note@-4 {{did you mean to handle error as optional value?}}
@@ -208,7 +208,7 @@ func tryDo11() throws -> Int {
208208
209209func tryDo12( ) throws -> Int {
210210 let x = try do { tryDo4 ( ) } catch { tryDo4 ( ) }
211- // expected-error @-1 {{'try' may not be used on 'do-catch' expression}}
211+ // expected-warning @-1 {{'try' has no effect on 'do-catch' expression}}
212212 // expected-error@-2 2{{call can throw but is not marked with 'try'}}
213213 // expected-note@-3 2{{did you mean to use 'try'?}}
214214 // expected-note@-4 2{{did you mean to handle error as optional value?}}
@@ -217,7 +217,7 @@ func tryDo12() throws -> Int {
217217}
218218
219219func tryDo13( ) throws -> Int {
220- let x = try do { // expected-error {{'try' may not be used on 'do-catch' expression}}
220+ let x = try do { // expected-warning {{'try' has no effect on 'do-catch' expression}}
221221 tryDo4 ( ) // expected-warning {{result of call to 'tryDo4()' is unused}}
222222 // expected-error@-1 {{call can throw but is not marked with 'try'}}
223223 // expected-note@-2 {{did you mean to use 'try'?}}
@@ -251,13 +251,13 @@ func throwsBool() throws -> Bool { true }
251251
252252func tryDo14( ) throws -> Int {
253253 try do { try tryDo4 ( ) } catch _ where throw sBool( ) { 0 } catch { 1 }
254- // expected-error @-1 {{'try' may not be used on 'do-catch' expression}}
254+ // expected-warning @-1 {{'try' has no effect on 'do-catch' expression}}
255255 // expected-error@-2 {{call can throw, but errors cannot be thrown out of a catch guard expression}}
256256}
257257
258258func tryDo15( ) throws -> Int {
259259 try do { try tryDo4 ( ) } catch _ where try throwsBool ( ) { 1 } catch { 1 }
260- // expected-error @-1 {{'try' may not be used on 'do-catch' expression}}
260+ // expected-warning @-1 {{'try' has no effect on 'do-catch' expression}}
261261 // expected-error@-2 {{call can throw, but errors cannot be thrown out of a catch guard expression}}
262262}
263263
@@ -387,12 +387,12 @@ func tryDo30(_ fn: () throws -> Int) rethrows -> Int {
387387
388388func awaitDo1( ) async -> Int {
389389 await do { 0 }
390- // expected-error @-1 {{'await' may not be used on 'do' expression}}
390+ // expected-warning @-1 {{'await' has no effect on 'do' expression}}
391391}
392392
393393func awaitDo2( ) async -> Int {
394394 let x = await do { 0 }
395- // expected-error @-1 {{'await' may not be used on 'do' expression}}
395+ // expected-warning @-1 {{'await' has no effect on 'do' expression}}
396396 return x
397397}
398398
@@ -403,65 +403,65 @@ func awaitDo3() -> Int { // expected-note {{add 'async' to function 'awaitDo3()'
403403
404404func awaitDo4( ) async -> Int {
405405 return await do { 0 }
406- // expected-error @-1 {{'await' may not be used on 'do' expression}}
406+ // expected-warning @-1 {{'await' has no effect on 'do' expression}}
407407}
408408
409409func awaitDo5( ) async -> Int {
410410 return await do { awaitDo4 ( ) }
411- // expected-error @-1 {{'await' may not be used on 'do' expression}}
411+ // expected-warning @-1 {{'await' has no effect on 'do' expression}}
412412 // expected-error@-2 {{expression is 'async' but is not marked with 'await'}}
413413 // expected-note@-3 {{call is 'async'}}
414414}
415415
416416func awaitDo6( ) async -> Int {
417417 await do { awaitDo4 ( ) }
418- // expected-error @-1 {{'await' may not be used on 'do' expression}}
418+ // expected-warning @-1 {{'await' has no effect on 'do' expression}}
419419 // expected-error@-2 {{expression is 'async' but is not marked with 'await'}}
420420 // expected-note@-3 {{call is 'async'}}
421421}
422422
423423func awaitDo7( ) async -> Int {
424424 let x = await do { awaitDo4 ( ) }
425- // expected-error @-1 {{'await' may not be used on 'do' expression}}
425+ // expected-warning @-1 {{'await' has no effect on 'do' expression}}
426426 // expected-error@-2 {{expression is 'async' but is not marked with 'await'}}
427427 // expected-note@-3 {{call is 'async'}}
428428 return x
429429}
430430
431431func awaitDo8( ) async -> Int {
432432 return await do { await awaitDo4 ( ) }
433- // expected-error @-1 {{'await' may not be used on 'do' expression}}
433+ // expected-warning @-1 {{'await' has no effect on 'do' expression}}
434434}
435435
436436func awaitDo9( ) async -> Int {
437437 await do { await awaitDo4 ( ) }
438- // expected-error @-1 {{'await' may not be used on 'do' expression}}
438+ // expected-warning @-1 {{'await' has no effect on 'do' expression}}
439439}
440440
441441func awaitDo10( ) async -> Int {
442442 let x = await do { await awaitDo4 ( ) }
443- // expected-error @-1 {{'await' may not be used on 'do' expression}}
443+ // expected-warning @-1 {{'await' has no effect on 'do' expression}}
444444 return x
445445}
446446
447447func awaitDo11( ) async -> Int {
448448 let x = await do { try await tryAwaitDo1 ( ) } catch { awaitDo4 ( ) }
449- // expected-error @-1 {{'await' may not be used on 'do-catch' expression}}
449+ // expected-warning @-1 {{'await' has no effect on 'do-catch' expression}}
450450 // expected-error@-2 {{expression is 'async' but is not marked with 'await'}}
451451 // expected-note@-3 {{call is 'async'}}
452452 return x
453453}
454454
455455func awaitDo12( ) async -> Int {
456456 let x = await do { try tryAwaitDo1 ( ) } catch { awaitDo4 ( ) }
457- // expected-error @-1 {{'await' may not be used on 'do-catch' expression}}
457+ // expected-warning @-1 {{'await' has no effect on 'do-catch' expression}}
458458 // expected-error@-2 2{{expression is 'async' but is not marked with 'await'}}
459459 // expected-note@-3 2{{call is 'async'}}
460460 return x
461461}
462462
463463func awaitDo13( ) async throws -> Int {
464- let x = await do { // expected-error {{'await' may not be used on 'do-catch' expression}}
464+ let x = await do { // expected-warning {{'await' has no effect on 'do-catch' expression}}
465465 awaitDo4 ( ) // expected-warning {{result of call to 'awaitDo4()' is unused}}
466466 // expected-error@-1 {{expression is 'async' but is not marked with 'await'}}
467467 // expected-note@-2 {{call is 'async'}}
@@ -491,13 +491,13 @@ func asyncBool() async -> Bool { true }
491491
492492func awaitDo14( ) async -> Int {
493493 await do { try tryDo4 ( ) } catch _ where async Bool( ) { 0 } catch { 1 }
494- // expected-error @-1 {{'await' may not be used on 'do-catch' expression}}
494+ // expected-warning @-1 {{'await' has no effect on 'do-catch' expression}}
495495 // expected-error@-2 {{'async' call cannot occur in a catch guard expression}}
496496}
497497
498498func awaitDo15( ) async -> Int {
499499 await do { try tryDo4 ( ) } catch _ where await asyncBool ( ) { 0 } catch { 1 }
500- // expected-error @-1 {{'await' may not be used on 'do-catch' expression}}
500+ // expected-warning @-1 {{'await' has no effect on 'do-catch' expression}}
501501 // expected-error@-2 {{'async' call cannot occur in a catch guard expression}}
502502}
503503
@@ -529,20 +529,20 @@ func awaitDo20() async -> Int {
529529
530530func tryAwaitDo1( ) async throws -> Int {
531531 try await do { 0 }
532- // expected-error @-1 {{'try' may not be used on 'do' expression}}
533- // expected-error @-2 {{'await' may not be used on 'do' expression}}
532+ // expected-warning @-1 {{'try' has no effect on 'do' expression}}
533+ // expected-warning @-2 {{'await' has no effect on 'do' expression}}
534534}
535535
536536func tryAwaitDo2( ) async throws -> Int {
537537 try await do { 0 } as Int
538- // expected-error @-1 {{'try' may not be used on 'do' expression}}
539- // expected-error @-2 {{'await' may not be used on 'do' expression}}
538+ // expected-warning @-1 {{'try' has no effect on 'do' expression}}
539+ // expected-warning @-2 {{'await' has no effect on 'do' expression}}
540540}
541541
542542func tryAwaitDo3( ) async throws -> Int {
543543 try await do { tryAwaitDo2 ( ) } as Int
544- // expected-error @-1 {{'try' may not be used on 'do' expression}}
545- // expected-error @-2 {{'await' may not be used on 'do' expression}}
544+ // expected-warning @-1 {{'try' has no effect on 'do' expression}}
545+ // expected-warning @-2 {{'await' has no effect on 'do' expression}}
546546 // expected-error@-3 {{call can throw but is not marked with 'try'}}
547547 // expected-note@-4 {{did you mean to use 'try'?}}
548548 // expected-note@-5 {{did you mean to handle error as optional value?}}
@@ -553,16 +553,16 @@ func tryAwaitDo3() async throws -> Int {
553553
554554func tryAwaitDo4( ) async throws -> Int {
555555 try await do { try tryAwaitDo2 ( ) } as Int
556- // expected-error @-1 {{'try' may not be used on 'do' expression}}
557- // expected-error @-2 {{'await' may not be used on 'do' expression}}
556+ // expected-warning @-1 {{'try' has no effect on 'do' expression}}
557+ // expected-warning @-2 {{'await' has no effect on 'do' expression}}
558558 // expected-error@-3 {{expression is 'async' but is not marked with 'await'}}
559559 // expected-note@-4 {{call is 'async'}}
560560}
561561
562562func tryAwaitDo5( ) async throws -> Int {
563563 try await do { await tryAwaitDo2 ( ) } as Int
564- // expected-error @-1 {{'try' may not be used on 'do' expression}}
565- // expected-error @-2 {{'await' may not be used on 'do' expression}}
564+ // expected-warning @-1 {{'try' has no effect on 'do' expression}}
565+ // expected-warning @-2 {{'await' has no effect on 'do' expression}}
566566 // expected-error@-3 {{call can throw but is not marked with 'try'}}
567567 // expected-note@-4 {{did you mean to use 'try'?}}
568568 // expected-note@-5 {{did you mean to handle error as optional value?}}
@@ -571,14 +571,14 @@ func tryAwaitDo5() async throws -> Int {
571571
572572func tryAwaitDo6( ) async throws -> Int {
573573 try await do { try await tryAwaitDo2 ( ) } as Int
574- // expected-error @-1 {{'try' may not be used on 'do' expression}}
575- // expected-error @-2 {{'await' may not be used on 'do' expression}}
574+ // expected-warning @-1 {{'try' has no effect on 'do' expression}}
575+ // expected-warning @-2 {{'await' has no effect on 'do' expression}}
576576}
577577
578578func tryAwaitDo7( ) async throws -> Int {
579579 try await do { tryAwaitDo2 ( ) }
580- // expected-error @-1 {{'try' may not be used on 'do' expression}}
581- // expected-error @-2 {{'await' may not be used on 'do' expression}}
580+ // expected-warning @-1 {{'try' has no effect on 'do' expression}}
581+ // expected-warning @-2 {{'await' has no effect on 'do' expression}}
582582 // expected-error@-3 {{call can throw but is not marked with 'try'}}
583583 // expected-note@-4 {{did you mean to use 'try'?}}
584584 // expected-note@-5 {{did you mean to handle error as optional value?}}
@@ -589,16 +589,16 @@ func tryAwaitDo7() async throws -> Int {
589589
590590func tryAwaitDo8( ) async throws -> Int {
591591 try await do { try tryAwaitDo2 ( ) }
592- // expected-error @-1 {{'try' may not be used on 'do' expression}}
593- // expected-error @-2 {{'await' may not be used on 'do' expression}}
592+ // expected-warning @-1 {{'try' has no effect on 'do' expression}}
593+ // expected-warning @-2 {{'await' has no effect on 'do' expression}}
594594 // expected-error@-3 {{expression is 'async' but is not marked with 'await'}}
595595 // expected-note@-4 {{call is 'async'}}
596596}
597597
598598func tryAwaitDo9( ) async throws -> Int {
599599 try await do { await tryAwaitDo2 ( ) }
600- // expected-error @-1 {{'try' may not be used on 'do' expression}}
601- // expected-error @-2 {{'await' may not be used on 'do' expression}}
600+ // expected-warning @-1 {{'try' has no effect on 'do' expression}}
601+ // expected-warning @-2 {{'await' has no effect on 'do' expression}}
602602 // expected-error@-3 {{call can throw but is not marked with 'try'}}
603603 // expected-note@-4 {{did you mean to use 'try'?}}
604604 // expected-note@-5 {{did you mean to handle error as optional value?}}
@@ -607,8 +607,8 @@ func tryAwaitDo9() async throws -> Int {
607607
608608func tryAwaitDo10( ) async throws -> Int {
609609 try await do { try await tryAwaitDo2 ( ) }
610- // expected-error @-1 {{'try' may not be used on 'do' expression}}
611- // expected-error @-2 {{'await' may not be used on 'do' expression}}
610+ // expected-warning @-1 {{'try' has no effect on 'do' expression}}
611+ // expected-warning @-2 {{'await' has no effect on 'do' expression}}
612612}
613613
614614func tryAwaitDo11( _ fn: ( ) async throws -> Int ) async rethrows -> Int {
0 commit comments