[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:
Nathan Hawes
2019-11-18 10:34:58 -08:00
parent 11d20b8c92
commit 43523df08a
5 changed files with 282 additions and 33 deletions

View File

@@ -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;
}