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
[Concurrency] Allow sendability mismatches while overriding @preconcurrency properties in Swift 5 mode
Downgrade a mismatch on `any Sendable` -> `Any` to a warning until
Swift 6 to enable class authors to introduce concurrency annotations
to overridable properties.
Resolves: rdar://122193606
(cherry picked from commit cdf28bc)
// Override matching with @preconcurrency properties.
257
+
do{
258
+
classBase{
259
+
@preconcurrency
260
+
openvartest1:([anySendable])? // expected-note {{overridden declaration is here}}
261
+
262
+
@preconcurrency
263
+
openvartest2:[String:[Int:anySendable]] // expected-note {{overridden declaration is here}}
264
+
265
+
@preconcurrency
266
+
openvartest3:anySendable // expected-note {{overridden declaration is here}}
267
+
268
+
@preconcurrency
269
+
openvartest4:(((Any)?)->Void)?{ // expected-note {{overridden declaration is here}}
270
+
nil
271
+
}
272
+
273
+
init(){
274
+
self.test1 =nil
275
+
self.test2 =[:]
276
+
self.test3 =42
277
+
}
278
+
}
279
+
280
+
classTest:Base{
281
+
overridevartest1:[Any]?{
282
+
// expected-warning@-1 {{declaration 'test1' has a type with different sendability from any potential overrides; this is an error in the Swift 6 language mode}}
283
+
get{nil}
284
+
set{}
285
+
}
286
+
287
+
overridevartest2:[String:[Int:Any]]{
288
+
// expected-warning@-1 {{declaration 'test2' has a type with different sendability from any potential overrides; this is an error in the Swift 6 language mode}}
289
+
get{[:]}
290
+
set{}
291
+
}
292
+
293
+
overridevartest3:Any{
294
+
// expected-warning@-1 {{declaration 'test3' has a type with different sendability from any potential overrides; this is an error in the Swift 6 language mode}}
295
+
get{42}
296
+
set{}
297
+
}
298
+
299
+
overridevartest4:(((anySendable)?)->Void)?{
300
+
// expected-warning@-1 {{declaration 'test4' has a type with different sendability from any potential overrides; this is an error in the Swift 6 language mode}}
0 commit comments