You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/Concurrency/async_let_isolation.swift
+9-1Lines changed: 9 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ actor class MyActor {
5
5
letimmutable:Int=17
6
6
vartext:[String]=[]
7
7
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}}
9
9
func asynchronous()async->String{synchronous()}
10
10
11
11
func testAsyncLetIsolation()async{
@@ -27,3 +27,11 @@ actor class MyActor {
27
27
_ =await w
28
28
}
29
29
}
30
+
31
+
func outside()async{
32
+
leta=MyActor()
33
+
asyncletx= a.synchronous() // expected-error {{call is 'async' in an 'async let' initializer that is not marked with 'await'}}
0 commit comments