mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Include error type when considering whether a SILFunctionType needs its substitutions.
Fixes rdar://128205122.
This commit is contained in:
@@ -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) {
|
||||
|
||||
13
test/SILGen/error_type_substitution.swift
Normal file
13
test/SILGen/error_type_substitution.swift
Normal 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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user