Skip to content

Commit 7f4ce2d

Browse files
authored
Eliminate warnings re: CommandConfiguration init (#636)
When the old (pre-aliases) initializer has all its default parameter values, it is selected as the overload because it has fewer parameters overall. Removing the default parameters allows it to still satisfy (very niche) source compat requirements without actually being available as an overload. (Also resolves an extra warning in the tests)
1 parent cfac15f commit 7f4ce2d

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

Sources/ArgumentParser/Parsable Types/CommandConfiguration.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -146,18 +146,18 @@ public struct CommandConfiguration: Sendable {
146146
extension CommandConfiguration {
147147
@available(*, deprecated, message: "Use the memberwise initializer with the aliases parameter.")
148148
public init(
149-
commandName: String? = nil,
150-
abstract: String = "",
151-
usage: String? = nil,
152-
discussion: String = "",
153-
version: String = "",
154-
shouldDisplay: Bool = true,
155-
subcommands: [ParsableCommand.Type] = [],
156-
defaultSubcommand: ParsableCommand.Type? = nil,
157-
helpNames: NameSpecification? = nil
149+
commandName _commandName: String?,
150+
abstract: String,
151+
usage: String?,
152+
discussion: String,
153+
version: String,
154+
shouldDisplay: Bool,
155+
subcommands: [ParsableCommand.Type],
156+
defaultSubcommand: ParsableCommand.Type?,
157+
helpNames: NameSpecification?
158158
) {
159159
self.init(
160-
commandName: commandName,
160+
commandName: _commandName,
161161
abstract: abstract,
162162
usage: usage,
163163
discussion: discussion,

Sources/ArgumentParserTestHelpers/TestHelpers.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ extension CollectionDifference.Change {
2626
}
2727

2828
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
29-
extension CollectionDifference.Change: Comparable where ChangeElement: Equatable {
29+
extension CollectionDifference.Change: Swift.Comparable
30+
where ChangeElement: Equatable
31+
{
3032
public static func < (lhs: Self, rhs: Self) -> Bool {
3133
guard lhs.offset == rhs.offset else {
3234
return lhs.offset < rhs.offset

0 commit comments

Comments
 (0)