Skip to content

Commit fbb8bd2

Browse files
committed
[+0-normal-args] When emitting curry thunks, be sure that partial apply arguments are always at +1.
This enables curry thunks to handle properly +0 arguments that are captured by a partial apply. I am pretty sure that this can not happen without +0. It occurs relatively frequently in the SILGen tests when you run with ownership enabled. rdar://34222540
1 parent 3465d23 commit fbb8bd2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/SILGen/SILGenThunk.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ void SILGenFunction::emitCurryThunk(SILDeclRef thunk) {
168168
resultTy = F.mapTypeIntoContext(resultTy);
169169
auto substTy = toFn.getType().substGenericArgs(SGM.M, subs);
170170

171-
auto calleeConvention = ParameterConvention::Direct_Guaranteed;
172-
173171
// Partially apply the next uncurry level and return the result closure.
172+
selfArg = selfArg.ensurePlusOne(*this, vd);
173+
auto calleeConvention = ParameterConvention::Direct_Guaranteed;
174174
auto closureTy = SILGenBuilder::getPartialApplyResultType(
175175
toFn.getType(), /*appliedParams=*/1, SGM.M, subs, calleeConvention);
176176
ManagedValue toClosure =

0 commit comments

Comments
 (0)