Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Package@swift-5.8.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//
//===----------------------------------------------------------------------===//

#if swift(>=6.0)
#if compiler(>=6.0)
internal import ArgumentParserToolInfo
#else
import ArgumentParserToolInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
//
//===----------------------------------------------------------------------===//

#if swift(>=6.0)
#if compiler(>=6.0)
internal import ArgumentParserToolInfo
internal import Foundation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im curious what is using foundation from this file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/Users/allan/Downloads/swift-argument-parser/Sources/ArgumentParser/Completions/CompletionsGenerator.swift:160:9: error: instance method 'replacingOccurrences(of:with:options:range:)' is not available due to missing import of defining module 'Foundation'
      : replacingOccurrences(of: "'", with: "'\\''")
        ^
/Users/allan/Downloads/swift-argument-parser/Sources/ArgumentParser/Completions/CompletionsGenerator.swift:14:1: note: add import of module 'Foundation'
//internal import Foundation
^
/Users/allan/Downloads/swift-argument-parser/Sources/ArgumentParser/Completions/CompletionsGenerator.swift:165:5: error: instance method 'replacingOccurrences(of:with:options:range:)' is not available due to missing import of defining module 'Foundation'
    replacingOccurrences(of: "-", with: "_")
    ^
/Users/allan/Downloads/swift-argument-parser/Sources/ArgumentParser/Completions/CompletionsGenerator.swift:14:1: note: add import of module 'Foundation'
//internal import Foundation
^

#else
import ArgumentParserToolInfo
import Foundation
#endif

/// A shell for which the parser can generate a completion script.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Sources/ArgumentParser/Parsing/CommandParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//
//===----------------------------------------------------------------------===//

#if swift(>=6.0)
#if compiler(>=6.0)
#if canImport(Dispatch)
@preconcurrency private import class Dispatch.DispatchSemaphore
#endif
Expand Down
2 changes: 1 addition & 1 deletion Sources/ArgumentParser/Usage/DumpHelpGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//
//===----------------------------------------------------------------------===//

#if swift(>=6.0)
#if compiler(>=6.0)
internal import ArgumentParserToolInfo
internal import class Foundation.JSONEncoder
#else
Expand Down
2 changes: 1 addition & 1 deletion Sources/ArgumentParser/Usage/MessageInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//
//===----------------------------------------------------------------------===//

#if swift(>=6.0)
#if compiler(>=6.0)
internal import protocol Foundation.LocalizedError
internal import class Foundation.NSError
#else
Expand Down
2 changes: 1 addition & 1 deletion Sources/ArgumentParser/Usage/UsageGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//
//===----------------------------------------------------------------------===//

#if swift(>=6.0)
#if compiler(>=6.0)
internal import protocol Foundation.LocalizedError
#else
import protocol Foundation.LocalizedError
Expand Down
2 changes: 1 addition & 1 deletion Sources/ArgumentParser/Utilities/Mutex.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//
//===----------------------------------------------------------------------===//

#if swift(>=6.0)
#if compiler(>=6.0)
internal import Foundation
#else
import Foundation
Expand Down
6 changes: 6 additions & 0 deletions Sources/ArgumentParserTestHelpers/StringHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 1 addition & 6 deletions Tests/ArgumentParserExampleTests/MathExampleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this file need @testable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/Users/allan/Downloads/swift-argument-parser/Tests/ArgumentParserExampleTests/MathExampleTests.swift:252:23: error: 'format' is inaccessible due to 'internal' protection level
      expected: shell.format(completions: [
                      ^~~~~~
ArgumentParser.CompletionShell.format:2:15: note: 'format(completions:)' declared here
internal func format(completions: [String]) -> String}
              ^
/Users/allan/Downloads/swift-argument-parser/Tests/ArgumentParserExampleTests/MathExampleTests.swift:258:25: error: 'shellEnvironmentVariableName' is inaccessible due to 'internal' protection level
        CompletionShell.shellEnvironmentVariableName: shell.rawValue
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
ArgumentParser.CompletionShell.shellEnvironmentVariableName:2:21: note: 'shellEnvironmentVariableName' declared here
internal static let shellEnvironmentVariableName: String}
                    ^
/Users/allan/Downloads/swift-argument-parser/Tests/ArgumentParserExampleTests/MathExampleTests.swift:264:23: error: 'format' is inaccessible due to 'internal' protection level
      expected: shell.format(completions: [
                      ^~~~~~
ArgumentParser.CompletionShell.format:2:15: note: 'format(completions:)' declared here
internal func format(completions: [String]) -> String}
              ^
/Users/allan/Downloads/swift-argument-parser/Tests/ArgumentParserExampleTests/MathExampleTests.swift:270:25: error: 'shellEnvironmentVariableName' is inaccessible due to 'internal' protection level
        CompletionShell.shellEnvironmentVariableName: shell.rawValue
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
ArgumentParser.CompletionShell.shellEnvironmentVariableName:2:21: note: 'shellEnvironmentVariableName' declared here
internal static let shellEnvironmentVariableName: String}
                    ^
/Users/allan/Downloads/swift-argument-parser/Tests/ArgumentParserExampleTests/MathExampleTests.swift:276:23: error: 'format' is inaccessible due to 'internal' protection level
      expected: shell.format(completions: [
                      ^~~~~~
ArgumentParser.CompletionShell.format:2:15: note: 'format(completions:)' declared here
internal func format(completions: [String]) -> String}
              ^
/Users/allan/Downloads/swift-argument-parser/Tests/ArgumentParserExampleTests/MathExampleTests.swift:281:25: error: 'shellEnvironmentVariableName' is inaccessible due to 'internal' protection level
        CompletionShell.shellEnvironmentVariableName: shell.rawValue
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
ArgumentParser.CompletionShell.shellEnvironmentVariableName:2:21: note: 'shellEnvironmentVariableName' declared here
internal static let shellEnvironmentVariableName: String}
                    ^


final class MathExampleTests: XCTestCase {
override func setUp() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
//
//===----------------------------------------------------------------------===//

import ArgumentParser
import ArgumentParserTestHelpers
import XCTest

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
//
//===----------------------------------------------------------------------===//

import ArgumentParser
import ArgumentParserTestHelpers
import XCTest

Expand Down