From fd8ea096da4bf67a4f140b1be69dc99e910142bb Mon Sep 17 00:00:00 2001 From: Rauhul Varma Date: Wed, 12 Feb 2025 13:01:44 -0800 Subject: [PATCH] Remove `@_implementationOnly` imports (#666) The `@_implementationOnly` attribute does not work correctly without library evolution enabled. The only possible client with this enabled is Apple, however they have updated to the Swift 6 compiler and can use `internal import` instead of this attribute. Therefore there is no need for this package to use the attribute anymore. --- Sources/ArgumentParser/Parsing/CommandParser.swift | 4 +--- Sources/ArgumentParser/Usage/DumpHelpGenerator.swift | 7 ++----- Sources/ArgumentParser/Usage/MessageInfo.swift | 7 ++----- Sources/ArgumentParser/Usage/UsageGenerator.swift | 6 ++---- Sources/ArgumentParser/Utilities/Mutex.swift | 6 ++---- 5 files changed, 9 insertions(+), 21 deletions(-) diff --git a/Sources/ArgumentParser/Parsing/CommandParser.swift b/Sources/ArgumentParser/Parsing/CommandParser.swift index f266fe79..e9cd80b0 100644 --- a/Sources/ArgumentParser/Parsing/CommandParser.swift +++ b/Sources/ArgumentParser/Parsing/CommandParser.swift @@ -11,10 +11,8 @@ #if swift(>=5.11) internal import class Foundation.ProcessInfo -#elseif swift(>=5.10) -import class Foundation.ProcessInfo #else -@_implementationOnly import class Foundation.ProcessInfo +import class Foundation.ProcessInfo #endif struct CommandError: Error { diff --git a/Sources/ArgumentParser/Usage/DumpHelpGenerator.swift b/Sources/ArgumentParser/Usage/DumpHelpGenerator.swift index 9333e4bd..d8f8474e 100644 --- a/Sources/ArgumentParser/Usage/DumpHelpGenerator.swift +++ b/Sources/ArgumentParser/Usage/DumpHelpGenerator.swift @@ -9,15 +9,12 @@ // //===----------------------------------------------------------------------===// -#if swift(>=5.11) +#if swift(>=6.0) internal import ArgumentParserToolInfo internal import class Foundation.JSONEncoder -#elseif swift(>=5.10) +#else import ArgumentParserToolInfo import class Foundation.JSONEncoder -#else -@_implementationOnly import ArgumentParserToolInfo -@_implementationOnly import class Foundation.JSONEncoder #endif internal struct DumpHelpGenerator { diff --git a/Sources/ArgumentParser/Usage/MessageInfo.swift b/Sources/ArgumentParser/Usage/MessageInfo.swift index 957f77c6..2b5dfce1 100644 --- a/Sources/ArgumentParser/Usage/MessageInfo.swift +++ b/Sources/ArgumentParser/Usage/MessageInfo.swift @@ -9,15 +9,12 @@ // //===----------------------------------------------------------------------===// -#if swift(>=5.11) +#if swift(>=6.0) internal import protocol Foundation.LocalizedError internal import class Foundation.NSError -#elseif swift(>=5.10) +#else import protocol Foundation.LocalizedError import class Foundation.NSError -#else -@_implementationOnly import protocol Foundation.LocalizedError -@_implementationOnly import class Foundation.NSError #endif enum MessageInfo { diff --git a/Sources/ArgumentParser/Usage/UsageGenerator.swift b/Sources/ArgumentParser/Usage/UsageGenerator.swift index 84e64819..a3587a23 100644 --- a/Sources/ArgumentParser/Usage/UsageGenerator.swift +++ b/Sources/ArgumentParser/Usage/UsageGenerator.swift @@ -9,12 +9,10 @@ // //===----------------------------------------------------------------------===// -#if swift(>=5.11) +#if swift(>=6.0) internal import protocol Foundation.LocalizedError -#elseif swift(>=5.10) -import protocol Foundation.LocalizedError #else -@_implementationOnly import protocol Foundation.LocalizedError +import protocol Foundation.LocalizedError #endif struct UsageGenerator { diff --git a/Sources/ArgumentParser/Utilities/Mutex.swift b/Sources/ArgumentParser/Utilities/Mutex.swift index 314bd60b..66986bfd 100644 --- a/Sources/ArgumentParser/Utilities/Mutex.swift +++ b/Sources/ArgumentParser/Utilities/Mutex.swift @@ -9,12 +9,10 @@ // //===----------------------------------------------------------------------===// -#if swift(>=5.11) +#if swift(>=6.0) internal import Foundation -#elseif swift(>=5.10) -import Foundation #else -@_implementationOnly import Foundation +import Foundation #endif /// A synchronization primitive that protects shared mutable state via mutual