From 51e348bc3434a8050d5d578a36b6efb05c52ab5f Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Thu, 15 Feb 2024 10:11:43 -0800 Subject: [PATCH] Remove `@_implementationOnly` annotations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 https://github.com/apple/swift-syntax/pull/2429 --- Sources/ArgumentParser/Usage/DumpHelpGenerator.swift | 10 +++++++++- Sources/ArgumentParser/Usage/MessageInfo.swift | 8 ++++++++ Sources/ArgumentParser/Usage/UsageGenerator.swift | 6 ++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Sources/ArgumentParser/Usage/DumpHelpGenerator.swift b/Sources/ArgumentParser/Usage/DumpHelpGenerator.swift index 0449c1806..7db5d305e 100644 --- a/Sources/ArgumentParser/Usage/DumpHelpGenerator.swift +++ b/Sources/ArgumentParser/Usage/DumpHelpGenerator.swift @@ -9,11 +9,19 @@ // //===----------------------------------------------------------------------===// +#if swift(>=5.11) +internal import ArgumentParserToolInfo +internal import class Foundation.JSONEncoder +#elseif swift(>=5.10) +import ArgumentParserToolInfo +import class Foundation.JSONEncoder +#else @_implementationOnly import ArgumentParserToolInfo @_implementationOnly import class Foundation.JSONEncoder +#endif internal struct DumpHelpGenerator { - var toolInfo: ToolInfoV0 + private var toolInfo: ToolInfoV0 init(_ type: ParsableArguments.Type) { self.init(commandStack: [type.asCommand]) diff --git a/Sources/ArgumentParser/Usage/MessageInfo.swift b/Sources/ArgumentParser/Usage/MessageInfo.swift index cb1da6f4d..bb9a4ea1d 100644 --- a/Sources/ArgumentParser/Usage/MessageInfo.swift +++ b/Sources/ArgumentParser/Usage/MessageInfo.swift @@ -9,8 +9,16 @@ // //===----------------------------------------------------------------------===// +#if swift(>=5.11) +internal import protocol Foundation.LocalizedError +internal import class Foundation.NSError +#elseif swift(>=5.10) +import protocol Foundation.LocalizedError +import class Foundation.NSError +#else @_implementationOnly import protocol Foundation.LocalizedError @_implementationOnly import class Foundation.NSError +#endif enum MessageInfo { case help(text: String) diff --git a/Sources/ArgumentParser/Usage/UsageGenerator.swift b/Sources/ArgumentParser/Usage/UsageGenerator.swift index c6270ae42..e34b94ee6 100644 --- a/Sources/ArgumentParser/Usage/UsageGenerator.swift +++ b/Sources/ArgumentParser/Usage/UsageGenerator.swift @@ -9,7 +9,13 @@ // //===----------------------------------------------------------------------===// +#if swift(>=5.11) +internal import protocol Foundation.LocalizedError +#elseif swift(>=5.10) +import protocol Foundation.LocalizedError +#else @_implementationOnly import protocol Foundation.LocalizedError +#endif struct UsageGenerator { var toolName: String