@@ -303,13 +303,24 @@ public protocol DistributedActor: AnyActor, Identifiable, Hashable
303
303
304
304
}
305
305
306
- #if swift (>=5.9.0)
307
- @available ( SwiftStdlib 5 . 9 , * )
306
+ #if compiler (>=5.9.0) // since this compiler version, we synthesize the `localUnownedExecutor` instead.
307
+ @available ( SwiftStdlib 5 . 7 , * )
308
308
extension DistributedActor {
309
- @available ( SwiftStdlib 5 . 9 , * )
309
+ @available ( SwiftStdlib 5 . 7 , * )
310
310
public nonisolated var unownedExecutor : UnownedSerialExecutor {
311
+ if #available( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * ) {
312
+ // In these versions, we moved to asking developers to implement
313
+ // `localUnownedExecutor` and as such delegate to it. The `??` fallback
314
+ // is likely to never be triggered, but technically could be if someone queried
315
+ // the `unownedExecutor` property directly on a default distributed remote actor reference,
316
+ // in previous language versions, so we keep these semantics for compatibility.
311
317
return self . localUnownedExecutor ??
312
318
UnownedSerialExecutor ( Builtin . buildDefaultActorExecutorRef ( self ) )
319
+ } else {
320
+ // pessimistic reimplementation of the semantics the synthesized body would have had.
321
+ // semantically, this is the only implementation possible on older Swift's here.
322
+ return UnownedSerialExecutor ( Builtin . buildDefaultActorExecutorRef ( self ) )
323
+ }
313
324
}
314
325
}
315
326
#endif // swift 5.9
0 commit comments