@@ -1506,6 +1506,9 @@ bool IndexSwiftASTWalker::reportRelatedRef(ValueDecl *D, SourceLoc Loc, bool isI
15061506bool IndexSwiftASTWalker::reportInheritedTypeRefs (InheritedTypes Inherited,
15071507 Decl *Inheritee) {
15081508 for (auto Base : Inherited.getEntries ()) {
1509+ // Suppressed conformances aren't considered base types.
1510+ if (Base.isSuppressed ())
1511+ continue ;
15091512 if (!reportRelatedTypeRef (Base, (SymbolRoleSet) SymbolRole::RelationBaseOf, Inheritee))
15101513 return false ;
15111514 }
@@ -1516,6 +1519,25 @@ bool IndexSwiftASTWalker::reportRelatedTypeRepr(const TypeRepr *TR,
15161519 SymbolRoleSet Relations,
15171520 Decl *Related, bool Implicit,
15181521 SourceLoc ParentLoc) {
1522+ // Look through parens/specifiers/attributes.
1523+ while (true ) {
1524+ if (TR->isParenType ()) {
1525+ TR = TR->getWithoutParens ();
1526+ continue ;
1527+ }
1528+ if (auto *SPR = dyn_cast<SpecifierTypeRepr>(TR)) {
1529+ TR = SPR->getBase ();
1530+ continue ;
1531+ }
1532+ if (auto *ATR = dyn_cast<AttributedTypeRepr>(TR)) {
1533+ TR = ATR->getTypeRepr ();
1534+ continue ;
1535+ }
1536+ break ;
1537+ }
1538+ // NOTE: We don't yet handle InverseTypeRepr since we don't have an inverse
1539+ // relation for inheritance.
1540+
15191541 if (auto *composite = dyn_cast<CompositionTypeRepr>(TR)) {
15201542 for (auto *Type : composite->getTypes ()) {
15211543 if (!reportRelatedTypeRepr (Type, Relations, Related, Implicit,
@@ -1561,6 +1583,15 @@ bool IndexSwiftASTWalker::reportRelatedTypeRepr(const TypeRepr *TR,
15611583bool IndexSwiftASTWalker::reportRelatedType (Type Ty, SymbolRoleSet Relations,
15621584 Decl *Related, bool Implicit,
15631585 SourceLoc Loc) {
1586+ // Try decompose a protocol composition.
1587+ if (auto *PCT = Ty->getAs <ProtocolCompositionType>()) {
1588+ for (auto member : PCT->getMembers ()) {
1589+ if (!reportRelatedType (member, Relations, Related, Implicit, Loc))
1590+ return false ;
1591+ }
1592+ return true ;
1593+ }
1594+
15641595 if (auto *nominal = Ty->getAnyNominal ()) {
15651596 if (!reportRelatedRef (nominal, Loc, Implicit, Relations, Related))
15661597 return false ;
0 commit comments