File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -885,8 +885,10 @@ void AttributeChecker::visitSPIAccessControlAttr(SPIAccessControlAttr *attr) {
885885 if (auto VD = dyn_cast<ValueDecl>(D)) {
886886 // VD must be public or open to use an @_spi attribute.
887887 auto declAccess = VD->getFormalAccess ();
888+ auto DC = VD->getDeclContext ()->getAsDecl ();
888889 if (declAccess < AccessLevel::Public &&
889- !VD->getAttrs ().hasAttribute <UsableFromInlineAttr>()) {
890+ !VD->getAttrs ().hasAttribute <UsableFromInlineAttr>() &&
891+ !(DC && DC->isSPI ())) {
890892 diagnoseAndRemoveAttr (attr,
891893 diag::spi_attribute_on_non_public,
892894 declAccess,
@@ -896,7 +898,9 @@ void AttributeChecker::visitSPIAccessControlAttr(SPIAccessControlAttr *attr) {
896898 // Forbid stored properties marked SPI in frozen types.
897899 if (auto property = dyn_cast<AbstractStorageDecl>(VD))
898900 if (auto DC = dyn_cast<NominalTypeDecl>(D->getDeclContext ()))
899- if (property->hasStorage () && !DC->isFormallyResilient ())
901+ if (property->hasStorage () &&
902+ !DC->isFormallyResilient () &&
903+ !DC->isSPI ())
900904 diagnoseAndRemoveAttr (attr,
901905 diag::spi_attribute_on_frozen_stored_properties,
902906 VD->getName ());
Original file line number Diff line number Diff line change @@ -50,6 +50,9 @@ func inlinable() -> SPIClass { // expected-error {{class 'SPIClass' is '@_spi' a
5050@frozen public struct SPIFrozenStruct {
5151 var spiTypeInFrozen = SPIStruct ( )
5252 private var spiTypeInFrozen1 : SPIClass
53+
54+ @_spi ( S)
55+ private var privateSPIInFrozenSPI = SPIStruct ( )
5356}
5457
5558private protocol PrivateProtocol { } // expected-note {{type declared here}}
You can’t perform that action at this time.
0 commit comments