diff --git a/Package@swift-5.8.swift b/Package@swift-5.8.swift index 4306ab956..fb860aff1 100644 --- a/Package@swift-5.8.swift +++ b/Package@swift-5.8.swift @@ -138,3 +138,17 @@ package.targets.append(contentsOf: [ path: "Tools/changelog-authors"), ]) #endif + +for target in package.targets { + switch target.type { + case .regular, .test, .executable: + var settings = target.swiftSettings ?? [] + // https://github.com/swiftlang/swift-evolution/blob/main/proposals/0444-member-import-visibility.md + settings.append(.enableUpcomingFeature("MemberImportVisibility")) + target.swiftSettings = settings + case .macro, .plugin, .system, .binary: + break // not applicable + @unknown default: + break // we don't know what to do here, do nothing + } +} diff --git a/Sources/ArgumentParser/Completions/BashCompletionsGenerator.swift b/Sources/ArgumentParser/Completions/BashCompletionsGenerator.swift index 4f7bd8425..85da31704 100644 --- a/Sources/ArgumentParser/Completions/BashCompletionsGenerator.swift +++ b/Sources/ArgumentParser/Completions/BashCompletionsGenerator.swift @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -#if swift(>=6.0) +#if compiler(>=6.0) internal import ArgumentParserToolInfo #else import ArgumentParserToolInfo diff --git a/Sources/ArgumentParser/Completions/CompletionsGenerator.swift b/Sources/ArgumentParser/Completions/CompletionsGenerator.swift index d196d00be..87e3932a0 100644 --- a/Sources/ArgumentParser/Completions/CompletionsGenerator.swift +++ b/Sources/ArgumentParser/Completions/CompletionsGenerator.swift @@ -9,10 +9,12 @@ // //===----------------------------------------------------------------------===// -#if swift(>=6.0) +#if compiler(>=6.0) internal import ArgumentParserToolInfo +internal import Foundation #else import ArgumentParserToolInfo +import Foundation #endif /// A shell for which the parser can generate a completion script. diff --git a/Sources/ArgumentParser/Completions/FishCompletionsGenerator.swift b/Sources/ArgumentParser/Completions/FishCompletionsGenerator.swift index 3a722a8e6..549fdf846 100644 --- a/Sources/ArgumentParser/Completions/FishCompletionsGenerator.swift +++ b/Sources/ArgumentParser/Completions/FishCompletionsGenerator.swift @@ -9,10 +9,12 @@ // //===----------------------------------------------------------------------===// -#if swift(>=6.0) +#if compiler(>=6.0) internal import ArgumentParserToolInfo +internal import Foundation #else import ArgumentParserToolInfo +import Foundation #endif extension ToolInfoV0 { diff --git a/Sources/ArgumentParser/Completions/ZshCompletionsGenerator.swift b/Sources/ArgumentParser/Completions/ZshCompletionsGenerator.swift index 60296aa24..4ed8c90cf 100644 --- a/Sources/ArgumentParser/Completions/ZshCompletionsGenerator.swift +++ b/Sources/ArgumentParser/Completions/ZshCompletionsGenerator.swift @@ -9,10 +9,12 @@ // //===----------------------------------------------------------------------===// -#if swift(>=6.0) +#if compiler(>=6.0) internal import ArgumentParserToolInfo +internal import Foundation #else import ArgumentParserToolInfo +import Foundation #endif extension ToolInfoV0 { diff --git a/Sources/ArgumentParser/Parsable Types/ParsableArguments.swift b/Sources/ArgumentParser/Parsable Types/ParsableArguments.swift index 1154d6278..6eb0d5483 100644 --- a/Sources/ArgumentParser/Parsable Types/ParsableArguments.swift +++ b/Sources/ArgumentParser/Parsable Types/ParsableArguments.swift @@ -9,6 +9,12 @@ // //===----------------------------------------------------------------------===// +#if compiler(>=6.0) +internal import Foundation +#else +import Foundation +#endif + /// A type that can be parsed from a program's command-line arguments. /// /// When you implement a `ParsableArguments` type, all properties must be declared with diff --git a/Sources/ArgumentParser/Parsing/CommandParser.swift b/Sources/ArgumentParser/Parsing/CommandParser.swift index 3f2f08ccd..e4b42f440 100644 --- a/Sources/ArgumentParser/Parsing/CommandParser.swift +++ b/Sources/ArgumentParser/Parsing/CommandParser.swift @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -#if swift(>=6.0) +#if compiler(>=6.0) #if canImport(Dispatch) @preconcurrency private import class Dispatch.DispatchSemaphore #endif diff --git a/Sources/ArgumentParser/Usage/DumpHelpGenerator.swift b/Sources/ArgumentParser/Usage/DumpHelpGenerator.swift index 1dbd28fdf..895b27a6d 100644 --- a/Sources/ArgumentParser/Usage/DumpHelpGenerator.swift +++ b/Sources/ArgumentParser/Usage/DumpHelpGenerator.swift @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -#if swift(>=6.0) +#if compiler(>=6.0) internal import ArgumentParserToolInfo internal import class Foundation.JSONEncoder #else diff --git a/Sources/ArgumentParser/Usage/MessageInfo.swift b/Sources/ArgumentParser/Usage/MessageInfo.swift index 4e42b4601..7d0c8a2c3 100644 --- a/Sources/ArgumentParser/Usage/MessageInfo.swift +++ b/Sources/ArgumentParser/Usage/MessageInfo.swift @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -#if swift(>=6.0) +#if compiler(>=6.0) internal import protocol Foundation.LocalizedError internal import class Foundation.NSError #else diff --git a/Sources/ArgumentParser/Usage/UsageGenerator.swift b/Sources/ArgumentParser/Usage/UsageGenerator.swift index 9c628c0cc..f73d80d1f 100644 --- a/Sources/ArgumentParser/Usage/UsageGenerator.swift +++ b/Sources/ArgumentParser/Usage/UsageGenerator.swift @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -#if swift(>=6.0) +#if compiler(>=6.0) internal import protocol Foundation.LocalizedError #else import protocol Foundation.LocalizedError diff --git a/Sources/ArgumentParser/Utilities/Mutex.swift b/Sources/ArgumentParser/Utilities/Mutex.swift index 2f3bd040d..3a3c4244b 100644 --- a/Sources/ArgumentParser/Utilities/Mutex.swift +++ b/Sources/ArgumentParser/Utilities/Mutex.swift @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -#if swift(>=6.0) +#if compiler(>=6.0) internal import Foundation #else import Foundation diff --git a/Sources/ArgumentParserTestHelpers/StringHelpers.swift b/Sources/ArgumentParserTestHelpers/StringHelpers.swift index 5baf377b0..639ed4479 100644 --- a/Sources/ArgumentParserTestHelpers/StringHelpers.swift +++ b/Sources/ArgumentParserTestHelpers/StringHelpers.swift @@ -9,6 +9,12 @@ // //===----------------------------------------------------------------------===// +#if compiler(>=6.0) +internal import Foundation +#else +import Foundation +#endif + extension Substring { func trimmed() -> Substring { guard let i = lastIndex(where: { $0 != " " }) else { diff --git a/Tests/ArgumentParserExampleTests/MathExampleTests.swift b/Tests/ArgumentParserExampleTests/MathExampleTests.swift index f1928f915..2c9a666cb 100644 --- a/Tests/ArgumentParserExampleTests/MathExampleTests.swift +++ b/Tests/ArgumentParserExampleTests/MathExampleTests.swift @@ -9,15 +9,10 @@ // //===----------------------------------------------------------------------===// -import ArgumentParser import ArgumentParserTestHelpers import XCTest -#if swift(>=6.0) -@testable internal import struct ArgumentParser.CompletionShell -#else -@testable import struct ArgumentParser.CompletionShell -#endif +@testable import ArgumentParser final class MathExampleTests: XCTestCase { override func setUp() { diff --git a/Tests/ArgumentParserExampleTests/RepeatExampleTests.swift b/Tests/ArgumentParserExampleTests/RepeatExampleTests.swift index b0ff5ece8..4410289eb 100644 --- a/Tests/ArgumentParserExampleTests/RepeatExampleTests.swift +++ b/Tests/ArgumentParserExampleTests/RepeatExampleTests.swift @@ -9,6 +9,7 @@ // //===----------------------------------------------------------------------===// +import ArgumentParser import ArgumentParserTestHelpers import XCTest diff --git a/Tests/ArgumentParserExampleTests/RollDiceExampleTests.swift b/Tests/ArgumentParserExampleTests/RollDiceExampleTests.swift index 2d508f2bc..e8abeaf21 100644 --- a/Tests/ArgumentParserExampleTests/RollDiceExampleTests.swift +++ b/Tests/ArgumentParserExampleTests/RollDiceExampleTests.swift @@ -9,6 +9,7 @@ // //===----------------------------------------------------------------------===// +import ArgumentParser import ArgumentParserTestHelpers import XCTest