Skip to content

Commit d86a301

Browse files
committed
Index: Don't look at getInherited() on deserialized protocol
1 parent 6934046 commit d86a301

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

lib/Index/Index.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,8 +1589,22 @@ bool IndexSwiftASTWalker::report(ValueDecl *D) {
15891589
return false;
15901590
}
15911591
} else if (auto NTD = dyn_cast<NominalTypeDecl>(D)) {
1592-
if (!reportInheritedTypeRefs(NTD->getInherited(), NTD))
1593-
return false;
1592+
auto *PD = dyn_cast<ProtocolDecl>(D);
1593+
if (PD && PD->wasDeserialized()) {
1594+
// Deserialized protocols don't have an inheritance clause.
1595+
for (auto *inherited : PD->getInheritedProtocols()) {
1596+
// FIXME(noncopyable_generics): Do we want to include these?
1597+
if (inherited->getInvertibleProtocolKind())
1598+
continue;
1599+
1600+
if (!reportRelatedRef(inherited, SourceLoc(), /*isImplicit=*/false,
1601+
(SymbolRoleSet) SymbolRole::RelationBaseOf, PD))
1602+
return false;
1603+
}
1604+
} else {
1605+
if (!reportInheritedTypeRefs(NTD->getInherited(), NTD))
1606+
return false;
1607+
}
15941608
}
15951609
} else {
15961610
// Even if we don't record a local property we still need to walk its

0 commit comments

Comments
 (0)