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/actor_isolation.swift
+15-14Lines changed: 15 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -71,7 +71,7 @@ actor MyActor: MySuperActor { // expected-error{{actor types do not support inhe
71
71
classfunc synchronousClass(){}
72
72
staticfunc synchronousStatic(){}
73
73
74
-
func synchronous()->String{ text.first ??"nothing"} // expected-note 20{{calls to instance method 'synchronous()' from outside of its actor context are implicitly asynchronous}}
74
+
func synchronous()->String{ text.first ??"nothing"} // expected-note 19{{calls to instance method 'synchronous()' from outside of its actor context are implicitly asynchronous}}
75
75
func asynchronous()async->String{
76
76
super.superState +=4
77
77
returnsynchronous()
@@ -202,7 +202,7 @@ extension MyActor {
202
202
203
203
_ = otherActor.synchronous()
204
204
// expected-error@-1{{expression is 'async' but is not marked with 'await'}}{{9-9=await }}
205
-
// expected-note@-2{{call is 'async'}}
205
+
// expected-note@-2{{calls to instance method 'synchronous()' from outside of its actor context are implicitly asynchronous}}
206
206
_ =await otherActor.asynchronous()
207
207
_ = otherActor.text[0]
208
208
// expected-error@-1{{expression is 'async' but is not marked with 'await'}}{{9-9=await }}
@@ -222,7 +222,7 @@ extension MyActor {
222
222
223
223
// Global actors
224
224
syncGlobalActorFunc() // expected-error{{expression is 'async' but is not marked with 'await'}}{{5-5=await }}
225
-
// expected-note@-1{{call is 'async'}}
225
+
// expected-note@-1{{calls to global function 'syncGlobalActorFunc()' from outside of its actor context are implicitly asynchronous}}
226
226
227
227
awaitasyncGlobalActorFunc()
228
228
@@ -399,7 +399,7 @@ actor Crystal {
399
399
@SomeGlobalActorfunc goo1()async{
400
400
let _ = goo2
401
401
// expected-error@+1{{expression is 'async' but is not marked with 'await'}}{{3-3=await }}
402
-
goo2() // expected-note{{call is 'async'}}
402
+
goo2() // expected-note{{calls to global function 'goo2()' from outside of its actor context are implicitly asynchronous}}
// any kind of method can be called from outside the actor, so long as it's marked with 'await'
536
536
_ =actor.synchronous() // expected-error{{expression is 'async' but is not marked with 'await'}}{{7-7=await }}
537
-
// expected-note@-1{{call is 'async}}
537
+
// expected-note@-1{{calls to instance method 'synchronous()' from outside of its actor context are implicitly asynchronous}}
538
538
_ =actor.asynchronous() // expected-error{{expression is 'async' but is not marked with 'await'}}{{7-7=await }}
539
539
// expected-note@-1{{call is 'async'}}
540
540
@@ -751,7 +751,7 @@ class SomeClassWithInits {
751
751
awaitself.isolated() // expected-warning{{cannot use parameter 'self' with a non-sendable type 'SomeClassWithInits' from concurrently-executed code}}
752
752
self.isolated() // expected-warning{{cannot use parameter 'self' with a non-sendable type 'SomeClassWithInits' from concurrently-executed code}}
753
753
// expected-error@-1{{expression is 'async' but is not marked with 'await'}}{{7-7=await }}
754
-
// expected-note@-2{{call is 'async'}}
754
+
// expected-note@-2{{calls to instance method 'isolated()' from outside of its actor context are implicitly asynchronous}}
755
755
756
756
print(awaitself.mutableState) // expected-warning{{cannot use parameter 'self' with a non-sendable type 'SomeClassWithInits' from concurrently-executed code}}
let _:()->Int= f2 // expected-error{{converting function value of type '@SomeGlobalActor () -> Int' to '() -> Int' loses global actor 'SomeGlobalActor'}}
131
131
132
132
// expected-error@+1{{expression is 'async' but is not marked with 'await'}}{{7-7=await }}
133
-
_ =f1() //expected-note{{call is 'async}}
133
+
_ =f1() //expected-note{{calls to let 'f1' from outside of its actor context are implicitly asynchronous}}
134
134
// expected-error@+1{{expression is 'async' but is not marked with 'await'}}{{7-7=await }}
135
-
_ =f2() //expected-note{{call is 'async'}}
135
+
_ =f2() //expected-note{{calls to let 'f2' from outside of its actor context are implicitly asynchronous}}
136
136
137
-
// expected-error@+1{{expression is 'async' but is not marked with 'await'}}{{7-7=await }}
138
-
_ =f1()+ f2() // expected-note 2 {{call is 'async'}}
137
+
// expected-error@+3{{expression is 'async' but is not marked with 'await'}}{{7-7=await }}
138
+
//expected-note@+2 {{calls to let 'f1' from outside of its actor context are implicitly asynchronous}}
139
+
// expected-note@+1 {{calls to let 'f2' from outside of its actor context are implicitly asynchronous}}
Copy file name to clipboardExpand all lines: test/Concurrency/global_actor_inference.swift
+5-4Lines changed: 5 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -238,7 +238,7 @@ class SubclassWithGlobalActors : SuperclassWithGlobalActors {
238
238
onGenericGlobalActorString() // okay
239
239
240
240
// expected-error@+1{{expression is 'async' but is not marked with 'await'}}{{5-5=await }}
241
-
onGenericGlobalActorInt() // expected-note{{call is 'async'}}
241
+
onGenericGlobalActorInt() // expected-note{{calls to instance method 'onGenericGlobalActorInt()' from outside of its actor context are implicitly asynchronous}}
242
242
}
243
243
}
244
244
@@ -253,7 +253,7 @@ class SubclassWithGlobalActors : SuperclassWithGlobalActors {
253
253
254
254
func bar()async{
255
255
// expected-error@+1{{expression is 'async' but is not marked with 'await'}}{{3-3=await }}
256
-
foo() // expected-note{{call is 'async'}}
256
+
foo() // expected-note{{calls to global function 'foo()' from outside of its actor context are implicitly asynchronous}}
257
257
}
258
258
259
259
// expected-note@+1 {{add '@SomeGlobalActor' to make global function 'barSync()' part of global actor 'SomeGlobalActor'}} {{1-1=@SomeGlobalActor }}
@MainActorfunc onlyOnMainActor(){} // expected-note{{calls to global function 'onlyOnMainActor()' from outside of its actor context are implicitly asynchronous}}
0 commit comments