Skip to content

Commit 80879b1

Browse files
authored
Merge pull request swiftlang#64999 from keith/ks/include-extended-typealias-in-index-data
Include extended typealias in index data
2 parents 49e50a5 + e80bbd5 commit 80879b1

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

lib/Index/Index.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,8 +1504,8 @@ bool IndexSwiftASTWalker::reportExtension(ExtensionDecl *D) {
15041504
if (!startEntity(D, Info, /*IsRef=*/false))
15051505
return false;
15061506

1507-
if (!reportRelatedRef(NTD, Loc, /*isImplicit=*/false,
1508-
(SymbolRoleSet)SymbolRole::RelationExtendedBy, D))
1507+
TypeLoc TL(D->getExtendedTypeRepr(), D->getExtendedType());
1508+
if (!reportRelatedTypeRef(TL, (SymbolRoleSet)SymbolRole::RelationExtendedBy, D))
15091509
return false;
15101510
if (!reportInheritedTypeRefs(D->getInherited(), D))
15111511
return false;

test/Index/roles.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,3 +499,13 @@ protocol WithPrimary<Assoc> {
499499
// CHECK: [[@LINE-1]]:18 | type-alias/associated-type/Swift | Assoc | {{.*}} | Def,RelChild | rel: 1
500500
// CHECK-NEXT: RelChild | protocol/Swift | WithPrimary | {{.*}}
501501
}
502+
503+
struct Root {} // CHECK: [[@LINE]]:8 | struct/Swift | Root | [[Root_USR:.*]] | Def | rel: 0
504+
505+
typealias Alias = Root // CHECK: [[@LINE]]:11 | type-alias/Swift | Alias | [[Alias_USR:.*]] | Def | rel: 0
506+
507+
extension Alias {
508+
// CHECK: [[@LINE-1]]:11 | type-alias/Swift | Alias | [[Alias_USR]] | Ref | rel: 0
509+
// CHECK: [[@LINE-2]]:11 | struct/Swift | Root | [[Root_USR]] | Ref,Impl,RelExt | rel: 1
510+
func empty() {}
511+
}

0 commit comments

Comments
 (0)