Skip to content

Commit 3e613a2

Browse files
committed
update async-let test for implicitly async
1 parent eb665f6 commit 3e613a2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/Concurrency/async_let_isolation.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ actor class MyActor {
55
let immutable: Int = 17
66
var text: [String] = []
77

8-
func synchronous() -> String { text.first ?? "nothing" } // expected-note 2 {{only asynchronous methods can be used outside the actor instance; do you want to add 'async'?}}
8+
func synchronous() -> String { text.first ?? "nothing" } // expected-note 2 {{calls to instance method 'synchronous()' from outside of its actor context are implicitly asynchronous}}
99
func asynchronous() async -> String { synchronous() }
1010

1111
func testAsyncLetIsolation() async {
@@ -27,3 +27,11 @@ actor class MyActor {
2727
_ = await w
2828
}
2929
}
30+
31+
func outside() async {
32+
let a = MyActor()
33+
async let x = a.synchronous() // expected-error {{call is 'async' in an 'async let' initializer that is not marked with 'await'}}
34+
async let y = await a.synchronous()
35+
_ = await x
36+
_ = await y
37+
}

0 commit comments

Comments
 (0)