Skip to content

Commit 19b1036

Browse files
authored
Merge pull request #8828 from akyrtzi/index-accessors-handling
2 parents 0a216c9 + dc7373c commit 19b1036

File tree

10 files changed

+250
-67
lines changed

10 files changed

+250
-67
lines changed

lib/Index/Index.cpp

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,17 @@ bool IndexSwiftASTWalker::reportPseudoAccessor(AbstractStorageDecl *D,
722722
if (getPseudoAccessorNameAndUSR(D, AccKind, Info.name, Info.USR))
723723
return true;
724724
Info.symInfo.Kind = SymbolKind::Function;
725+
if (D->getDeclContext()->isTypeContext()) {
726+
if (D->isStatic()) {
727+
if (isa<VarDecl>(D) &&
728+
cast<VarDecl>(D)->getCorrectStaticSpelling() == StaticSpellingKind::KeywordClass)
729+
Info.symInfo.Kind = SymbolKind::ClassMethod;
730+
else
731+
Info.symInfo.Kind = SymbolKind::StaticMethod;
732+
} else {
733+
Info.symInfo.Kind = SymbolKind::InstanceMethod;
734+
}
735+
}
725736
Info.symInfo.SubKind = getSubKindForAccessor(AccKind);
726737
Info.roles |= (SymbolRoleSet)SymbolRole::Implicit;
727738
Info.group = "";
@@ -752,7 +763,8 @@ bool IndexSwiftASTWalker::reportPseudoAccessor(AbstractStorageDecl *D,
752763
return true; // continue walking.
753764
if (updateInfo(Info))
754765
return true;
755-
if (addRelation(Info, (SymbolRoleSet) SymbolRole::RelationAccessorOf, D))
766+
if (addRelation(Info, (SymbolRoleSet)SymbolRole::RelationAccessorOf |
767+
(SymbolRoleSet)SymbolRole::RelationChildOf , D))
756768
return true;
757769

758770
if (!IdxConsumer.startSourceEntity(Info) || !IdxConsumer.finishSourceEntity(Info.symInfo, Info.roles))
@@ -806,7 +818,11 @@ bool IndexSwiftASTWalker::report(ValueDecl *D) {
806818
if (startEntityDecl(D)) {
807819
// Pass accessors.
808820
if (auto VarD = dyn_cast<VarDecl>(D)) {
809-
if (!VarD->getGetter() && !VarD->getSetter()) {
821+
auto isNullOrImplicit = [](const Decl *D) -> bool {
822+
return !D || D->isImplicit();
823+
};
824+
if (isNullOrImplicit(VarD->getGetter()) &&
825+
isNullOrImplicit(VarD->getSetter())) {
810826
// No actual getter or setter, pass 'pseudo' accessors.
811827
// We create accessor entities so we can implement the functionality
812828
// of libclang, which reports implicit method property accessor
@@ -827,24 +843,24 @@ bool IndexSwiftASTWalker::report(ValueDecl *D) {
827843
SourceEntityWalker::walk(cast<Decl>(FD));
828844
if (Cancelled)
829845
return false;
830-
if (VarD->hasObservers()) {
831-
if (auto FD = VarD->getWillSetFunc())
832-
SourceEntityWalker::walk(cast<Decl>(FD));
833-
if (Cancelled)
834-
return false;
835-
if (auto FD = VarD->getDidSetFunc())
836-
SourceEntityWalker::walk(cast<Decl>(FD));
837-
if (Cancelled)
838-
return false;
839-
}
840-
if (VarD->hasAddressors()) {
841-
if (auto FD = VarD->getAddressor())
842-
SourceEntityWalker::walk(cast<Decl>(FD));
843-
if (Cancelled)
844-
return false;
845-
if (auto FD = VarD->getMutableAddressor())
846-
SourceEntityWalker::walk(cast<Decl>(FD));
847-
}
846+
}
847+
if (VarD->hasObservers()) {
848+
if (auto FD = VarD->getWillSetFunc())
849+
SourceEntityWalker::walk(cast<Decl>(FD));
850+
if (Cancelled)
851+
return false;
852+
if (auto FD = VarD->getDidSetFunc())
853+
SourceEntityWalker::walk(cast<Decl>(FD));
854+
if (Cancelled)
855+
return false;
856+
}
857+
if (VarD->hasAddressors()) {
858+
if (auto FD = VarD->getAddressor())
859+
SourceEntityWalker::walk(cast<Decl>(FD));
860+
if (Cancelled)
861+
return false;
862+
if (auto FD = VarD->getMutableAddressor())
863+
SourceEntityWalker::walk(cast<Decl>(FD));
848864
}
849865
} else if (auto NTD = dyn_cast<NominalTypeDecl>(D)) {
850866
if (!reportInheritedTypeRefs(NTD->getInherited(), NTD))
@@ -1038,18 +1054,10 @@ bool IndexSwiftASTWalker::initFuncRefIndexSymbol(ValueDecl *D, SourceLoc Loc,
10381054

10391055
Expr *ParentE = getParentExpr();
10401056

1041-
// FIXME: the below check maintains existing indexing behavior with
1042-
// pseudo/accessor output but seems incorrect. E.g otherGlobal in:
1043-
// let global = otherGlobal
1044-
// will not have a parent expression so no accessor call is reported
1045-
if (isa<AbstractStorageDecl>(D) && !ParentE)
1046-
return true;
1047-
10481057
if (!isa<AbstractStorageDecl>(D) &&
10491058
!isBeingCalled(CurrentE, ParentE, getContainingExpr(2)))
10501059
return false;
10511060

1052-
10531061
Info.roles |= (unsigned)SymbolRole::Call;
10541062
if (auto *Caller = dyn_cast_or_null<AbstractFunctionDecl>(getParentDecl())) {
10551063
if (addRelation(Info, (SymbolRoleSet) SymbolRole::RelationCalledBy, Caller))

test/Index/index_module.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@
88

99
public var someGlobal: Int = 0
1010
// CHECK: [[@LINE-1]]:12 | variable/Swift | someGlobal | [[SOMEGLOBAL_USR:.*]] | Def | rel: 0
11-
// CHECK: [[@LINE-2]]:12 | function/acc-get/Swift | getter:someGlobal | [[SOMEGLOBAL_GET_USR:.*]] | Def,Impl,RelAcc | rel: 1
12-
// CHECK-NEXT: RelAcc | variable/Swift | someGlobal | [[SOMEGLOBAL_USR]]
13-
// CHECK: [[@LINE-4]]:12 | function/acc-set/Swift | setter:someGlobal | [[SOMEGLOBAL_SET_USR:.*]] | Def,Impl,RelAcc | rel: 1
14-
// CHECK-NEXT: RelAcc | variable/Swift | someGlobal | [[SOMEGLOBAL_USR]]
11+
// CHECK: [[@LINE-2]]:12 | function/acc-get/Swift | getter:someGlobal | [[SOMEGLOBAL_GET_USR:.*]] | Def,Impl,RelChild,RelAcc | rel: 1
12+
// CHECK-NEXT: RelChild,RelAcc | variable/Swift | someGlobal | [[SOMEGLOBAL_USR]]
13+
// CHECK: [[@LINE-4]]:12 | function/acc-set/Swift | setter:someGlobal | [[SOMEGLOBAL_SET_USR:.*]] | Def,Impl,RelChild,RelAcc | rel: 1
14+
// CHECK-NEXT: RelChild,RelAcc | variable/Swift | someGlobal | [[SOMEGLOBAL_USR]]
1515

1616
public func someFunc() {}
1717
// CHECK: [[@LINE-1]]:13 | function/Swift | someFunc() | [[SOMEFUNC_USR:.*]] | Def | rel: 0
1818

1919
// --- Check the module ---
2020

2121
// CHECK: 0:0 | variable/Swift | someGlobal | [[SOMEGLOBAL_USR]] | Def | rel: 0
22-
// CHECK: 0:0 | function/acc-get/Swift | getter:someGlobal | [[SOMEGLOBAL_GET_USR:.*]] | Def,Impl,RelAcc | rel: 1
23-
// CHECK-NEXT: RelAcc | variable/Swift | someGlobal | [[SOMEGLOBAL_USR]]
24-
// CHECK: 0:0 | function/acc-set/Swift | setter:someGlobal | [[SOMEGLOBAL_SET_USR:.*]] | Def,Impl,RelAcc | rel: 1
25-
// CHECK-NEXT: RelAcc | variable/Swift | someGlobal | [[SOMEGLOBAL_USR]]
22+
// CHECK: 0:0 | function/acc-get/Swift | getter:someGlobal | [[SOMEGLOBAL_GET_USR:.*]] | Def,Impl,RelChild,RelAcc | rel: 1
23+
// CHECK-NEXT: RelChild,RelAcc | variable/Swift | someGlobal | [[SOMEGLOBAL_USR]]
24+
// CHECK: 0:0 | function/acc-set/Swift | setter:someGlobal | [[SOMEGLOBAL_SET_USR:.*]] | Def,Impl,RelChild,RelAcc | rel: 1
25+
// CHECK-NEXT: RelChild,RelAcc | variable/Swift | someGlobal | [[SOMEGLOBAL_USR]]
2626

2727
// CHECK: 0:0 | function/Swift | someFunc() | [[SOMEFUNC_USR]] | Def | rel: 0

test/Index/roles.swift

Lines changed: 69 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ struct AStruct {
104104
x += 1
105105
// CHECK: [[@LINE-1]]:5 | instance-property/Swift | x | s:14swift_ide_test7AStructV1xSiv | Ref,Read,Writ,RelCont | rel: 1
106106
// CHECK-NEXT: RelCont | instance-method/Swift | aMethod() | s:14swift_ide_test7AStructV7aMethodyyF
107-
// CHECK: [[@LINE-3]]:5 | function/acc-get/Swift | getter:x | s:14swift_ide_test7AStructV1xSifg | Ref,Call,Impl,RelRec,RelCall,RelCont | rel: 2
107+
// CHECK: [[@LINE-3]]:5 | instance-method/acc-get/Swift | getter:x | s:14swift_ide_test7AStructV1xSifg | Ref,Call,Impl,RelRec,RelCall,RelCont | rel: 2
108108
// CHECK-NEXT: RelCall,RelCont | instance-method/Swift | aMethod() | s:14swift_ide_test7AStructV7aMethodyyF
109109
// CHECK-NEXT: RelRec | struct/Swift | AStruct | s:14swift_ide_test7AStructV
110-
// CHECK: [[@LINE-6]]:5 | function/acc-set/Swift | setter:x | s:14swift_ide_test7AStructV1xSifs | Ref,Call,Impl,RelRec,RelCall,RelCont | rel: 2
110+
// CHECK: [[@LINE-6]]:5 | instance-method/acc-set/Swift | setter:x | s:14swift_ide_test7AStructV1xSifs | Ref,Call,Impl,RelRec,RelCall,RelCont | rel: 2
111111
// CHECK-NEXT: RelCall,RelCont | instance-method/Swift | aMethod() | s:14swift_ide_test7AStructV7aMethodyyF
112112
// CHECK-NEXT: RelRec | struct/Swift | AStruct | s:14swift_ide_test7AStructV
113113
// CHECK: [[@LINE-9]]:7 | static-method/infix-operator/Swift | +=(_:_:) | s:Si2peoiySiz_SitFZ | Ref,RelCont | rel: 1
@@ -134,30 +134,77 @@ struct AStruct {
134134
}
135135
}
136136

137-
class AClass { // used for references only
138-
var y: AStruct;
137+
class AClass {
138+
// CHECK: [[@LINE-1]]:7 | class/Swift | AClass | [[AClass_USR:.*]] | Def | rel: 0
139+
var y: AStruct
140+
// CHECK: [[@LINE-1]]:7 | instance-property/Swift | y | [[AClass_y_USR:.*]] | Def,RelChild | rel: 1
141+
// CHECK: [[@LINE-2]]:7 | instance-method/acc-get/Swift | getter:y | [[AClass_y_get_USR:.*]] | Def,Impl,RelChild,RelAcc | rel: 1
142+
// CHECK-NEXT: RelChild,RelAcc | instance-property/Swift | y | [[AClass_y_USR]]
143+
// CHECK: [[@LINE-4]]:7 | instance-method/acc-set/Swift | setter:y | [[AClass_y_set_USR:.*]] | Def,Impl,RelChild,RelAcc | rel: 1
144+
// CHECK-NEXT: RelChild,RelAcc | instance-property/Swift | y | [[AClass_y_USR]]
139145
var z: [Int]
146+
var computed_p: Int { return 0 }
147+
// CHECK: [[@LINE-1]]:7 | instance-property/Swift | computed_p | [[AClass_computed_p_USR:.*]] | Def,RelChild | rel: 1
148+
// CHECK: [[@LINE-2]]:23 | instance-method/acc-get/Swift | getter:computed_p | [[AClass_computed_p_get_USR:.*]] | Def,RelChild,RelAcc | rel: 1
149+
// CHECK-NEXT: RelChild,RelAcc | instance-property/Swift | computed_p | [[AClass_computed_p_USR]]
150+
// CHECK-NOT: acc-set/Swift | setter:computed_p |
140151
init(x: Int) {
141152
y = AStruct(x: x)
142153
self.z = [1, 2, 3]
143154
}
144155
subscript(index: Int) -> Int {
156+
// CHECK: [[@LINE-1]]:3 | instance-property/subscript/Swift | subscript(_:) | [[AClass_subscript_USR:.*]] | Def,RelChild | rel: 1
145157
get { return z[0] }
158+
// CHECK: [[@LINE-1]]:5 | instance-method/acc-get/Swift | getter:subscript(_:) | [[AClass_subscript_get_USR:.*]] | Def,RelChild,RelAcc | rel: 1
146159
set { z[0] = newValue }
160+
// CHECK: [[@LINE-1]]:5 | instance-method/acc-set/Swift | setter:subscript(_:) | [[AClass_subscript_set_USR:.*]] | Def,RelChild,RelAcc | rel: 1
147161
}
148162
func foo() -> Int { return z[0] }
163+
// CHECK: [[@LINE-1]]:8 | instance-method/Swift | foo() | [[AClass_foo_USR:.*]] | Def,RelChild | rel: 1
149164
}
150165

151166
let _ = AClass.foo
152-
// CHECK: [[@LINE-1]]:16 | instance-method/Swift | foo() | s:14swift_ide_test6AClassC3fooSiyF | Ref | rel: 0
167+
// CHECK: [[@LINE-1]]:16 | instance-method/Swift | foo() | [[AClass_foo_USR]] | Ref | rel: 0
153168
let _ = AClass(x: 1).foo
154-
// CHECK: [[@LINE-1]]:22 | instance-method/Swift | foo() | s:14swift_ide_test6AClassC3fooSiyF | Ref | rel: 0
169+
// CHECK: [[@LINE-1]]:22 | instance-method/Swift | foo() | [[AClass_foo_USR]] | Ref | rel: 0
155170
let _ = AClass(x: 1)[1]
156-
// CHECK: [[@LINE-1]]:21 | instance-property/subscript/Swift | subscript(_:) | s:14swift_ide_test6AClassC9subscriptS2ici | Ref,Read | rel: 0
157-
// CHECK: [[@LINE-2]]:21 | function/acc-get/Swift | getter:subscript(_:) | s:14swift_ide_test6AClassC9subscriptS2icfg | Ref,Call,Dyn,Impl,RelRec | rel: 1
171+
// CHECK: [[@LINE-1]]:21 | instance-property/subscript/Swift | subscript(_:) | [[AClass_subscript_USR]] | Ref,Read | rel: 0
172+
// CHECK: [[@LINE-2]]:21 | instance-method/acc-get/Swift | getter:subscript(_:) | [[AClass_subscript_get_USR]] | Ref,Call,Dyn,Impl,RelRec | rel: 1
158173
let _ = AClass(x: 1)[1] = 2
159-
// CHECK: [[@LINE-1]]:21 | instance-property/subscript/Swift | subscript(_:) | s:14swift_ide_test6AClassC9subscriptS2ici | Ref,Writ | rel: 0
160-
// CHECK: [[@LINE-2]]:21 | function/acc-set/Swift | setter:subscript(_:) | s:14swift_ide_test6AClassC9subscriptS2icfs | Ref,Call,Dyn,Impl,RelRec | rel: 1
174+
// CHECK: [[@LINE-1]]:21 | instance-property/subscript/Swift | subscript(_:) | [[AClass_subscript_USR]] | Ref,Writ | rel: 0
175+
// CHECK: [[@LINE-2]]:21 | instance-method/acc-set/Swift | setter:subscript(_:) | [[AClass_subscript_set_USR]] | Ref,Call,Dyn,Impl,RelRec | rel: 1
176+
177+
extension AClass {
178+
func test_property_refs1() -> AStruct {
179+
// CHECK: [[@LINE-1]]:8 | instance-method/Swift | test_property_refs1() | [[test_property_refs1_USR:.*]] | Def,RelChild | rel: 1
180+
_ = y
181+
// CHECK: [[@LINE-1]]:9 | instance-property/Swift | y | [[AClass_y_USR]] | Ref,Read,RelCont | rel: 1
182+
// CHECK: [[@LINE-2]]:9 | instance-method/acc-get/Swift | getter:y | [[AClass_y_get_USR]] | Ref,Call,Dyn,Impl,RelRec,RelCall,RelCont | rel: 2
183+
// CHECK-NEXT: RelCall,RelCont | instance-method/Swift | test_property_refs1() | [[test_property_refs1_USR]]
184+
// CHECK-NEXT: RelRec | class/Swift | AClass | [[AClass_USR]]
185+
186+
return y
187+
// CHECK: [[@LINE-1]]:12 | instance-property/Swift | y | [[AClass_y_USR]] | Ref,Read,RelCont | rel: 1
188+
// CHECK: [[@LINE-2]]:12 | instance-method/acc-get/Swift | getter:y | [[AClass_y_get_USR]] | Ref,Call,Dyn,Impl,RelRec,RelCall,RelCont | rel: 2
189+
// CHECK-NEXT: RelCall,RelCont | instance-method/Swift | test_property_refs1() | [[test_property_refs1_USR]]
190+
// CHECK-NEXT: RelRec | class/Swift | AClass | [[AClass_USR]]
191+
}
192+
193+
func test_property_refs2() -> Int {
194+
// CHECK: [[@LINE-1]]:8 | instance-method/Swift | test_property_refs2() | [[test_property_refs2_USR:.*]] | Def,RelChild | rel: 1
195+
_ = computed_p
196+
// CHECK: [[@LINE-1]]:9 | instance-property/Swift | computed_p | [[AClass_computed_p_USR]] | Ref,Read,RelCont | rel: 1
197+
// CHECK: [[@LINE-2]]:9 | instance-method/acc-get/Swift | getter:computed_p | [[AClass_computed_p_get_USR]] | Ref,Call,Dyn,Impl,RelRec,RelCall,RelCont | rel: 2
198+
// CHECK-NEXT: RelCall,RelCont | instance-method/Swift | test_property_refs2() | [[test_property_refs2_USR]]
199+
// CHECK-NEXT: RelRec | class/Swift | AClass | [[AClass_USR]]
200+
201+
return computed_p
202+
// CHECK: [[@LINE-1]]:12 | instance-property/Swift | computed_p | [[AClass_computed_p_USR]] | Ref,Read,RelCont | rel: 1
203+
// CHECK: [[@LINE-2]]:12 | instance-method/acc-get/Swift | getter:computed_p | [[AClass_computed_p_get_USR]] | Ref,Call,Dyn,Impl,RelRec,RelCall,RelCont | rel: 2
204+
// CHECK-NEXT: RelCall,RelCont | instance-method/Swift | test_property_refs2() | [[test_property_refs2_USR]]
205+
// CHECK-NEXT: RelRec | class/Swift | AClass | [[AClass_USR]]
206+
}
207+
}
161208

162209
// RelationBaseOf, RelationOverrideOf
163210

@@ -208,7 +255,7 @@ class ASubClass : AClass, AProtocol {
208255

209256
override func foo() -> Int {
210257
// CHECK: [[@LINE-1]]:17 | instance-method/Swift | foo() | s:14swift_ide_test9ASubClassC3fooSiyF | Def,RelChild,RelOver | rel: 3
211-
// CHECK-NEXT: RelOver | instance-method/Swift | foo() | s:14swift_ide_test6AClassC3fooSiyF
258+
// CHECK-NEXT: RelOver | instance-method/Swift | foo() | [[AClass_foo_USR]]
212259
// CHECK-NEXT: RelOver | instance-method/Swift | foo() | s:14swift_ide_test9AProtocolP3fooSiyF
213260
// CHECK-NEXT: RelChild | class/Swift | ASubClass | s:14swift_ide_test9ASubClassC
214261
return 1
@@ -250,15 +297,15 @@ var anInstance = AClass(x: 1)
250297

251298
anInstance.y.x = anInstance.y.x
252299
// CHECK: [[@LINE-1]]:1 | variable/Swift | anInstance | s:14swift_ide_test10anInstanceAA6AClassCv | Ref,Read | rel: 0
253-
// CHECK: [[@LINE-2]]:12 | instance-property/Swift | y | s:14swift_ide_test6AClassC1yAA7AStructVv | Ref,Read,Writ | rel: 0
300+
// CHECK: [[@LINE-2]]:12 | instance-property/Swift | y | [[AClass_y_USR]] | Ref,Read,Writ | rel: 0
254301
// CHECK: [[@LINE-3]]:14 | instance-property/Swift | x | s:14swift_ide_test7AStructV1xSiv | Ref,Writ | rel: 0
255302
// CHECK: [[@LINE-4]]:18 | variable/Swift | anInstance | s:14swift_ide_test10anInstanceAA6AClassCv | Ref,Read | rel: 0
256-
// CHECK: [[@LINE-5]]:29 | instance-property/Swift | y | s:14swift_ide_test6AClassC1yAA7AStructVv | Ref,Read | rel: 0
303+
// CHECK: [[@LINE-5]]:29 | instance-property/Swift | y | [[AClass_y_USR]] | Ref,Read | rel: 0
257304
// CHECK: [[@LINE-6]]:31 | instance-property/Swift | x | s:14swift_ide_test7AStructV1xSiv | Ref,Read | rel: 0
258305

259306
anInstance.y.aMethod()
260307
// CHECK: [[@LINE-1]]:1 | variable/Swift | anInstance | s:14swift_ide_test10anInstanceAA6AClassCv | Ref,Read | rel: 0
261-
// CHECK: [[@LINE-2]]:12 | instance-property/Swift | y | s:14swift_ide_test6AClassC1yAA7AStructVv | Ref,Read,Writ | rel: 0
308+
// CHECK: [[@LINE-2]]:12 | instance-property/Swift | y | [[AClass_y_USR]] | Ref,Read,Writ | rel: 0
262309
// CHECK: [[@LINE-3]]:14 | instance-method/Swift | aMethod() | s:14swift_ide_test7AStructV7aMethodyyF | Ref,Call | rel: 0
263310

264311
// FIXME Write role of z occurrence on the RHS?
@@ -277,7 +324,7 @@ let _ = otherInstance[0]
277324

278325
let _ = anInstance[0]
279326
// CHECK: [[@LINE-1]]:9 | variable/Swift | anInstance | s:14swift_ide_test10anInstanceAA6AClassCv | Ref,Read | rel: 0
280-
// CHECK: [[@LINE-2]]:19 | instance-property/subscript/Swift | subscript(_:) | s:14swift_ide_test6AClassC9subscriptS2ici | Ref,Read | rel: 0
327+
// CHECK: [[@LINE-2]]:19 | instance-property/subscript/Swift | subscript(_:) | [[AClass_subscript_USR]] | Ref,Read | rel: 0
281328

282329
let aSubInstance: AClass = ASubClass(x: 1)
283330
// CHECK: [[@LINE-1]]:5 | variable/Swift | aSubInstance | s:14swift_ide_test12aSubInstanceAA6AClassCv | Def | rel: 0
@@ -286,7 +333,7 @@ let aSubInstance: AClass = ASubClass(x: 1)
286333
// Dynamic, RelationReceivedBy
287334
let _ = aSubInstance.foo()
288335
// CHECK: [[@LINE-1]]:9 | variable/Swift | aSubInstance | s:14swift_ide_test12aSubInstanceAA6AClassCv | Ref,Read | rel: 0
289-
// CHECK: [[@LINE-2]]:22 | instance-method/Swift | foo() | s:14swift_ide_test6AClassC3fooSiyF | Ref,Call,Dyn,RelRec | rel: 1
336+
// CHECK: [[@LINE-2]]:22 | instance-method/Swift | foo() | [[AClass_foo_USR]] | Ref,Call,Dyn,RelRec | rel: 1
290337
// CHECK-NEXT: RelRec | class/Swift | AClass | s:14swift_ide_test6AClassC
291338

292339
// RelationContainedBy
@@ -352,27 +399,27 @@ protocol ProtDerived : ProtRoot {
352399

353400
extension ProtDerived {
354401
func fooCommon() {}
355-
// CHECK: 354:8 | instance-method/Swift | fooCommon() | s:14swift_ide_test11ProtDerivedPAAE9fooCommonyyF | Def,RelChild,RelOver | rel: 3
402+
// CHECK: [[@LINE-1]]:8 | instance-method/Swift | fooCommon() | s:14swift_ide_test11ProtDerivedPAAE9fooCommonyyF | Def,RelChild,RelOver | rel: 3
356403
// CHECK-NEXT: RelOver | instance-method/Swift | fooCommon() | s:14swift_ide_test11ProtDerivedP9fooCommonyyF
357404
// CHECK-NEXT: RelOver | instance-method/Swift | fooCommon() | s:14swift_ide_test8ProtRootP9fooCommonyyF
358405

359406
func foo1() {}
360-
// CHECK: 359:8 | instance-method/Swift | foo1() | s:14swift_ide_test11ProtDerivedPAAE4foo1yyF | Def,RelChild,RelOver | rel: 2
407+
// CHECK: [[@LINE-1]]:8 | instance-method/Swift | foo1() | s:14swift_ide_test11ProtDerivedPAAE4foo1yyF | Def,RelChild,RelOver | rel: 2
361408
// CHECK-NEXT: RelOver | instance-method/Swift | foo1() | s:14swift_ide_test8ProtRootP4foo1yyF
362409

363410
func bar1() {}
364-
// CHECK: 363:8 | instance-method/Swift | bar1() | s:14swift_ide_test11ProtDerivedPAAE4bar1yyF | Def,RelChild,RelOver | rel: 2
411+
// CHECK: [[@LINE-1]]:8 | instance-method/Swift | bar1() | s:14swift_ide_test11ProtDerivedPAAE4bar1yyF | Def,RelChild,RelOver | rel: 2
365412
// CHECK-NEXT: RelOver | instance-method/Swift | bar1() | s:14swift_ide_test11ProtDerivedP4bar1yyF
366413

367414
func foo3(a : Int) {}
368-
// CHECK: 367:8 | instance-method/Swift | foo3(a:) | s:14swift_ide_test11ProtDerivedPAAE4foo3ySi1a_tF | Def,RelChild,RelOver | rel: 2
415+
// CHECK: [[@LINE-1]]:8 | instance-method/Swift | foo3(a:) | s:14swift_ide_test11ProtDerivedPAAE4foo3ySi1a_tF | Def,RelChild,RelOver | rel: 2
369416
// CHECK-NEXT: RelOver | instance-method/Swift | foo3(a:) | s:14swift_ide_test8ProtRootP4foo3ySi1a_tF
370417

371418
func foo3(a : String) {}
372-
// CHECK: 371:8 | instance-method/Swift | foo3(a:) | s:14swift_ide_test11ProtDerivedPAAE4foo3ySS1a_tF | Def,RelChild,RelOver | rel: 2
419+
// CHECK: [[@LINE-1]]:8 | instance-method/Swift | foo3(a:) | s:14swift_ide_test11ProtDerivedPAAE4foo3ySS1a_tF | Def,RelChild,RelOver | rel: 2
373420
// CHECK-NEXT: RelOver | instance-method/Swift | foo3(a:) | s:14swift_ide_test8ProtRootP4foo3ySS1a_tF
374421

375422
func bar3(_ : Int) {}
376-
// CHECK: 375:8 | instance-method/Swift | bar3(_:) | s:14swift_ide_test11ProtDerivedPAAE4bar3ySiF | Def,RelChild,RelOver | rel: 2
423+
// CHECK: [[@LINE-1]]:8 | instance-method/Swift | bar3(_:) | s:14swift_ide_test11ProtDerivedPAAE4bar3ySiF | Def,RelChild,RelOver | rel: 2
377424
// CHECK-NEXT: RelOver | instance-method/Swift | bar3(_:) | s:14swift_ide_test11ProtDerivedP4bar3ySiF
378425
}

test/SourceKit/Indexing/Inputs/cycle-depend/A.response

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,17 @@
5454
{
5555
key.kind: source.lang.swift.decl.var.instance,
5656
key.name: "x",
57-
key.usr: "s:1AAAC1x1BADCv"
57+
key.usr: "s:1AAAC1x1BADCv",
58+
key.entities: [
59+
{
60+
key.kind: source.lang.swift.decl.function.accessor.getter,
61+
key.usr: "s:1AAAC1x1BADCfg"
62+
},
63+
{
64+
key.kind: source.lang.swift.decl.function.accessor.setter,
65+
key.usr: "s:1AAAC1x1BADCfs"
66+
}
67+
]
5868
}
5969
]
6070
}

0 commit comments

Comments
 (0)