mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SILGen: Fix key paths that reference internal private(set) decls from other files.
The setter needs to be given hidden linkage so that other files can still form key paths to it.
This commit is contained in:
@@ -314,8 +314,19 @@ SILLinkage SILDeclRef::getLinkage(ForDefinition_t forDefinition) const {
|
||||
neverPublic = true;
|
||||
}
|
||||
}
|
||||
|
||||
auto effectiveAccess = d->getEffectiveAccess();
|
||||
|
||||
// Private setter implementations for an internal storage declaration should
|
||||
// be internal as well, so that a dynamically-writable
|
||||
// keypath can be formed from other files.
|
||||
if (auto accessor = dyn_cast<AccessorDecl>(d)) {
|
||||
if (accessor->isSetter()
|
||||
&& accessor->getStorage()->getEffectiveAccess() == AccessLevel::Internal)
|
||||
effectiveAccess = AccessLevel::Internal;
|
||||
}
|
||||
|
||||
switch (d->getEffectiveAccess()) {
|
||||
switch (effectiveAccess) {
|
||||
case AccessLevel::Private:
|
||||
case AccessLevel::FilePrivate:
|
||||
return maybeAddExternal(SILLinkage::Private);
|
||||
|
||||
Reference in New Issue
Block a user