@@ -23,7 +23,6 @@ typealias DefaultDistributedActorSystem = LocalTestingDistributedActorSystem
23
23
24
24
@available ( SwiftStdlib 5 . 7 , * )
25
25
distributed actor FiveSevenActor_NothingExecutor {
26
- // @available(SwiftStdlib 5.9, *) // because of `localUnownedExecutor`
27
26
nonisolated var localUnownedExecutor : UnownedSerialExecutor ? {
28
27
print ( " get unowned executor " )
29
28
return MainActor . sharedUnownedExecutor
@@ -85,6 +84,7 @@ distributed actor FiveSevenActor_FiveNineExecutor {
85
84
86
85
let system = LocalTestingDistributedActorSystem ( )
87
86
87
+ #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
88
88
tests. test ( " 5.7 actor, no availability executor property => no custom executor " ) {
89
89
expectCrashLater ( withMessage: " Fatal error: Incorrect actor executor assumption; Expected 'MainActor' executor. " )
90
90
try ! await FiveSevenActor_NothingExecutor ( actorSystem: system) . test ( x: 42 )
@@ -98,6 +98,22 @@ distributed actor FiveSevenActor_FiveNineExecutor {
98
98
expectCrashLater ( withMessage: " Fatal error: Incorrect actor executor assumption; Expected 'MainActor' executor. " )
99
99
try ! await FiveSevenActor_FiveNineExecutor ( actorSystem: system) . test ( x: 42 )
100
100
}
101
+ #else
102
+ // On non-apple platforms the SDK comes with the toolchains,
103
+ // so the feature works because we're executing in a 5.9 context already,
104
+ // which otherwise could not have been compiled
105
+ tests. test ( " non apple platform: 5.7 actor, no availability executor property => no custom executor " ) {
106
+ try ! await FiveSevenActor_NothingExecutor ( actorSystem: system) . test ( x: 42 )
107
+ }
108
+
109
+ tests. test ( " non apple platform: 5.9 actor, no availability executor property => custom executor " ) {
110
+ try ! await FiveNineActor_NothingExecutor ( actorSystem: system) . test ( x: 42 )
111
+ }
112
+
113
+ tests. test ( " non apple platform: 5.7 actor, 5.9 executor property => no custom executor " ) {
114
+ try ! await FiveSevenActor_FiveNineExecutor ( actorSystem: system) . test ( x: 42 )
115
+ }
116
+ #endif
101
117
102
118
await runAllTestsAsync ( )
103
119
}
0 commit comments