Skip to content

Commit a478cd7

Browse files
committed
[SILGen] When creating an assign_by_wrapper instruction, substitute
the setter type before attempting to emit a load in the case where the setter is nonmutating and must capture self by value.
1 parent 6efd52d commit a478cd7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/SILGen/SILGenLValue.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,7 +1490,9 @@ namespace {
14901490
}
14911491

14921492
CanSILFunctionType setterTy = setterFRef->getType().castTo<SILFunctionType>();
1493-
SILFunctionConventions setterConv(setterTy, SGF.SGM.M);
1493+
auto substSetterTy = setterTy->substGenericArgs(SGF.SGM.M, Substitutions,
1494+
SGF.getTypeExpansionContext());
1495+
SILFunctionConventions setterConv(substSetterTy, SGF.SGM.M);
14941496

14951497
// Emit captures for the setter
14961498
SmallVector<SILValue, 4> capturedArgs;
@@ -1538,8 +1540,6 @@ namespace {
15381540
assert(value.isRValue());
15391541
ManagedValue Mval = std::move(value).asKnownRValue(SGF).
15401542
getAsSingleValue(SGF, loc);
1541-
auto substSetterTy = setterTy->substGenericArgs(SGF.SGM.M, Substitutions,
1542-
SGF.getTypeExpansionContext());
15431543
auto param = substSetterTy->getParameters()[0];
15441544
SILType loweredSubstArgType = Mval.getType();
15451545
if (param.isIndirectInOut()) {

0 commit comments

Comments
 (0)