Skip to content

Commit 0681e4d

Browse files
committed
Remove @_implementationOnly annotations
These annotations produce warnings when compiling swift-syntax without library evolution using Swift ≥5.10. Replace them by `private import` when compiling using Swift ≥5.11. Also mark the import of XCTest from `SwiftSyntaxMacrosTestSupport` as `private`, fixing rdar://119517162. rdar://119517162
1 parent 7f41827 commit 0681e4d

File tree

2 files changed

+28
-8
lines changed

2 files changed

+28
-8
lines changed

Sources/SwiftCompilerPlugin/CompilerPlugin.swift

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,22 @@
1212
// NOTE: This basic plugin mechanism is mostly copied from
1313
// https://github.com/apple/swift-package-manager/blob/main/Sources/PackagePlugin/Plugin.swift
1414

15-
@_implementationOnly import Foundation
16-
@_implementationOnly import SwiftCompilerPluginMessageHandling
1715
import SwiftSyntaxMacros
1816

17+
#if swift(>=5.11)
18+
private import Foundation
19+
private import SwiftCompilerPluginMessageHandling
20+
#else
21+
import Foundation
22+
import SwiftCompilerPluginMessageHandling
23+
#endif
24+
1925
#if os(Windows)
20-
@_implementationOnly import ucrt
26+
#if swift(>=5.11)
27+
private import ucrt
28+
#else
29+
import ucrt
30+
#endif
2131
#endif
2232

2333
//
@@ -169,8 +179,8 @@ extension CompilerPlugin {
169179
}
170180

171181
internal struct PluginHostConnection: MessageConnection {
172-
let inputStream: FileHandle
173-
let outputStream: FileHandle
182+
fileprivate let inputStream: FileHandle
183+
fileprivate let outputStream: FileHandle
174184

175185
func sendMessage<TX: Encodable>(_ message: TX) throws {
176186
// Encode the message as JSON.

Sources/SwiftSyntax/SyntaxText.swift

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,22 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13+
#if swift(>=5.11)
1314
#if canImport(Darwin)
14-
@_implementationOnly import Darwin
15+
private import Darwin
1516
#elseif canImport(Glibc)
16-
@_implementationOnly import Glibc
17+
private import Glibc
1718
#elseif canImport(Musl)
18-
@_implementationOnly import Musl
19+
private import Musl
20+
#endif
21+
#else
22+
#if canImport(Darwin)
23+
import Darwin
24+
#elseif canImport(Glibc)
25+
import Glibc
26+
#elseif canImport(Musl)
27+
import Musl
28+
#endif
1929
#endif
2030

2131
/// Represent a string.

0 commit comments

Comments
 (0)