Skip to content

Commit aefbb6e

Browse files
authored
Fix Swift 5.7 build errors. (#707)
1 parent 1248cc4 commit aefbb6e

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

Sources/ArgumentParser/Utilities/Mutex.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ class Mutex<T>: @unchecked Sendable {
4848
/// - Throws: Re-throws any error thrown by `body`.
4949
///
5050
/// - Returns: The return value, if any, of the `body` closure parameter.
51-
func withLock<U, E>(
52-
_ body: (inout T) throws(E) -> U
53-
) throws(E) -> U where E: Error {
51+
func withLock<U>(
52+
_ body: (inout T) throws -> U
53+
) rethrows -> U {
5454
self.lock.lock()
5555
defer { self.lock.unlock() }
5656
return try body(&self.value)

Tests/ArgumentParserToolInfoTests/ArgumentParserToolInfoTests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Foundation
1313
import XCTest
1414
import ArgumentParserToolInfo
1515

16-
extension DecodingError: @retroactive CustomStringConvertible {
16+
extension DecodingError: Swift.CustomStringConvertible {
1717
public var description: String {
1818
func pathDescription(_ path: [any CodingKey]) -> String {
1919
var description = ""

Tools/generate-docc-reference/Extensions/ArgumentParser+Markdown.swift

+9-9
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,15 @@ extension ArgumentInfoV0 {
108108

109109
// TODO: default values, short, etc.
110110

111-
var inner =
112-
switch self.kind {
113-
case .positional:
114-
"<\(names.joined(separator: "|"))>"
115-
case .option:
116-
"--\(names.joined(separator: "|"))=<\(self.valueName ?? "")>"
117-
case .flag:
118-
"--\(names.joined(separator: "|"))"
119-
}
111+
var inner: String
112+
switch self.kind {
113+
case .positional:
114+
inner = "<\(names.joined(separator: "|"))>"
115+
case .option:
116+
inner = "--\(names.joined(separator: "|"))=<\(self.valueName ?? "")>"
117+
case .flag:
118+
inner = "--\(names.joined(separator: "|"))"
119+
}
120120

121121
if self.isRepeating {
122122
inner += "..."

0 commit comments

Comments
 (0)