[SILGen] Correctly determine the thrown error type for closures

When a closure throws a generic error type, we were retrieving the
substituted error type (involving archetypes) when we needed to be
working with the interface type.

Fixes rdar://124484012.
This commit is contained in:
Doug Gregor
2024-03-13 12:51:48 -07:00
parent 1cd7a56ea6
commit f54782eab5
4 changed files with 33 additions and 13 deletions

View File

@@ -1537,6 +1537,11 @@ public:
std::optional<std::pair<AbstractionPattern, CanType>>
getFunctionThrownErrorType(CanAnyFunctionType substFnInterfaceType) const;
/// For the abstraction pattern produced by `getFunctionThrownErrorType()`,
/// produce the effective thrown error type to be used when we don't have
/// a substituted error type.
CanType getEffectiveThrownErrorType() const;
/// Given that the value being abstracted is a function type, return
/// the abstraction pattern for one of its parameter types.
AbstractionPattern getFunctionParamType(unsigned index) const;