Skip to content

Commit 5e8c1a4

Browse files
committed
[Index] Avoid passing composition SourceLoc in reportRelatedTypeRef
We want to use the SourceLoc of each individual member of the composition.
1 parent e27f9dd commit 5e8c1a4

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

lib/Index/Index.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,9 +1486,8 @@ bool IndexSwiftASTWalker::reportInheritedTypeRefs(InheritedTypes Inherited,
14861486
bool IndexSwiftASTWalker::reportRelatedTypeRef(const TypeLoc &Ty, SymbolRoleSet Relations,
14871487
Decl *Related, bool Implicit, SourceLoc Loc) {
14881488
if (auto *composite = llvm::dyn_cast_or_null<CompositionTypeRepr>(Ty.getTypeRepr())) {
1489-
SourceLoc IdLoc = Loc.isValid() ? Loc : composite->getSourceLoc();
14901489
for (auto *Type : composite->getTypes()) {
1491-
if (!reportRelatedTypeRef(Type, Relations, Related, /*isImplicit=*/Implicit, IdLoc))
1490+
if (!reportRelatedTypeRef(Type, Relations, Related, /*isImplicit=*/Implicit, Loc))
14921491
return false;
14931492
}
14941493

test/Index/conformances.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class SubMultiConf: BaseMultiConf,P2,P1,P3 { // CHECK: [[@LINE]]:7 | class/Swift
8181

8282
class CompositionType: BaseMultiConf & P1 { // CHECK: [[@LINE]]:7 | class/Swift | CompositionType | [[CompositionType_USR:.*]] | Def
8383
// CHECK: [[@LINE-1]]:24 | class/Swift | BaseMultiConf | [[BaseMultiConf_USR]] | Ref,RelBase | rel: 1
84-
// CHECK: [[@LINE-2]]:24 | protocol/Swift | P1 | [[P1_USR]] | Ref,RelBase | rel: 1
84+
// CHECK: [[@LINE-2]]:40 | protocol/Swift | P1 | [[P1_USR]] | Ref,RelBase | rel: 1
8585
func foo() {}
8686
}
8787

0 commit comments

Comments
 (0)