mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
When storing a closure with type `() throws(any Error) -> ()` as a fully opaque error, we want to leave it unchanged, instead of re-abstracting it to throw the error indirectly. Thus, we had a special carveout here. However, the carveout was too broad, because if the thrown error type contained type parameters, the resulting AbstractionPattern was invalid. While fixing this I realized this entire hack is unsound in some cases, if you view the same value as a `() throws(U) -> ()` vs an `() -> throws(any Error) -> ()`. Perhaps we should always box the thrown error when maximally abstracting a closure, but that would also be an ABI break. - Fixes https://github.com/swiftlang/swift/issues/84051