Skip to content

Commit 3da0a54

Browse files
committed
Update tests
This patch updates all the tests to accept the new error messages. *Gack* so many things needed cleaning up.
1 parent fffedc7 commit 3da0a54

15 files changed

+252
-131
lines changed

test/ClangImporter/objc_async.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ func testSlowServer(slowServer: SlowServer) async throws {
2929

3030
// still async version...
3131
let _: Int = slowServer.doSomethingConflicted("thinking")
32-
// expected-error@-1{{call is 'async' but is not marked with 'await'}}{{16-16=await }}
32+
// expected-error@-1{{expression is 'async' but is not marked with 'await'}}{{16-16=await }}
33+
// expected-note@-2{{call is 'async'}}
3334

3435
let _: String? = try await slowServer.fortune()
3536
let _: Int = try await slowServer.magicNumber(withSeed: 42)

test/Concurrency/actor_call_implicitly_async.swift

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -169,24 +169,25 @@ func someAsyncFunc() async {
169169

170170
_ = await a.deposit(b.withdraw(a.deposit(b.withdraw(b.balance()))))
171171

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()
173174

174175
await a.testThrowing() // expected-error {{call can throw, but it is not marked with 'try' and the error is not handled}}
175176

176177
////////////
177178
// effectful properties from outside the actor instance
178179

179180
// 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'}}
181182
_ = a.effPropA
182183

183184
// expected-warning@+3 {{cannot use property 'effPropT' with a non-sendable type 'Box' across actors}}
184185
// 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'}}
186187
_ = a.effPropT
187188

188189
// 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'}}
190191
_ = a.effPropAT
191192

192193
// (mostly) corrected ones
@@ -204,30 +205,35 @@ func someAsyncFunc() async {
204205

205206
extension BankAccount {
206207
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'}}
209211
}
210212

211213
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'}}
214217
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'}}
217220
}
218221
}
219222

220223
func anotherAsyncFunc() async {
221224
let a = BankAccount(initialDeposit: 34)
222225
let b = BankAccount(initialDeposit: 35)
223226

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+
227232
_ = b.balance // expected-error {{actor-isolated instance method 'balance()' can only be referenced from inside the actor}}
228233

229234
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
231237
_ = await b.owner == "cat"
232238

233239

@@ -313,17 +319,24 @@ actor Chain {
313319
}
314320

315321
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
319330
}
320331

321332

322333
// want to make sure there is no note about implicitly async on this func.
323334
@BananaActor func rice() async {}
324335

325336
@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()
327340
}
328341

329342
///////////
@@ -449,21 +462,21 @@ func tryEffPropsFromSync() {
449462
}
450463

451464
@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'}}
453466
_ = effPropA
454467

455468
// expected-note@+5{{did you mean to handle error as optional value?}}
456469
// expected-note@+4{{did you mean to use 'try'?}}
457470
// expected-note@+3{{did you mean to disable error propagation?}}
458471
// 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'}}
460473
_ = effPropT
461474

462475
// expected-note@+5{{did you mean to handle error as optional value?}}
463476
// expected-note@+4{{did you mean to use 'try'?}}
464477
// expected-note@+3{{did you mean to disable error propagation?}}
465478
// 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'}}
467480
_ = effPropAT
468481

469482
_ = await effPropA
@@ -484,7 +497,9 @@ actor SubscriptA {
484497
}
485498

486499
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]
488503
}
489504
}
490505

@@ -532,15 +547,16 @@ actor SubscriptAT {
532547
}
533548

534549
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]
536552

537553
_ = await a[0]
538554

539555
// expected-note@+5{{did you mean to handle error as optional value?}}
540556
// expected-note@+4{{did you mean to use 'try'?}}
541557
// expected-note@+3{{did you mean to disable error propagation?}}
542558
// 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'}}
544560
_ = t[0]
545561

546562
_ = try await t[0]
@@ -551,7 +567,7 @@ func tryTheActorSubscripts(a : SubscriptA, t : SubscriptT, at : SubscriptAT) asy
551567
// expected-note@+4{{did you mean to use 'try'?}}
552568
// expected-note@+3{{did you mean to disable error propagation?}}
553569
// 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'}}
555571
_ = at[0]
556572

557573
_ = try await at[0]

0 commit comments

Comments
 (0)