Skip to content

Commit 11df4fa

Browse files
committed
Include error type when considering whether a SILFunctionType needs its substitutions.
Fixes rdar://128205122.
1 parent b7b93a1 commit 11df4fa

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

lib/SIL/IR/SILBuilder.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ SILType SILBuilder::getPartialApplyResultType(
103103
for (auto yield : FTI->getYields()) {
104104
needsSubstFunctionType |= yield.getInterfaceType()->hasTypeParameter();
105105
}
106+
if (FTI->hasErrorResult()) {
107+
needsSubstFunctionType
108+
|= FTI->getErrorResult().getInterfaceType()->hasTypeParameter();
109+
}
106110

107111
SubstitutionMap appliedSubs;
108112
if (needsSubstFunctionType) {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %target-swift-emit-silgen -verify %s
2+
3+
func consume_a_pointer(x: inout Int) { }
4+
5+
func func_that_rethrows<E: Error>(initializingWith callback: () throws(E) -> Void) throws(E) {
6+
}
7+
8+
public func foo() {
9+
var pk = 42
10+
func_that_rethrows() {
11+
consume_a_pointer(x: &pk)
12+
}
13+
}

0 commit comments

Comments
 (0)