@@ -169,24 +169,25 @@ func someAsyncFunc() async {
169
169
170
170
_ = await a. deposit ( b. withdraw ( a. deposit ( b. withdraw ( b. balance ( ) ) ) ) )
171
171
172
- a. testSelfBalance ( ) // expected-error {{call is 'async' but is not marked with 'await'}}
172
+ // expected-error@+1 {{expression is 'async' but is not marked with 'await'}}{{3-3=await }} expected-note@+1 {{call is 'async'}}
173
+ a. testSelfBalance ( )
173
174
174
175
await a. testThrowing ( ) // expected-error {{call can throw, but it is not marked with 'try' and the error is not handled}}
175
176
176
177
////////////
177
178
// effectful properties from outside the actor instance
178
179
179
180
// expected-warning@+2 {{cannot use property 'effPropA' with a non-sendable type 'Box' across actors}}
180
- // expected-error@+1{{property access is 'async' but is not marked with 'await'}} {{7-7=await }}
181
+ // expected-error@+1{{expression is 'async' but is not marked with 'await'}} {{7-7=await }} expected-note@+1{{property access is 'async' }}
181
182
_ = a. effPropA
182
183
183
184
// expected-warning@+3 {{cannot use property 'effPropT' with a non-sendable type 'Box' across actors}}
184
185
// expected-error@+2{{property access can throw, but it is not marked with 'try' and the error is not handled}}
185
- // expected-error@+1{{property access is 'async' but is not marked with 'await'}} {{7-7=await }}
186
+ // expected-error@+1{{expression is 'async' but is not marked with 'await'}} {{7-7=await }} expected-note@+1{{property access is 'async' }}
186
187
_ = a. effPropT
187
188
188
189
// expected-error@+2{{property access can throw, but it is not marked with 'try' and the error is not handled}}
189
- // expected-error@+1{{property access is 'async' but is not marked with 'await'}} {{7-7=await }}
190
+ // expected-error@+1{{expression is 'async' but is not marked with 'await'}} {{7-7=await }} expected-note@+1{{property access is 'async' }}
190
191
_ = a. effPropAT
191
192
192
193
// (mostly) corrected ones
@@ -204,30 +205,35 @@ func someAsyncFunc() async {
204
205
205
206
extension BankAccount {
206
207
func totalBalance( including other: BankAccount ) async -> Int {
207
- return balance ( )
208
- + other. balance ( ) // expected-error{{call is 'async' but is not marked with 'await'}}
208
+ //expected-error@+1{{expression is 'async' but is not marked with 'await'}}{{12-12=await }}
209
+ return balance ( )
210
+ + other. balance ( ) // expected-note{{call is 'async'}}
209
211
}
210
212
211
213
func breakAccounts( other: BankAccount ) async {
212
- _ = other. deposit ( // expected-error{{call is 'async' but is not marked with 'await'}}
213
- other. withdraw ( // expected-error{{call is 'async' but is not marked with 'await'}}
214
+ // expected-error@+1{{expression is 'async' but is not marked with 'await'}}{{9-9=await }}
215
+ _ = other. deposit ( // expected-note{{call is 'async'}}
216
+ other. withdraw ( // expected-note{{call is 'async'}}
214
217
self . deposit (
215
- other. withdraw ( // expected-error {{call is 'async' but is not marked with 'await '}}
216
- other. balance ( ) ) ) ) ) // expected-error {{call is 'async' but is not marked with 'await '}}
218
+ other. withdraw ( // expected-note {{call is 'async'}}
219
+ other. balance ( ) ) ) ) ) // expected-note {{call is 'async'}}
217
220
}
218
221
}
219
222
220
223
func anotherAsyncFunc( ) async {
221
224
let a = BankAccount ( initialDeposit: 34 )
222
225
let b = BankAccount ( initialDeposit: 35 )
223
226
224
- _ = a. deposit ( 1 ) // expected-error{{call is 'async' but is not marked with 'await'}}
225
- _ = b. balance ( ) // expected-error{{call is 'async' but is not marked with 'await'}}
226
-
227
+ // expected-error@+1{{expression is 'async' but is not marked with 'await'}} {{7-7=await }} expected-note@+1{{call is 'async'}}
228
+ _ = a. deposit ( 1 )
229
+ // expected-error@+1{{expression is 'async' but is not marked with 'await'}} {{7-7=await }} expected-note@+1{{call is 'async'}}
230
+ _ = b. balance ( )
231
+
227
232
_ = b. balance // expected-error {{actor-isolated instance method 'balance()' can only be referenced from inside the actor}}
228
233
229
234
a. owner = " cat " // expected-error{{actor-isolated property 'owner' can only be mutated from inside the actor}}
230
- _ = b. owner // expected-error{{property access is 'async' but is not marked with 'await'}}
235
+ // expected-error@+1{{expression is 'async' but is not marked with 'await'}} {{7-7=await }} expected-note@+1{{property access is 'async'}}
236
+ _ = b. owner
231
237
_ = await b. owner == " cat "
232
238
233
239
@@ -313,17 +319,24 @@ actor Chain {
313
319
}
314
320
315
321
func walkChain( chain : Chain ) async {
316
- _ = chain. next? . next? . next? . next // expected-error 4 {{property access is 'async' but is not marked with 'await'}}
317
- _ = ( await chain. next) ? . next? . next? . next // expected-error 3 {{property access is 'async' but is not marked with 'await'}}
318
- _ = ( await chain. next? . next) ? . next? . next // expected-error 2 {{property access is 'async' but is not marked with 'await'}}
322
+
323
+ // expected-error@+1 {{expression is 'async' but is not marked with 'await'}}{{7-7=await }} expected-note@+1 4 {{property access is 'async'}}
324
+ _ = chain. next? . next? . next? . next
325
+ // expected-error@+1 {{expression is 'async' but is not marked with 'await'}}{{7-7=await }} expected-note@+1 3 {{property access is 'async'}}
326
+ _ = ( await chain. next) ? . next? . next? . next
327
+
328
+ // expected-error@+1 {{expression is 'async' but is not marked with 'await'}}{{7-7=await }} expected-note@+1 2 {{property access is 'async'}}
329
+ _ = ( await chain. next? . next) ? . next? . next
319
330
}
320
331
321
332
322
333
// want to make sure there is no note about implicitly async on this func.
323
334
@BananaActor func rice( ) async { }
324
335
325
336
@OrangeActor func quinoa( ) async {
326
- rice ( ) // expected-error {{call is 'async' but is not marked with 'await'}}
337
+
338
+ // expected-error@+1{{expression is 'async' but is not marked with 'await'}}{{3-3=await }} expected-note@+1 {{call is 'async'}}
339
+ rice ( )
327
340
}
328
341
329
342
///////////
@@ -449,21 +462,21 @@ func tryEffPropsFromSync() {
449
462
}
450
463
451
464
@OrangeActor func tryEffPropertiesFromGlobalActor( ) async throws {
452
- // expected-error@+1{{property access is 'async' but is not marked with 'await'}} {{7-7=await }}
465
+ // expected-error@+1{{expression is 'async' but is not marked with 'await'}}{{7-7=await }} expected-note@+1 {{property access is 'async' }}
453
466
_ = effPropA
454
467
455
468
// expected-note@+5{{did you mean to handle error as optional value?}}
456
469
// expected-note@+4{{did you mean to use 'try'?}}
457
470
// expected-note@+3{{did you mean to disable error propagation?}}
458
471
// expected-error@+2{{property access can throw but is not marked with 'try'}}
459
- // expected-error@+1{{property access is 'async' but is not marked with 'await'}} {{7-7=await }}
472
+ // expected-error@+1{{expression is 'async' but is not marked with 'await'}}{{7-7=await }} expected-note@+1 {{property access is 'async' }}
460
473
_ = effPropT
461
474
462
475
// expected-note@+5{{did you mean to handle error as optional value?}}
463
476
// expected-note@+4{{did you mean to use 'try'?}}
464
477
// expected-note@+3{{did you mean to disable error propagation?}}
465
478
// expected-error@+2{{property access can throw but is not marked with 'try'}}
466
- // expected-error@+1{{property access is 'async' but is not marked with 'await'}} {{7-7=await }}
479
+ // expected-error@+1{{expression is 'async' but is not marked with 'await'}}{{7-7=await }} expected-note@+1 {{property access is 'async' }}
467
480
_ = effPropAT
468
481
469
482
_ = await effPropA
@@ -484,7 +497,9 @@ actor SubscriptA {
484
497
}
485
498
486
499
func f( ) async {
487
- _ = self [ 0 ] // expected-error{{subscript access is 'async' but is not marked with 'await'}}
500
+
501
+ // expected-error@+1{{expression is 'async' but is not marked with 'await'}} {{9-9=await }} expected-note@+1{{subscript access is 'async'}}
502
+ _ = self [ 0 ]
488
503
}
489
504
}
490
505
@@ -532,15 +547,16 @@ actor SubscriptAT {
532
547
}
533
548
534
549
func tryTheActorSubscripts( a : SubscriptA , t : SubscriptT , at : SubscriptAT ) async throws {
535
- _ = a [ 0 ] // expected-error{{subscript access is 'async' but is not marked with 'await'}}
550
+ // expected-error@+1 {{expression is 'async' but is not marked with 'await'}}{{7-7=await }} expected-note@+1 {{subscript access is 'async'}}
551
+ _ = a [ 0 ]
536
552
537
553
_ = await a [ 0 ]
538
554
539
555
// expected-note@+5{{did you mean to handle error as optional value?}}
540
556
// expected-note@+4{{did you mean to use 'try'?}}
541
557
// expected-note@+3{{did you mean to disable error propagation?}}
542
558
// expected-error@+2{{subscript access can throw but is not marked with 'try'}}
543
- // expected-error@+1 {{subscript access is 'async' but is not marked with 'await'}}
559
+ // expected-error@+1 {{expression is 'async' but is not marked with 'await'}}{{7-7=await }} expected-note@+1 {{subscript access is 'async '}}
544
560
_ = t [ 0 ]
545
561
546
562
_ = try await t [ 0 ]
@@ -551,7 +567,7 @@ func tryTheActorSubscripts(a : SubscriptA, t : SubscriptT, at : SubscriptAT) asy
551
567
// expected-note@+4{{did you mean to use 'try'?}}
552
568
// expected-note@+3{{did you mean to disable error propagation?}}
553
569
// expected-error@+2{{subscript access can throw but is not marked with 'try'}}
554
- // expected-error@+1 {{subscript access is 'async' but is not marked with 'await'}}
570
+ // expected-error@+1 {{expression is 'async' but is not marked with 'await'}}{{7-7=await }} expected-note@+1 {{subscript access is 'async '}}
555
571
_ = at [ 0 ]
556
572
557
573
_ = try await at [ 0 ]
0 commit comments