diff --git a/Sources/SwiftCompilerPlugin/CompilerPlugin.swift b/Sources/SwiftCompilerPlugin/CompilerPlugin.swift index c16a8390c85..b4efd0d1258 100644 --- a/Sources/SwiftCompilerPlugin/CompilerPlugin.swift +++ b/Sources/SwiftCompilerPlugin/CompilerPlugin.swift @@ -12,12 +12,22 @@ // NOTE: This basic plugin mechanism is mostly copied from // https://github.com/apple/swift-package-manager/blob/main/Sources/PackagePlugin/Plugin.swift -@_implementationOnly import Foundation -@_implementationOnly import SwiftCompilerPluginMessageHandling import SwiftSyntaxMacros +#if swift(>=5.11) +private import Foundation +private import SwiftCompilerPluginMessageHandling +#else +import Foundation +import SwiftCompilerPluginMessageHandling +#endif + #if os(Windows) -@_implementationOnly import ucrt +#if swift(>=5.11) +private import ucrt +#else +import ucrt +#endif #endif // @@ -167,8 +177,8 @@ extension CompilerPlugin { } internal struct PluginHostConnection: MessageConnection { - let inputStream: FileHandle - let outputStream: FileHandle + fileprivate let inputStream: FileHandle + fileprivate let outputStream: FileHandle func sendMessage(_ message: TX) throws { // Encode the message as JSON. diff --git a/Sources/SwiftSyntax/SyntaxText.swift b/Sources/SwiftSyntax/SyntaxText.swift index c5068a76aa4..a15ef1a7b15 100644 --- a/Sources/SwiftSyntax/SyntaxText.swift +++ b/Sources/SwiftSyntax/SyntaxText.swift @@ -10,12 +10,22 @@ // //===----------------------------------------------------------------------===// +#if swift(>=5.11) #if canImport(Darwin) -@_implementationOnly import Darwin +private import Darwin #elseif canImport(Glibc) -@_implementationOnly import Glibc +private import Glibc #elseif canImport(Musl) -@_implementationOnly import Musl +private import Musl +#endif +#else +#if canImport(Darwin) +import Darwin +#elseif canImport(Glibc) +import Glibc +#elseif canImport(Musl) +import Musl +#endif #endif /// Represent a string. diff --git a/Sources/SwiftSyntaxMacrosTestSupport/Assertions.swift b/Sources/SwiftSyntaxMacrosTestSupport/Assertions.swift index 5a3fcdbd2c8..7f7d2f40dac 100644 --- a/Sources/SwiftSyntaxMacrosTestSupport/Assertions.swift +++ b/Sources/SwiftSyntaxMacrosTestSupport/Assertions.swift @@ -17,9 +17,14 @@ import SwiftParserDiagnostics import SwiftSyntax import SwiftSyntaxMacroExpansion import SwiftSyntaxMacros -import XCTest import _SwiftSyntaxTestSupport +#if swift(>=5.11) +private import XCTest +#else +import XCTest +#endif + // MARK: - Note /// Describes a diagnostic note that tests expect to be created by a macro expansion.