Skip to content

Commit 05686f7

Browse files
committed
[SILGen] Always use assign_by_wrapper if a property wrapper assignment
is in an init or if the wrapped var is a local variable.
1 parent a478cd7 commit 05686f7

File tree

1 file changed

+0
-17
lines changed

1 file changed

+0
-17
lines changed

lib/SILGen/SILGenLValue.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,23 +1325,6 @@ namespace {
13251325
wrapperInfo.wrappedValuePlaceholder->getOriginalWrappedValue())
13261326
return false;
13271327

1328-
// If we have a nonmutating setter on a value type, the call
1329-
// captures all of 'self' and we cannot rewrite an assignment
1330-
// into an initialization.
1331-
1332-
// Unless this is an assignment to a self parameter inside a
1333-
// constructor, in which case we would like to still emit a
1334-
// assign_by_wrapper because the setter will be deleted by lowering
1335-
// anyway.
1336-
if (!isAssignmentToSelfParamInInit &&
1337-
!VD->isSetterMutating() &&
1338-
VD->getDeclContext()->getSelfNominalTypeDecl() &&
1339-
VD->isInstanceMember() &&
1340-
!VD->getDeclContext()->getDeclaredInterfaceType()
1341-
->hasReferenceSemantics()) {
1342-
return false;
1343-
}
1344-
13451328
// If this property wrapper uses autoclosure in it's initializer,
13461329
// the argument types of the setter and initializer shall be
13471330
// different, so we don't rewrite an assignment into an

0 commit comments

Comments
 (0)