Skip to content

Commit e4009c1

Browse files
authored
Fix Swift 5.7 build errors (#676)
Insert missing comma in targets array in Package.swift to fix Swift 5.7 build break from commit 83c5134. Replace 2 if expressions (which are not supported by Swift 5.7) that were added to ToolInfo.swift by commit 83c5134. Replace switch expression (which is not supported by Swift 5.7) that was added to GenerateManual.swift by commit 44dd206. Replace switch expression (which is not supported by Swift 5.7) that was added to DumpHelpGenerationTests.swift by commit 83c5134. Fixes #675 Signed-off-by: Ross Goldberg <[email protected]>
1 parent 72bf212 commit e4009c1

File tree

4 files changed

+16
-15
lines changed

4 files changed

+16
-15
lines changed

Package.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ var package = Package(
6161
dependencies: ["ArgumentParser"],
6262
path: "Examples/repeat"),
6363
.executableTarget(
64-
name: "color",
65-
dependencies: ["ArgumentParser"],
66-
path: "Examples/color")
64+
name: "color",
65+
dependencies: ["ArgumentParser"],
66+
path: "Examples/color"),
6767

6868
// Tools
6969
.executableTarget(

Sources/ArgumentParserToolInfo/ToolInfo.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,15 @@ public struct CommandInfoV0: Codable, Hashable {
186186
subcommands: [CommandInfoV0],
187187
arguments: [ArgumentInfoV0]
188188
) {
189-
let discussion: Discussion? = if let discussion { .init(discussion) } else { nil }
189+
let discussion2: Discussion?
190+
if let discussion { discussion2 = .init(discussion) } else { discussion2 = nil }
190191

191192
self.init(
192193
superCommands: superCommands,
193194
commandName: commandName,
194195
shouldDisplay: true,
195196
abstract: abstract,
196-
discussion2: discussion,
197+
discussion2: discussion2,
197198
defaultSubcommand: defaultSubcommand,
198199
subcommands: subcommands,
199200
arguments: arguments
@@ -349,7 +350,8 @@ public struct ArgumentInfoV0: Codable, Hashable {
349350
abstract: String?,
350351
discussion: String?
351352
) {
352-
let discussion: Discussion? = if let discussion { .init(discussion) } else { nil }
353+
let discussion2: Discussion?
354+
if let discussion { discussion2 = .init(discussion) } else { discussion2 = nil }
353355

354356
self.init(
355357
kind: kind,
@@ -363,8 +365,7 @@ public struct ArgumentInfoV0: Codable, Hashable {
363365
defaultValue: defaultValue,
364366
allValues: allValues,
365367
abstract: abstract,
366-
discussion2: discussion
368+
discussion2: discussion2
367369
)
368370
}
369371
}
370-

Tests/ArgumentParserUnitTests/DumpHelpGenerationTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ extension DumpHelpGenerationTests {
6464
var defaultValueDescription: String {
6565
switch self {
6666
case .blue:
67-
"A blue color, like the sky!"
67+
return "A blue color, like the sky!"
6868
case .red:
69-
"A red color, like a rose!"
69+
return "A red color, like a rose!"
7070
case .yellow:
71-
"A yellow color, like the sun!"
71+
return "A yellow color, like the sun!"
7272
}
7373
}
7474
}

Tools/generate-manual/GenerateManual.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ extension GenerateManualError: CustomStringConvertible {
2424
var description: String {
2525
switch self {
2626
case let .failedToRunSubprocess(error):
27-
"Failed to run subprocess: \(error)"
27+
return "Failed to run subprocess: \(error)"
2828
case let .unableToParseToolOutput(error):
29-
"Failed to parse tool output: \(error)"
29+
return "Failed to parse tool output: \(error)"
3030
case let .unsupportedDumpHelpVersion(expected, found):
31-
"Unsupported dump help version, expected '\(expected)' but found: '\(found)'"
31+
return "Unsupported dump help version, expected '\(expected)' but found: '\(found)'"
3232
case let .failedToGenerateManualPages(error):
33-
"Failed to generated manual pages: \(error)"
33+
return "Failed to generated manual pages: \(error)"
3434
}
3535
}
3636
}

0 commit comments

Comments
 (0)