Skip to content

Commit 51e348b

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. Mirrors swiftlang/swift-syntax#2429
1 parent a0f43bb commit 51e348b

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

Sources/ArgumentParser/Usage/DumpHelpGenerator.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,19 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12+
#if swift(>=5.11)
13+
internal import ArgumentParserToolInfo
14+
internal import class Foundation.JSONEncoder
15+
#elseif swift(>=5.10)
16+
import ArgumentParserToolInfo
17+
import class Foundation.JSONEncoder
18+
#else
1219
@_implementationOnly import ArgumentParserToolInfo
1320
@_implementationOnly import class Foundation.JSONEncoder
21+
#endif
1422

1523
internal struct DumpHelpGenerator {
16-
var toolInfo: ToolInfoV0
24+
private var toolInfo: ToolInfoV0
1725

1826
init(_ type: ParsableArguments.Type) {
1927
self.init(commandStack: [type.asCommand])

Sources/ArgumentParser/Usage/MessageInfo.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,16 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12+
#if swift(>=5.11)
13+
internal import protocol Foundation.LocalizedError
14+
internal import class Foundation.NSError
15+
#elseif swift(>=5.10)
16+
import protocol Foundation.LocalizedError
17+
import class Foundation.NSError
18+
#else
1219
@_implementationOnly import protocol Foundation.LocalizedError
1320
@_implementationOnly import class Foundation.NSError
21+
#endif
1422

1523
enum MessageInfo {
1624
case help(text: String)

Sources/ArgumentParser/Usage/UsageGenerator.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12+
#if swift(>=5.11)
13+
internal import protocol Foundation.LocalizedError
14+
#elseif swift(>=5.10)
15+
import protocol Foundation.LocalizedError
16+
#else
1217
@_implementationOnly import protocol Foundation.LocalizedError
18+
#endif
1319

1420
struct UsageGenerator {
1521
var toolName: String

0 commit comments

Comments
 (0)