From 3c9c517667f0ab10c8e80bdb903f4cc9d21f91d7 Mon Sep 17 00:00:00 2001 From: Wilfred Hughes Date: Tue, 13 May 2025 13:29:24 +0100 Subject: [PATCH] Fix visibility on import triggering a compile warning Previously, building sourcekit-lsp would produce the following warning when building on macOS: $ swift build Building for debugging... /Users/wilfred/src/sourcekit-lsp/Sources/SKLogging/CustomLogStringConvertible.swift:13:9: warning: package import of 'Foundation' was not used in package declarations 11 | //===----------------------------------------------------------------------===// 12 | 13 | package import Foundation | `- warning: package import of 'Foundation' was not used in package declarations Remove the visibility modifier, so no warning is produced. --- Sources/SKLogging/CustomLogStringConvertible.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sources/SKLogging/CustomLogStringConvertible.swift b/Sources/SKLogging/CustomLogStringConvertible.swift index 59f24b479..105e45204 100644 --- a/Sources/SKLogging/CustomLogStringConvertible.swift +++ b/Sources/SKLogging/CustomLogStringConvertible.swift @@ -10,7 +10,13 @@ // //===----------------------------------------------------------------------===// +// NSObject is defined in Foundation on non-darwin platforms. On +// darwin, NSObject is package-visible. +#if canImport(ObjectiveC) +import Foundation +#else package import Foundation +#endif #if !NO_CRYPTO_DEPENDENCY import Crypto