Skip to content

Commit 07c7b5a

Browse files
authored
Merge pull request swiftlang#14886 from gottesmm/pr-1d8a01abff8ba53eef44341acc0e36484a133f95
2 parents e27c8c8 + dc56ec1 commit 07c7b5a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/SILGen/SILGenApply.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3788,6 +3788,10 @@ CallEmission::applyPartiallyAppliedSuperMethod(SGFContext C) {
37883788
auto subs = callee.getSubstitutions();
37893789
auto upcastedSelf = uncurriedArgs.back();
37903790

3791+
// Make sure that upcasted self is at +1 since we are going to place it into a
3792+
// partial_apply.
3793+
upcastedSelf = upcastedSelf.ensurePlusOne(SGF, loc);
3794+
37913795
auto constantInfo = SGF.getConstantInfo(callee.getMethodName());
37923796
auto functionTy = constantInfo.getSILType();
37933797
ManagedValue superMethod;
@@ -3813,11 +3817,9 @@ CallEmission::applyPartiallyAppliedSuperMethod(SGFContext C) {
38133817
if (constantInfo.SILFnType->isPolymorphic() && !subs.empty())
38143818
partialApplyTy = partialApplyTy.substGenericArgs(module, subs);
38153819

3816-
SILValue partialApply =
3817-
SGF.B.createPartialApply(loc, superMethod.getValue(), partialApplyTy,
3818-
subs, {upcastedSelf.forward(SGF)}, closureTy);
3820+
ManagedValue pa = SGF.B.createPartialApply(loc, superMethod, partialApplyTy,
3821+
subs, {upcastedSelf}, closureTy);
38193822
assert(!closureTy.castTo<SILFunctionType>()->isNoEscape());
3820-
ManagedValue pa = SGF.emitManagedRValueWithCleanup(partialApply);
38213823
firstLevelResult.value = RValue(SGF, loc, formalApplyType.getResult(), pa);
38223824
return firstLevelResult;
38233825
}

0 commit comments

Comments
 (0)