Open
Description
Description
Since all the closures have explicit throws
annotations, I don't think this falls afoul of needing FullTypedThrows
.
SourceKit agrees that function
throws(Failure)
, yet the catch
clause is inferred to catch any Error
.
Reproduction
private func _mapFailure<Argument, Return, Failure: Error, NewFailure: Error>(
_ function: @escaping (Argument) throws(Failure) -> Return,
mapping: @escaping (Failure) -> NewFailure
) -> (Argument) throws(NewFailure) -> Return {
{ (argument: Argument) throws(NewFailure) -> Return in
do {
return try function(argument)
} catch {
throw mapping(error) // 🛑: Cannot convert value of type 'any Error' to expected argument type 'Failure'
}
}
}
Expected behavior
this code should compile
Environment
swift-driver version: 1.120.5 Apple Swift version 6.1.2 (swiftlang-6.1.2.1.2 clang-1700.0.13.5)
Target: arm64-apple-macosx15.0
Additional information
This is very similar to #80193, and might be the same underlying issue.