Skip to content

Commit

Permalink
Remove @_implementationOnly annotations (apple#616)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
keith authored Feb 24, 2024
1 parent a0f43bb commit c413809
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Sources/ArgumentParser/Usage/DumpHelpGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
8 changes: 8 additions & 0 deletions Sources/ArgumentParser/Usage/MessageInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions Sources/ArgumentParser/Usage/UsageGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c413809

Please sign in to comment.