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
// 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
+3-3Lines changed: 3 additions & 3 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 }}
0 commit comments