From 2b2c800adf1fa54dd8e8aabb75ff9dabd97571e2 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 23 Mar 2026 14:28:50 +0000 Subject: [PATCH] Gate `ExperimentalCustomExecutors` usage behind Swift 6.4 for non-Wasm targets Seems like it's dropped in Swift 6.3 rc shipped along with Xcode 26.4 RC in the last minute --- .../JavaScriptEventLoop+ExecutorFactory.swift | 8 ++++---- Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Sources/JavaScriptEventLoop/JavaScriptEventLoop+ExecutorFactory.swift b/Sources/JavaScriptEventLoop/JavaScriptEventLoop+ExecutorFactory.swift index a9b6091e8..0d2010016 100644 --- a/Sources/JavaScriptEventLoop/JavaScriptEventLoop+ExecutorFactory.swift +++ b/Sources/JavaScriptEventLoop/JavaScriptEventLoop+ExecutorFactory.swift @@ -4,14 +4,14 @@ // See: https://github.com/swiftlang/swift/pull/80266 // See: https://forums.swift.org/t/pitch-2-custom-main-and-global-executors/78437 -#if compiler(>=6.3) +#if compiler(>=6.4) || (swift(>=6.3) && arch(wasm32)) @_spi(ExperimentalCustomExecutors) @_spi(ExperimentalScheduling) import _Concurrency #else import _Concurrency -#endif // #if compiler(>=6.3) +#endif // #if compiler(>=6.4) || (swift(>=6.3) && arch(wasm32)) import _CJavaScriptKit -#if compiler(>=6.3) +#if compiler(>=6.4) || (swift(>=6.3) && arch(wasm32)) // MARK: - MainExecutor Implementation // MainExecutor is used by the main actor to execute tasks on the main thread @@ -133,4 +133,4 @@ extension JavaScriptEventLoop: ExecutorFactory { } } -#endif // #if compiler(>=6.3) +#endif // #if compiler(>=6.4) || (swift(>=6.3) && arch(wasm32)) diff --git a/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift b/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift index aec1441a5..5fc267ddc 100644 --- a/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift +++ b/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift @@ -1,5 +1,5 @@ import JavaScriptKit -#if compiler(>=6.3) +#if compiler(>=6.4) || (swift(>=6.3) && arch(wasm32)) @_spi(ExperimentalCustomExecutors) import _Concurrency #else import _Concurrency @@ -123,9 +123,9 @@ public final class JavaScriptEventLoop: SerialExecutor, @unchecked Sendable { private static func installGlobalExecutorIsolated() { guard !didInstallGlobalExecutor else { return } didInstallGlobalExecutor = true - #if compiler(>=6.3) && !hasFeature(Embedded) + #if (compiler(>=6.4) || (swift(>=6.3) && arch(wasm32))) && !hasFeature(Embedded) if #available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, visionOS 9999, *) { - // For Swift 6.3 and above, we can use the new `ExecutorFactory` API + // For Swift 6.4 and above, we can use the new `ExecutorFactory` API _Concurrency._createExecutors(factory: JavaScriptEventLoop.self) } #else