mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Sema: Accessors's SPI are tied to the attributes on the storage
Recent changes started using SPIGroupRequest on accessors specifically to verify access to the wrappedValue of PropertyWrappers within the direct access logic on variables using the property wrapper. Update SPIGroupRequest to support this request and the type-checking logic to accept the @_spi attribute on internal usable from inline accessors. rdar://141964200
This commit is contained in:
@@ -3191,6 +3191,14 @@ SPIGroupsRequest::evaluate(Evaluator &evaluator, const Decl *decl) const {
|
||||
spiGroups.insert(originalSPIs.begin(), originalSPIs.end());
|
||||
}
|
||||
|
||||
// Accessors get the SPI groups from the PBD.
|
||||
if (auto AD = dyn_cast<AccessorDecl>(decl))
|
||||
if (auto VD = dyn_cast<VarDecl>(AD->getStorage()))
|
||||
if (auto *PBD = VD->getParentPatternBinding()) {
|
||||
auto moreGroups = PBD->getSPIGroups();
|
||||
spiGroups.insert(moreGroups.begin(), moreGroups.end());
|
||||
}
|
||||
|
||||
// If there is no local SPI information, look at the context.
|
||||
if (spiGroups.empty()) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user