Skip to content

Commit 2fbd89d

Browse files
committed
[Typechecker] Simplify StorageImplInfo code in finishPropertyWrapperImplInfo and check for AccessorKind in synthesizeCoroutineAccessorBody
1 parent 84f8e41 commit 2fbd89d

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

lib/Sema/TypeCheckStorage.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,7 +1669,7 @@ synthesizeCoroutineAccessorBody(AccessorDecl *accessor, ASTContext &ctx) {
16691669

16701670
// If this is a variable with an attached property wrapper, then
16711671
// the accessors need to yield the wrappedValue or projectedValue.
1672-
if (storage->getReadImpl() == ReadImplKind::Read ||
1672+
if (accessor->getAccessorKind() == AccessorKind::Read ||
16731673
storageReadWriteImpl == ReadWriteImplKind::Modify) {
16741674
if (auto var = dyn_cast<VarDecl>(storage)) {
16751675
if (var->hasAttachedPropertyWrapper()) {
@@ -2684,15 +2684,16 @@ static void finishPropertyWrapperImplInfo(VarDecl *var,
26842684
}
26852685
}
26862686

2687-
if (wrapperSetterIsUsable) {
2688-
if (var->hasObservers()) {
2689-
info = StorageImplInfo::getMutableComputed();
2690-
return;
2691-
}
2687+
if (!wrapperSetterIsUsable) {
2688+
info = StorageImplInfo::getImmutableComputed();
2689+
return;
2690+
}
2691+
2692+
if (var->hasObservers()) {
2693+
info = StorageImplInfo::getMutableComputed();
2694+
} else {
26922695
info = StorageImplInfo(ReadImplKind::Get, WriteImplKind::Set,
26932696
ReadWriteImplKind::Modify);
2694-
} else {
2695-
info = StorageImplInfo::getImmutableComputed();
26962697
}
26972698
}
26982699

0 commit comments

Comments
 (0)