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 6{{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
@@ -46,6 +49,7 @@ extension MyActor {
46
49
// @actorIndependent
47
50
_ =actorIndependentFunc(otherActor:self)
48
51
_ = actorIndependentVar
52
+
49
53
actorIndependentVar =17
50
54
_ =self.actorIndependentFunc(otherActor:self)
51
55
_ =self.actorIndependentVar
@@ -60,6 +64,16 @@ extension MyActor {
60
64
_ = immutableGlobal
61
65
_ = mutableGlobal // expected-warning{{reference to var 'mutableGlobal' is not concurrency-safe because it involves shared mutable state}}
62
66
67
+
// Partial application
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'}}
76
+
63
77
return5
64
78
}
65
79
@@ -137,6 +151,19 @@ extension MyActor {
137
151
}
138
152
139
153
localVar =0
154
+
155
+
// Partial application
156
+
_ = synchronous // expected-error{{actor-isolated instance method 'synchronous()' 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