mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[IDE] Remove call to getFormalAccess() in inferAccessSyntactically()
It should have been recursing into inferAccessSyntactically() to avoid any chance of triggering name lookup.
This commit is contained in:
@@ -1143,8 +1143,11 @@ static Optional<AccessLevel> inferAccessSyntactically(const ValueDecl *D) {
|
||||
|
||||
if (D->getKind() == DeclKind::Destructor ||
|
||||
D->getKind() == DeclKind::EnumElement) {
|
||||
if (auto container = dyn_cast<NominalTypeDecl>(D->getDeclContext()))
|
||||
return std::max(container->getFormalAccess(), AccessLevel::Internal);
|
||||
if (auto container = dyn_cast<NominalTypeDecl>(D->getDeclContext())) {
|
||||
if (auto containerAccess = inferAccessSyntactically(container))
|
||||
return std::max(containerAccess.getValue(), AccessLevel::Internal);
|
||||
return None;
|
||||
}
|
||||
return AccessLevel::Private;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user