SIL: Fix bug in AbstractionPattern::getFunctionThrownErrorType() #84207
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When storing a closure with type
() throws(any Error) -> ()
as a fully opaque value, 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.