don't use null types when determining extension access level (#61227)

rdar://100169094

Co-authored-by: Max Obermeier <themomax@icloud.com>
This commit is contained in:
QuietMisdreavus
2022-09-21 16:19:04 -04:00
committed by GitHub
parent 6424835d36
commit 4413cee7bf
2 changed files with 18 additions and 3 deletions

View File

@@ -801,9 +801,11 @@ AccessLevel Symbol::getEffectiveAccessLevel(const ExtensionDecl *ED) {
AccessLevel maxInheritedAL = AccessLevel::Private;
for (auto Inherited : ED->getInherited()) {
if (const auto *Proto = dyn_cast_or_null<ProtocolDecl>(
Inherited.getType()->getAnyNominal())) {
maxInheritedAL = std::max(maxInheritedAL, Proto->getFormalAccess());
if (const auto Type = Inherited.getType()) {
if (const auto *Proto = dyn_cast_or_null<ProtocolDecl>(
Type->getAnyNominal())) {
maxInheritedAL = std::max(maxInheritedAL, Proto->getFormalAccess());
}
}
}