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
@@ -28,7 +31,7 @@ actor class MyActor: MySuperActor {
28
31
classfunc synchronousClass(){}
29
32
staticfunc synchronousStatic(){}
30
33
31
-
func synchronous()->String{ text.first ??"nothing"} // expected-note 8{{only asynchronous methods can be used outside the actor instance; do you want to add 'async'?}}
34
+
func synchronous()->String{ text.first ??"nothing"} // expected-note 18{{only asynchronous methods can be used outside the actor instance; do you want to add 'async'?}}
32
35
func asynchronous()async->String{synchronous()}
33
36
}
34
37
@@ -62,8 +65,14 @@ extension MyActor {
62
65
_ = mutableGlobal // expected-warning{{reference to var 'mutableGlobal' is not concurrency-safe because it involves shared mutable state}}
63
66
64
67
// Partial application
65
-
_ = synchronous // expected-error{{actor-isolated instance method 'synchronous()' can not be partially applied}}
66
-
_ = super.superMethod // expected-error{{actor-isolated instance method 'superMethod()' can not be partially applied}}
68
+
_ = synchronous // expected-error{{actor-isolated instance method 'synchronous()' can not be referenced from an '@actorIndependent' context}}
69
+
_ = super.superMethod // expected-error{{actor-isolated instance method 'superMethod()' can not be referenced from an '@actorIndependent' context}}
70
+
acceptClosure(synchronous) // expected-error{{actor-isolated instance method 'synchronous()' can not be referenced from an '@actorIndependent' context}}
71
+
acceptClosure(self.synchronous) // expected-error{{actor-isolated instance method 'synchronous()' can not be referenced from an '@actorIndependent' context}}
72
+
acceptClosure(otherActor.synchronous) // expected-error{{actor-isolated instance method 'synchronous()' can only be referenced on 'self'}}
73
+
acceptEscapingClosure(synchronous) // expected-error{{actor-isolated instance method 'synchronous()' can not be referenced from an '@actorIndependent' context}}}}
74
+
acceptEscapingClosure(self.synchronous) // expected-error{{actor-isolated instance method 'synchronous()' can not be referenced from an '@actorIndependent'}}
75
+
acceptEscapingClosure(otherActor.synchronous) // expected-error{{actor-isolated instance method 'synchronous()' can only be referenced on 'self'}}
67
76
68
77
return5
69
78
}
@@ -145,7 +154,16 @@ extension MyActor {
145
154
146
155
// Partial application
147
156
_ = synchronous // expected-error{{actor-isolated instance method 'synchronous()' can not be partially applied}}
148
-
_ = super.superMethod // expected-error{{actor-isolated instance method 'superMethod()' can not be partially applied}}
157
+
_ = super.superMethod // expected-error{{actor-isolated instance method 'superMethod()' is unsafe to reference in code that may execute concurrently}}
158
+
acceptClosure(synchronous)
159
+
acceptClosure(self.synchronous)
160
+
acceptClosure(otherActor.synchronous) // expected-error{{actor-isolated instance method 'synchronous()' can only be referenced on 'self'}}
161
+
acceptEscapingClosure(synchronous) // expected-error{{actor-isolated instance method 'synchronous()' can not be partially applied}}
162
+
acceptEscapingClosure(self.synchronous) // expected-error{{actor-isolated instance method 'synchronous()' can not be partially applied}}
163
+
acceptEscapingClosure(otherActor.synchronous) // expected-error{{actor-isolated instance method 'synchronous()' can only be referenced on 'self'}}
0 commit comments