Skip to content

Commit

Permalink
Eliminate warnings re: CommandConfiguration init (apple#636)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
natecook1000 authored May 1, 2024
1 parent cfac15f commit 7f4ce2d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
20 changes: 10 additions & 10 deletions Sources/ArgumentParser/Parsable Types/CommandConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -146,18 +146,18 @@ public struct CommandConfiguration: Sendable {
extension CommandConfiguration {
@available(*, deprecated, message: "Use the memberwise initializer with the aliases parameter.")
public init(
commandName: String? = nil,
abstract: String = "",
usage: String? = nil,
discussion: String = "",
version: String = "",
shouldDisplay: Bool = true,
subcommands: [ParsableCommand.Type] = [],
defaultSubcommand: ParsableCommand.Type? = nil,
helpNames: NameSpecification? = nil
commandName _commandName: String?,
abstract: String,
usage: String?,
discussion: String,
version: String,
shouldDisplay: Bool,
subcommands: [ParsableCommand.Type],
defaultSubcommand: ParsableCommand.Type?,
helpNames: NameSpecification?
) {
self.init(
commandName: commandName,
commandName: _commandName,
abstract: abstract,
usage: usage,
discussion: discussion,
Expand Down
4 changes: 3 additions & 1 deletion Sources/ArgumentParserTestHelpers/TestHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ extension CollectionDifference.Change {
}

@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
extension CollectionDifference.Change: Comparable where ChangeElement: Equatable {
extension CollectionDifference.Change: Swift.Comparable
where ChangeElement: Equatable
{
public static func < (lhs: Self, rhs: Self) -> Bool {
guard lhs.offset == rhs.offset else {
return lhs.offset < rhs.offset
Expand Down

0 comments on commit 7f4ce2d

Please sign in to comment.