Skip to content

Commit 4413cee

Browse files
don't use null types when determining extension access level (#61227)
rdar://100169094 Co-authored-by: Max Obermeier <[email protected]>
1 parent 6424835 commit 4413cee

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

lib/SymbolGraphGen/Symbol.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -801,9 +801,11 @@ AccessLevel Symbol::getEffectiveAccessLevel(const ExtensionDecl *ED) {
801801

802802
AccessLevel maxInheritedAL = AccessLevel::Private;
803803
for (auto Inherited : ED->getInherited()) {
804-
if (const auto *Proto = dyn_cast_or_null<ProtocolDecl>(
805-
Inherited.getType()->getAnyNominal())) {
806-
maxInheritedAL = std::max(maxInheritedAL, Proto->getFormalAccess());
804+
if (const auto Type = Inherited.getType()) {
805+
if (const auto *Proto = dyn_cast_or_null<ProtocolDecl>(
806+
Type->getAnyNominal())) {
807+
maxInheritedAL = std::max(maxInheritedAL, Proto->getFormalAccess());
808+
}
807809
}
808810
}
809811

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %sourcekitd-test -req=cursor -pos=9:28 -req-opts=retrieve_symbol_graph=1 %s -- %s
2+
3+
extension ResourceRecordType {
4+
public var debugDescription: String {
5+
public struct HostRecord<IPType: IP> {
6+
}
7+
extension HostRecord: Hashable {
8+
public struct StartOfAuthorityRecord {
9+
public var a
10+
}
11+
}
12+
}
13+
}

0 commit comments

Comments
 (0)