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
// expected-complete-warning@-1{{passing argument of non-sendable type '() -> ()' into global actor 'BananaActor'-isolated context may introduce data races}}
295
-
// expected-complete-note@-2{{a function type must be marked '@Sendable' to conform to 'Sendable'}}
296
293
awaitwisk(1)
297
294
await(peelBanana)()
298
295
await(((((peelBanana)))))()
299
296
await(((wisk)))((wisk)((wisk)(1)))
300
297
301
298
blender((peelBanana))
302
-
// expected-warning@-1 {{converting function value of type '@BananaActor () -> ()' to '() -> Void' loses global actor 'BananaActor'}}
299
+
// expected-warning@-1 {{converting function value of type '@BananaActor @Sendable () -> ()' to '() -> Void' loses global actor 'BananaActor'}}
303
300
304
301
awaitwisk(peelBanana)
305
-
// expected-complete-warning@-1{{passing argument of non-sendable type '() -> ()' into global actor 'BananaActor'-isolated context may introduce data races}}
306
-
// expected-complete-note@-2{{a function type must be marked '@Sendable' to conform to 'Sendable'}}
307
302
308
303
awaitwisk(wisk)
309
-
// expected-complete-warning@-1{{passing argument of non-sendable type '(Any) -> ()' into global actor 'BananaActor'-isolated context may introduce data races}}
310
-
// expected-complete-note@-2{{a function type must be marked '@Sendable' to conform to 'Sendable'}}
311
304
await(((wisk)))(((wisk)))
312
-
// expected-complete-warning@-1{{passing argument of non-sendable type '(Any) -> ()' into global actor 'BananaActor'-isolated context may introduce data races}}
313
-
// expected-complete-note@-2{{a function type must be marked '@Sendable' to conform to 'Sendable'}}
314
305
315
306
await{wisk}()(1)
316
307
317
-
// FIXME: Poor diagnostic. The issue is that the invalid function conversion
318
-
// to remove '@BananaActor' on 'wisk' cannot influence which solution is chosen.
319
-
// So, the constraint system cannot determine whether the type of this expression
320
-
// is '(Any) -> Void' or '@BananaActor (Any) -> Void'.
321
-
await(true? wisk :{n inreturn})(1)
322
-
// expected-error@-1 {{type of expression is ambiguous without a type annotation}}
308
+
(true? wisk :{n inreturn})(1)
309
+
// expected-warning@-1 {{converting function value of type '@BananaActor @Sendable (Any) -> ()' to '(Any) -> ()' loses global actor 'BananaActor'; this is an error in the Swift 6 language mode}}
classNonAsyncClass{ // expected-targeted-complete-note {{class 'NonAsyncClass' does not conform to the 'Sendable' protocol}}
102
+
classNonAsyncClass{
105
103
// expected-targeted-complete-tns-note @-1 {{class 'NonAsyncClass' does not conform to the 'Sendable' protocol}}
106
104
// expected-tns-note @-2 {{class 'NonAsyncClass' does not conform to the 'Sendable' protocol}}
107
105
func modifyOtherAsync(_ other :inoutInt)async{
@@ -124,7 +122,6 @@ extension TestActor {
124
122
// expected-targeted-complete-tns-warning @-1 {{non-sendable type 'NonAsyncClass' exiting actor-isolated context in call to non-isolated instance method 'modifyOtherAsync' cannot cross actor boundary}}
125
123
await other.modifyOtherAsync(&value2)
126
124
// expected-error @-1 {{actor-isolated property 'value2' cannot be passed 'inout' to 'async' function call}}
127
-
// expected-targeted-complete-warning @-2 {{passing argument of non-sendable type 'NonAsyncClass' outside of actor-isolated context may introduce data races}}
128
125
129
126
awaitotherCurry(&value1)
130
127
// expected-error @-1 {{actor-isolated property 'value1' cannot be passed 'inout' to 'async' function call}}
@@ -134,13 +131,11 @@ extension TestActor {
134
131
}
135
132
136
133
func callMutatingFunctionOnStruct()async{
137
-
// expected-targeted-complete-warning @+4 {{passing argument of non-sendable type 'inout Point' outside of actor-isolated context may introduce data races}}
138
134
// expected-error@+3:20{{cannot call mutating async function 'setComponents(x:y:)' on actor-isolated property 'position'}}
139
135
// expected-error@+2:38{{actor-isolated property 'nextPosition' cannot be passed 'inout' to 'async' function call}}
140
136
// expected-error@+1:58{{actor-isolated property 'nextPosition' cannot be passed 'inout' to 'async' function call}}
// expected-targeted-complete-warning @+4 {{passing argument of non-sendable type 'inout Point' outside of actor-isolated context may introduce data races}}
144
139
// expected-error@+3:20{{cannot call mutating async function 'setComponents(x:y:)' on actor-isolated property 'position'}}
145
140
// expected-error@+2:38{{actor-isolated property 'value1' cannot be passed 'inout' to 'async' function call}}
146
141
// expected-error@+1:50{{actor-isolated property 'value2' cannot be passed 'inout' to 'async' function call}}
@@ -224,7 +219,7 @@ struct MyGlobalActor {
224
219
if #available(SwiftStdlib 5.1,*){
225
220
let _ =Task.detached{await{(_ foo:inoutInt)asyncin foo +=1}(&number)}
226
221
// expected-error @-1 {{actor-isolated var 'number' cannot be passed 'inout' to 'async' function call}}
227
-
// expected-minimal-targeted-error @-2 {{global actor 'MyGlobalActor'-isolated var 'number' can not be used 'inout' from a non-isolated context}}
222
+
// expected-minimal-error @-2 {{global actor 'MyGlobalActor'-isolated var 'number' can not be used 'inout' from a non-isolated context}}
228
223
// expected-complete-tns-error @-3 {{main actor-isolated var 'number' can not be used 'inout' from a non-isolated context}}
229
224
}
230
225
@@ -319,6 +314,5 @@ actor ProtectDictionary {
319
314
func invalid()async{
320
315
awaitdict[0].mutate()
321
316
// expected-warning@-1 {{cannot call mutating async function 'mutate()' on actor-isolated property 'dict'; this is an error in the Swift 6 language mode}}
322
-
// expected-targeted-complete-warning@-2 {{passing argument of non-sendable type 'inout Optional<Int>' outside of actor-isolated context may introduce data races}}
0 commit comments