Skip to content

Commit 6bdfa09

Browse files
committed
Sema: Replace getAccessor() calls in SPI attribute checking
This call only succeeds if the accessor has already been synthesized, which makes it fragile. Replace it with calls to supportsMutation(), or to getOpaqueAccessor(), which lazily evaluate the right requests ahead of time.
1 parent 43fd786 commit 6bdfa09

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/Sema/TypeCheckAttr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -897,8 +897,8 @@ void AttributeChecker::visitSPIAccessControlAttr(SPIAccessControlAttr *attr) {
897897
// implementation defines `set` if the protocol declares it.
898898
if (auto protoStorage = dyn_cast<AbstractStorageDecl>(VD))
899899
if (auto entryStorage = dyn_cast<AbstractStorageDecl>(entryDecl))
900-
if (protoStorage->getAccessor(AccessorKind::Set) &&
901-
!entryStorage->getAccessor(AccessorKind::Set))
900+
if (protoStorage->supportsMutation() &&
901+
!entryStorage->supportsMutation())
902902
return false;
903903

904904
return true;

0 commit comments

Comments
 (0)