From 970b44d255ca90cd332890c4b75de2fecffd79e2 Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Wed, 31 Jul 2024 16:03:06 -0700 Subject: [PATCH] Remove a few `@preconcurrency` imports rdar://132378792 is fixed --- .../BuildServerBuildSystem.swift | 8 +------- Sources/SKLogging/NonDarwinLogging.swift | 3 +-- Sources/SKLogging/SetGlobalLogFileHandler.swift | 3 +-- Sources/SKTestSupport/TestJSONRPCConnection.swift | 5 ----- .../SourceKitLSP/Clang/ClangLanguageService.swift | 12 +----------- Sources/sourcekit-lsp/SourceKitLSP.swift | 8 +------- .../BuildServerBuildSystemTests.swift | 8 +------- .../ConnectionTests.swift | 5 ----- 8 files changed, 6 insertions(+), 46 deletions(-) diff --git a/Sources/BuildSystemIntegration/BuildServerBuildSystem.swift b/Sources/BuildSystemIntegration/BuildServerBuildSystem.swift index e7770846..865983e2 100644 --- a/Sources/BuildSystemIntegration/BuildServerBuildSystem.swift +++ b/Sources/BuildSystemIntegration/BuildServerBuildSystem.swift @@ -11,6 +11,7 @@ //===----------------------------------------------------------------------===// import BuildServerProtocol +import Foundation import LanguageServerProtocol import LanguageServerProtocolJSONRPC import SKLogging @@ -26,13 +27,6 @@ import var TSCBasic.localFileSystem import func TSCBasic.lookupExecutablePath import func TSCBasic.resolveSymlinks -#if canImport(Darwin) -import Foundation -#else -// FIMXE: (async-workaround) @preconcurrency needed because Pipe is not marked as Sendable on Linux rdar://132378792 -@preconcurrency import Foundation -#endif - enum BuildServerTestError: Error { case executableNotFound(String) } diff --git a/Sources/SKLogging/NonDarwinLogging.swift b/Sources/SKLogging/NonDarwinLogging.swift index 5f652425..333dec63 100644 --- a/Sources/SKLogging/NonDarwinLogging.swift +++ b/Sources/SKLogging/NonDarwinLogging.swift @@ -15,8 +15,7 @@ import SwiftExtensions #if canImport(Darwin) import Foundation #else -// FIMXE: (async-workaround) @preconcurrency needed because DateFormatter and stderr are not marked as Sendable on Linux -// rdar://125578486, rdar://132378589 +// TODO: @preconcurrency needed because stderr is not sendable on Linux https://github.com/swiftlang/swift/issues/75601 @preconcurrency import Foundation #endif diff --git a/Sources/SKLogging/SetGlobalLogFileHandler.swift b/Sources/SKLogging/SetGlobalLogFileHandler.swift index 4fbdda5c..21cbfda8 100644 --- a/Sources/SKLogging/SetGlobalLogFileHandler.swift +++ b/Sources/SKLogging/SetGlobalLogFileHandler.swift @@ -15,8 +15,7 @@ import RegexBuilder #if canImport(Darwin) import Foundation #else -// FIMXE: (async-workaround) @preconcurrency needed because DateFormatter and stderr are not marked as Sendable on Linux -// rdar://125578486, rdar://132378589 +// TODO: @preconcurrency needed because stderr is not sendable on Linux https://github.com/swiftlang/swift/issues/75601 @preconcurrency import Foundation #endif diff --git a/Sources/SKTestSupport/TestJSONRPCConnection.swift b/Sources/SKTestSupport/TestJSONRPCConnection.swift index fd157df2..b090fa3e 100644 --- a/Sources/SKTestSupport/TestJSONRPCConnection.swift +++ b/Sources/SKTestSupport/TestJSONRPCConnection.swift @@ -17,12 +17,7 @@ import SKSupport import SwiftExtensions import XCTest -#if canImport(Darwin) import class Foundation.Pipe -#else -// FIMXE: (async-workaround) @preconcurrency needed because Pipe is not marked as Sendable on Linux rdar://132378792 -@preconcurrency import class Foundation.Pipe -#endif package final class TestJSONRPCConnection: Sendable { package let clientToServer: Pipe = Pipe() diff --git a/Sources/SourceKitLSP/Clang/ClangLanguageService.swift b/Sources/SourceKitLSP/Clang/ClangLanguageService.swift index 81a6a761..01bdcc11 100644 --- a/Sources/SourceKitLSP/Clang/ClangLanguageService.swift +++ b/Sources/SourceKitLSP/Clang/ClangLanguageService.swift @@ -11,6 +11,7 @@ //===----------------------------------------------------------------------===// import BuildSystemIntegration +import Foundation import LanguageServerProtocol import LanguageServerProtocolJSONRPC import SKLogging @@ -22,21 +23,10 @@ import ToolchainRegistry import struct TSCBasic.AbsolutePath -#if canImport(Darwin) -import Foundation -#else -// FIMXE: (async-workaround) @preconcurrency needed because Pipe is not marked as Sendable on Linux -@preconcurrency import Foundation -#endif - #if os(Windows) import WinSDK #endif -#if !canImport(Darwin) -extension Process: @unchecked Sendable {} -#endif - /// A thin wrapper over a connection to a clangd server providing build setting handling. /// /// In addition, it also intercepts notifications and replies from clangd in order to do things diff --git a/Sources/sourcekit-lsp/SourceKitLSP.swift b/Sources/sourcekit-lsp/SourceKitLSP.swift index 538b2241..d186851a 100644 --- a/Sources/sourcekit-lsp/SourceKitLSP.swift +++ b/Sources/sourcekit-lsp/SourceKitLSP.swift @@ -15,6 +15,7 @@ import BuildSystemIntegration import Csourcekitd // Not needed here, but fixes debugging... import Diagnose import Dispatch +import Foundation import LanguageServerProtocol import LanguageServerProtocolJSONRPC import SKLogging @@ -28,13 +29,6 @@ import struct TSCBasic.AbsolutePath import struct TSCBasic.RelativePath import var TSCBasic.localFileSystem -#if canImport(Darwin) -import Foundation -#else -// FIMXE: (async-workaround) @preconcurrency needed because FileHandle is not marked as Sendable on Linux rdar://132378985 -@preconcurrency import Foundation -#endif - extension AbsolutePath { public init?(argument: String) { let path: AbsolutePath? diff --git a/Tests/BuildSystemIntegrationTests/BuildServerBuildSystemTests.swift b/Tests/BuildSystemIntegrationTests/BuildServerBuildSystemTests.swift index 57ebf5b9..60dc1e1d 100644 --- a/Tests/BuildSystemIntegrationTests/BuildServerBuildSystemTests.swift +++ b/Tests/BuildSystemIntegrationTests/BuildServerBuildSystemTests.swift @@ -12,19 +12,13 @@ import BuildServerProtocol import BuildSystemIntegration +import Foundation import ISDBTestSupport import LanguageServerProtocol import SKTestSupport import TSCBasic import XCTest -#if canImport(Darwin) -import Foundation -#else -// FIMXE: (async-workaround) @preconcurrency needed because Pipe is not marked as Sendable on Linux rdar://132378792 -@preconcurrency import Foundation -#endif - /// The path to the INPUTS directory of shared test projects. private let skTestSupportInputsDirectory: URL = { #if os(macOS) diff --git a/Tests/LanguageServerProtocolJSONRPCTests/ConnectionTests.swift b/Tests/LanguageServerProtocolJSONRPCTests/ConnectionTests.swift index 6072f9fa..9df1d409 100644 --- a/Tests/LanguageServerProtocolJSONRPCTests/ConnectionTests.swift +++ b/Tests/LanguageServerProtocolJSONRPCTests/ConnectionTests.swift @@ -15,12 +15,7 @@ import LanguageServerProtocol import SKTestSupport import XCTest -#if canImport(Darwin) import class Foundation.Pipe -#else -// FIMXE: (async-workaround) @preconcurrency needed because Pipe is not marked as Sendable on Linux rdar://132378792 -@preconcurrency import class Foundation.Pipe -#endif #if os(Windows) import WinSDK