Skip to content

Commit c897316

Browse files
committed
[sil-generic-specializer] Fix bugs in the implementation of partial specialization for partial_apply
Do not forget to map interface types to proper contextual types.
1 parent 7bc012a commit c897316

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/SILOptimizer/Utils/Generics.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,12 +1958,14 @@ SILValue ReabstractionThunkGenerator::createReabstractionThunkApply(
19581958
SILBasicBlock *ErrorBB = Thunk->createBasicBlock();
19591959
Builder.createTryApply(Loc, FRI, CalleeSILSubstFnTy, Subs,
19601960
Arguments, NormalBB, ErrorBB);
1961-
auto *ErrorVal = ErrorBB->createPHIArgument(specConv.getSILErrorType(),
1962-
ValueOwnershipKind::Owned);
1961+
auto *ErrorVal = ErrorBB->createPHIArgument(
1962+
SpecializedFunc->mapTypeIntoContext(specConv.getSILErrorType()),
1963+
ValueOwnershipKind::Owned);
19631964
Builder.setInsertionPoint(ErrorBB);
19641965
Builder.createThrow(Loc, ErrorVal);
19651966
SILValue ReturnValue = NormalBB->createPHIArgument(
1966-
specConv.getSILResultType(), ValueOwnershipKind::Owned);
1967+
SpecializedFunc->mapTypeIntoContext(specConv.getSILResultType()),
1968+
ValueOwnershipKind::Owned);
19671969
Builder.setInsertionPoint(NormalBB);
19681970
return ReturnValue;
19691971
}

0 commit comments

Comments
 (0)