Skip to content

Commit

Permalink
Fix Swift 5.9/5.10 compiler issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Alkenso committed Oct 17, 2024
1 parent 71299e2 commit 0016cae
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public struct Closure<T, R> {
}

public func callAsFunction<each Arg>(_ args: repeat each Arg) -> R where T == (repeat each Arg) {
body((repeat each args))
body(makeTuple(repeat each args))
}
}

Expand Down Expand Up @@ -64,7 +64,7 @@ public struct ThrowingClosure<T, R> {
}

public func callAsFunction<each Arg>(_ args: repeat each Arg) throws -> R where T == (repeat each Arg) {
try body((repeat each args))
try body(makeTuple(repeat each args))
}
}

Expand All @@ -82,3 +82,8 @@ extension ThrowingClosure {
ThrowingClosure { value in try queue.sync { try self(value) } }
}
}

// Workaround to make Swift 5.9/5.10 compilers happy.
private func makeTuple<each Element>(_ element: repeat each Element) -> (repeat each Element) {
(repeat each element)
}

0 comments on commit 0016cae

Please sign in to comment.