@@ -133,28 +133,28 @@ func testReturn2() -> Int {
133
133
134
134
func tryDo1( ) -> Int {
135
135
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}}
137
137
}
138
138
139
139
func tryDo2( ) -> Int {
140
140
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}}
142
142
return x
143
143
}
144
144
145
145
func tryDo3( ) -> Int {
146
146
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}}
148
148
}
149
149
150
150
func tryDo4( ) throws -> Int {
151
151
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}}
153
153
}
154
154
155
155
func tryDo5( ) throws -> Int {
156
156
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}}
158
158
// expected-error@-2 {{call can throw but is not marked with 'try'}}
159
159
// expected-note@-3 {{did you mean to use 'try'?}}
160
160
// expected-note@-4 {{did you mean to handle error as optional value?}}
@@ -163,7 +163,7 @@ func tryDo5() throws -> Int {
163
163
164
164
func tryDo6( ) throws -> Int {
165
165
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}}
167
167
// expected-error@-2 {{call can throw but is not marked with 'try'}}
168
168
// expected-note@-3 {{did you mean to use 'try'?}}
169
169
// expected-note@-4 {{did you mean to handle error as optional value?}}
@@ -172,7 +172,7 @@ func tryDo6() throws -> Int {
172
172
173
173
func tryDo7( ) throws -> Int {
174
174
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}}
176
176
// expected-error@-2 {{call can throw but is not marked with 'try'}}
177
177
// expected-note@-3 {{did you mean to use 'try'?}}
178
178
// expected-note@-4 {{did you mean to handle error as optional value?}}
@@ -182,23 +182,23 @@ func tryDo7() throws -> Int {
182
182
183
183
func tryDo8( ) throws -> Int {
184
184
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}}
186
186
}
187
187
188
188
func tryDo9( ) throws -> Int {
189
189
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}}
191
191
}
192
192
193
193
func tryDo10( ) throws -> Int {
194
194
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}}
196
196
return x
197
197
}
198
198
199
199
func tryDo11( ) throws -> Int {
200
200
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}}
202
202
// expected-error@-2 {{call can throw but is not marked with 'try'}}
203
203
// expected-note@-3 {{did you mean to use 'try'?}}
204
204
// expected-note@-4 {{did you mean to handle error as optional value?}}
@@ -208,7 +208,7 @@ func tryDo11() throws -> Int {
208
208
209
209
func tryDo12( ) throws -> Int {
210
210
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}}
212
212
// expected-error@-2 2{{call can throw but is not marked with 'try'}}
213
213
// expected-note@-3 2{{did you mean to use 'try'?}}
214
214
// expected-note@-4 2{{did you mean to handle error as optional value?}}
@@ -217,7 +217,7 @@ func tryDo12() throws -> Int {
217
217
}
218
218
219
219
func 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}}
221
221
tryDo4 ( ) // expected-warning {{result of call to 'tryDo4()' is unused}}
222
222
// expected-error@-1 {{call can throw but is not marked with 'try'}}
223
223
// expected-note@-2 {{did you mean to use 'try'?}}
@@ -251,13 +251,13 @@ func throwsBool() throws -> Bool { true }
251
251
252
252
func tryDo14( ) throws -> Int {
253
253
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}}
255
255
// expected-error@-2 {{call can throw, but errors cannot be thrown out of a catch guard expression}}
256
256
}
257
257
258
258
func tryDo15( ) throws -> Int {
259
259
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}}
261
261
// expected-error@-2 {{call can throw, but errors cannot be thrown out of a catch guard expression}}
262
262
}
263
263
@@ -387,12 +387,12 @@ func tryDo30(_ fn: () throws -> Int) rethrows -> Int {
387
387
388
388
func awaitDo1( ) async -> Int {
389
389
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}}
391
391
}
392
392
393
393
func awaitDo2( ) async -> Int {
394
394
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}}
396
396
return x
397
397
}
398
398
@@ -403,65 +403,65 @@ func awaitDo3() -> Int { // expected-note {{add 'async' to function 'awaitDo3()'
403
403
404
404
func awaitDo4( ) async -> Int {
405
405
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}}
407
407
}
408
408
409
409
func awaitDo5( ) async -> Int {
410
410
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}}
412
412
// expected-error@-2 {{expression is 'async' but is not marked with 'await'}}
413
413
// expected-note@-3 {{call is 'async'}}
414
414
}
415
415
416
416
func awaitDo6( ) async -> Int {
417
417
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}}
419
419
// expected-error@-2 {{expression is 'async' but is not marked with 'await'}}
420
420
// expected-note@-3 {{call is 'async'}}
421
421
}
422
422
423
423
func awaitDo7( ) async -> Int {
424
424
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}}
426
426
// expected-error@-2 {{expression is 'async' but is not marked with 'await'}}
427
427
// expected-note@-3 {{call is 'async'}}
428
428
return x
429
429
}
430
430
431
431
func awaitDo8( ) async -> Int {
432
432
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}}
434
434
}
435
435
436
436
func awaitDo9( ) async -> Int {
437
437
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}}
439
439
}
440
440
441
441
func awaitDo10( ) async -> Int {
442
442
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}}
444
444
return x
445
445
}
446
446
447
447
func awaitDo11( ) async -> Int {
448
448
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}}
450
450
// expected-error@-2 {{expression is 'async' but is not marked with 'await'}}
451
451
// expected-note@-3 {{call is 'async'}}
452
452
return x
453
453
}
454
454
455
455
func awaitDo12( ) async -> Int {
456
456
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}}
458
458
// expected-error@-2 2{{expression is 'async' but is not marked with 'await'}}
459
459
// expected-note@-3 2{{call is 'async'}}
460
460
return x
461
461
}
462
462
463
463
func 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}}
465
465
awaitDo4 ( ) // expected-warning {{result of call to 'awaitDo4()' is unused}}
466
466
// expected-error@-1 {{expression is 'async' but is not marked with 'await'}}
467
467
// expected-note@-2 {{call is 'async'}}
@@ -491,13 +491,13 @@ func asyncBool() async -> Bool { true }
491
491
492
492
func awaitDo14( ) async -> Int {
493
493
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}}
495
495
// expected-error@-2 {{'async' call cannot occur in a catch guard expression}}
496
496
}
497
497
498
498
func awaitDo15( ) async -> Int {
499
499
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}}
501
501
// expected-error@-2 {{'async' call cannot occur in a catch guard expression}}
502
502
}
503
503
@@ -529,20 +529,20 @@ func awaitDo20() async -> Int {
529
529
530
530
func tryAwaitDo1( ) async throws -> Int {
531
531
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}}
534
534
}
535
535
536
536
func tryAwaitDo2( ) async throws -> Int {
537
537
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}}
540
540
}
541
541
542
542
func tryAwaitDo3( ) async throws -> Int {
543
543
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}}
546
546
// expected-error@-3 {{call can throw but is not marked with 'try'}}
547
547
// expected-note@-4 {{did you mean to use 'try'?}}
548
548
// expected-note@-5 {{did you mean to handle error as optional value?}}
@@ -553,16 +553,16 @@ func tryAwaitDo3() async throws -> Int {
553
553
554
554
func tryAwaitDo4( ) async throws -> Int {
555
555
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}}
558
558
// expected-error@-3 {{expression is 'async' but is not marked with 'await'}}
559
559
// expected-note@-4 {{call is 'async'}}
560
560
}
561
561
562
562
func tryAwaitDo5( ) async throws -> Int {
563
563
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}}
566
566
// expected-error@-3 {{call can throw but is not marked with 'try'}}
567
567
// expected-note@-4 {{did you mean to use 'try'?}}
568
568
// expected-note@-5 {{did you mean to handle error as optional value?}}
@@ -571,14 +571,14 @@ func tryAwaitDo5() async throws -> Int {
571
571
572
572
func tryAwaitDo6( ) async throws -> Int {
573
573
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}}
576
576
}
577
577
578
578
func tryAwaitDo7( ) async throws -> Int {
579
579
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}}
582
582
// expected-error@-3 {{call can throw but is not marked with 'try'}}
583
583
// expected-note@-4 {{did you mean to use 'try'?}}
584
584
// expected-note@-5 {{did you mean to handle error as optional value?}}
@@ -589,16 +589,16 @@ func tryAwaitDo7() async throws -> Int {
589
589
590
590
func tryAwaitDo8( ) async throws -> Int {
591
591
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}}
594
594
// expected-error@-3 {{expression is 'async' but is not marked with 'await'}}
595
595
// expected-note@-4 {{call is 'async'}}
596
596
}
597
597
598
598
func tryAwaitDo9( ) async throws -> Int {
599
599
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}}
602
602
// expected-error@-3 {{call can throw but is not marked with 'try'}}
603
603
// expected-note@-4 {{did you mean to use 'try'?}}
604
604
// expected-note@-5 {{did you mean to handle error as optional value?}}
@@ -607,8 +607,8 @@ func tryAwaitDo9() async throws -> Int {
607
607
608
608
func tryAwaitDo10( ) async throws -> Int {
609
609
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}}
612
612
}
613
613
614
614
func tryAwaitDo11( _ fn: ( ) async throws -> Int ) async rethrows -> Int {
0 commit comments