Include error type when considering whether a SILFunctionType needs its substitutions.

Fixes rdar://128205122.
This commit is contained in:
Joe Groff
2024-06-18 09:56:51 -10:00
parent b7b93a12a0
commit 11df4fa1c3
2 changed files with 17 additions and 0 deletions

View File

@@ -103,6 +103,10 @@ SILType SILBuilder::getPartialApplyResultType(
for (auto yield : FTI->getYields()) {
needsSubstFunctionType |= yield.getInterfaceType()->hasTypeParameter();
}
if (FTI->hasErrorResult()) {
needsSubstFunctionType
|= FTI->getErrorResult().getInterfaceType()->hasTypeParameter();
}
SubstitutionMap appliedSubs;
if (needsSubstFunctionType) {

View File

@@ -0,0 +1,13 @@
// RUN: %target-swift-emit-silgen -verify %s
func consume_a_pointer(x: inout Int) { }
func func_that_rethrows<E: Error>(initializingWith callback: () throws(E) -> Void) throws(E) {
}
public func foo() {
var pk = 42
func_that_rethrows() {
consume_a_pointer(x: &pk)
}
}