[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.
This commit is contained in:
Roman Levenstein
2017-04-26 13:02:24 -07:00
parent 7bc012ab16
commit c897316a8c

View File

@@ -1958,12 +1958,14 @@ SILValue ReabstractionThunkGenerator::createReabstractionThunkApply(
SILBasicBlock *ErrorBB = Thunk->createBasicBlock();
Builder.createTryApply(Loc, FRI, CalleeSILSubstFnTy, Subs,
Arguments, NormalBB, ErrorBB);
auto *ErrorVal = ErrorBB->createPHIArgument(specConv.getSILErrorType(),
ValueOwnershipKind::Owned);
auto *ErrorVal = ErrorBB->createPHIArgument(
SpecializedFunc->mapTypeIntoContext(specConv.getSILErrorType()),
ValueOwnershipKind::Owned);
Builder.setInsertionPoint(ErrorBB);
Builder.createThrow(Loc, ErrorVal);
SILValue ReturnValue = NormalBB->createPHIArgument(
specConv.getSILResultType(), ValueOwnershipKind::Owned);
SpecializedFunc->mapTypeIntoContext(specConv.getSILResultType()),
ValueOwnershipKind::Owned);
Builder.setInsertionPoint(NormalBB);
return ReturnValue;
}