Skip to content

Commit 0495ab8

Browse files
authored
Merge pull request #58936 from bnbarham/cherry-dyn-property
[5.7][SourceKit] Add whether a property is dynamic
2 parents ddc46e1 + 0a21e91 commit 0495ab8

15 files changed

+436
-229
lines changed

include/swift/IDE/Utils.h

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ struct ResolvedCursorInfo {
166166
Type ContainerType;
167167
Stmt *TrailingStmt = nullptr;
168168
Expr *TrailingExpr = nullptr;
169-
/// If this is a call, whether it is "dynamic", see ide::isDynamicCall.
169+
/// It this is a ref, whether it is "dynamic". See \c ide::isDynamicRef.
170170
bool IsDynamic = false;
171-
/// If this is a call, the types of the base (multiple in the case of
171+
/// If this is a dynamic ref, the types of the base (multiple in the case of
172172
/// protocol composition).
173173
SmallVector<NominalTypeDecl *, 1> ReceiverTypes;
174174

@@ -615,11 +615,22 @@ bool isBeingCalled(ArrayRef<Expr*> ExprStack);
615615
/// stack in eg. the case of a `DotSyntaxCallExpr`).
616616
Expr *getBase(ArrayRef<Expr *> ExprStack);
617617

618-
/// Assuming that we have a call, returns whether or not it is "dynamic" based
619-
/// on its base expression and decl of the callee. Note that this is not
620-
/// Swift's "dynamic" modifier (`ValueDecl::isDynamic`), but rathar "can call a
621-
/// function in a conformance/subclass".
622-
bool isDynamicCall(Expr *Base, ValueDecl *D);
618+
/// Returns whether or not \p D could be overridden, eg. it's a member of a
619+
/// protocol, a non-final method in a class, etc.
620+
bool isDeclOverridable(ValueDecl *D);
621+
622+
/// Given a reference to a member \p D and its \p Base expression, return
623+
/// whether that declaration could be dynamic, ie. may resolve to some other
624+
/// declaration. Note that while the decl itself itself may be overridable, a
625+
/// reference to it is not necessarily "dynamic". Furthermore, is *not* the
626+
/// `dynamic` keyword.
627+
///
628+
/// A simple example is `SomeType.classMethod()`. `classMethod`
629+
/// is itself overridable, but that particular reference to it *has* to be the
630+
/// one in `SomeType`. Contrast that to `type(of: foo).classMethod()` where
631+
/// `classMethod` could be any `classMethod` up or down the hierarchy from the
632+
/// type of the \p Base expression.
633+
bool isDynamicRef(Expr *Base, ValueDecl *D);
623634

624635
/// Adds the resolved nominal types of \p Base to \p Types.
625636
void getReceiverType(Expr *Base,

lib/IDE/IDERequests.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ bool CursorInfoResolver::tryResolve(ValueDecl *D, TypeDecl *CtorTyRef,
125125
}
126126
}
127127

128-
if (isBeingCalled(ExprStack)) {
129-
if (Expr *BaseE = getBase(ExprStack)) {
130-
CursorInfo.IsDynamic = isDynamicCall(BaseE, D);
128+
if (Expr *BaseE = getBase(ExprStack)) {
129+
if (isDynamicRef(BaseE, D)) {
130+
CursorInfo.IsDynamic = true;
131131
ide::getReceiverType(BaseE, CursorInfo.ReceiverTypes);
132132
}
133133
}

lib/IDE/Utils.cpp

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,12 +1252,44 @@ Expr *swift::ide::getBase(ArrayRef<Expr *> ExprStack) {
12521252
return Base;
12531253
}
12541254

1255-
bool swift::ide::isDynamicCall(Expr *Base, ValueDecl *D) {
1256-
auto TyD = D->getDeclContext()->getSelfNominalTypeDecl();
1257-
if (!TyD)
1255+
bool swift::ide::isDeclOverridable(ValueDecl *D) {
1256+
auto *NTD = D->getDeclContext()->getSelfNominalTypeDecl();
1257+
if (!NTD)
12581258
return false;
12591259

1260-
if (isa<StructDecl>(TyD) || isa<EnumDecl>(TyD) || D->isFinal())
1260+
// Only classes and protocols support overridding by subtypes.
1261+
if (!(isa<ClassDecl>(NTD) || isa<ProtocolDecl>(NTD)))
1262+
return false;
1263+
1264+
// Decls where either they themselves are final or their containing type is
1265+
// final cannot be overridden. Actors cannot be subclassed and thus the given
1266+
// decl also can't be overridden.
1267+
if (D->isFinal() || NTD->isFinal() || NTD->isActor())
1268+
return false;
1269+
1270+
// No need to check accessors here - willSet/didSet are not "overridable",
1271+
// but that's already covered by the `isFinal` check above (they are both
1272+
// final).
1273+
1274+
// Static functions on classes cannot be overridden. Static functions on
1275+
// structs and enums are already covered by the more general check above.
1276+
if (isa<ClassDecl>(NTD)) {
1277+
if (auto *FD = dyn_cast<FuncDecl>(D)) {
1278+
if (FD->isStatic() &&
1279+
FD->getCorrectStaticSpelling() == StaticSpellingKind::KeywordStatic)
1280+
return false;
1281+
} else if (auto *ASD = dyn_cast<AbstractStorageDecl>(D)) {
1282+
if (ASD->isStatic() &&
1283+
ASD->getCorrectStaticSpelling() == StaticSpellingKind::KeywordStatic)
1284+
return false;
1285+
}
1286+
}
1287+
1288+
return true;
1289+
}
1290+
1291+
bool swift::ide::isDynamicRef(Expr *Base, ValueDecl *D) {
1292+
if (!isDeclOverridable(D))
12611293
return false;
12621294

12631295
// super.method()
@@ -1268,20 +1300,18 @@ bool swift::ide::isDynamicCall(Expr *Base, ValueDecl *D) {
12681300
if (Base->isSuperExpr())
12691301
return false;
12701302

1271-
// `SomeType.staticOrClassMethod()`
1303+
// `SomeType.staticOrClassMethod()` spelled directly, so this must be a ref
1304+
// to this exact decl.
12721305
if (isa<TypeExpr>(Base))
12731306
return false;
12741307

1275-
// `type(of: foo).staticOrClassMethod()`, not "dynamic" if the instance type
1276-
// is a struct/enum or if it is a class and the function is a static method
1277-
// (rather than a class method).
1308+
// `type(of: foo).staticOrClassMethod()`. A static method may be "dynamic"
1309+
// here, but not if the instance type is a struct/enum.
12781310
if (auto IT = Base->getType()->getAs<MetatypeType>()) {
12791311
auto InstanceType = IT->getInstanceType();
12801312
if (InstanceType->getStructOrBoundGenericStruct() ||
12811313
InstanceType->getEnumOrBoundGenericEnum())
12821314
return false;
1283-
if (InstanceType->getClassOrBoundGenericClass() && D->isFinal())
1284-
return false;
12851315
}
12861316

12871317
return true;

lib/Index/Index.cpp

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,7 @@ class IndexSwiftASTWalker : public SourceEntityWalker {
922922
}
923923
bool reportPseudoAccessor(AbstractStorageDecl *D, AccessorKind AccKind,
924924
bool IsRef, SourceLoc Loc);
925+
bool reportIsDynamicRef(ValueDecl *D, IndexSymbol &Info);
925926

926927
bool finishCurrentEntity() {
927928
Entity CurrEnt = EntitiesStack.pop_back_val();
@@ -1336,24 +1337,6 @@ bool IndexSwiftASTWalker::reportRelatedTypeRef(const TypeLoc &Ty, SymbolRoleSet
13361337
return true;
13371338
}
13381339

1339-
static bool isDynamicVarAccessorOrFunc(ValueDecl *D, SymbolInfo symInfo) {
1340-
if (auto NTD = D->getDeclContext()->getSelfNominalTypeDecl()) {
1341-
bool isClassOrProtocol = isa<ClassDecl>(NTD) || isa<ProtocolDecl>(NTD);
1342-
bool isInternalAccessor =
1343-
symInfo.SubKind == SymbolSubKind::SwiftAccessorWillSet ||
1344-
symInfo.SubKind == SymbolSubKind::SwiftAccessorDidSet ||
1345-
symInfo.SubKind == SymbolSubKind::SwiftAccessorAddressor ||
1346-
symInfo.SubKind == SymbolSubKind::SwiftAccessorMutableAddressor;
1347-
if (isClassOrProtocol &&
1348-
symInfo.Kind != SymbolKind::StaticMethod &&
1349-
!isInternalAccessor &&
1350-
!D->isFinal()) {
1351-
return true;
1352-
}
1353-
}
1354-
return false;
1355-
}
1356-
13571340
bool IndexSwiftASTWalker::reportPseudoAccessor(AbstractStorageDecl *D,
13581341
AccessorKind AccKind, bool IsRef,
13591342
SourceLoc Loc) {
@@ -1377,7 +1360,7 @@ bool IndexSwiftASTWalker::reportPseudoAccessor(AbstractStorageDecl *D,
13771360
Info.symInfo.SubKind = getSubKindForAccessor(AccKind);
13781361
Info.roles |= (SymbolRoleSet)SymbolRole::Implicit;
13791362
Info.group = "";
1380-
if (isDynamicVarAccessorOrFunc(D, Info.symInfo)) {
1363+
if (ide::isDeclOverridable(D)) {
13811364
Info.roles |= (SymbolRoleSet)SymbolRole::Dynamic;
13821365
}
13831366
return false;
@@ -1569,6 +1552,27 @@ bool IndexSwiftASTWalker::reportRef(ValueDecl *D, SourceLoc Loc,
15691552
return finishCurrentEntity();
15701553
}
15711554

1555+
bool IndexSwiftASTWalker::reportIsDynamicRef(ValueDecl *D, IndexSymbol &Info) {
1556+
Expr *BaseE = ide::getBase(ExprStack);
1557+
if (!BaseE)
1558+
return false;
1559+
1560+
if (!ide::isDynamicRef(BaseE, D))
1561+
return false;
1562+
1563+
Info.roles |= (unsigned)SymbolRole::Dynamic;
1564+
1565+
SmallVector<NominalTypeDecl *, 1> Types;
1566+
ide::getReceiverType(BaseE, Types);
1567+
for (auto *ReceiverTy : Types) {
1568+
if (addRelation(Info, (SymbolRoleSet) SymbolRole::RelationReceivedBy,
1569+
ReceiverTy))
1570+
return true;
1571+
}
1572+
1573+
return false;
1574+
}
1575+
15721576
bool IndexSwiftASTWalker::reportImplicitConformance(ValueDecl *witness, ValueDecl *requirement,
15731577
Decl *container) {
15741578
if (!shouldIndex(witness, /*IsRef=*/true))
@@ -1658,7 +1662,7 @@ bool IndexSwiftASTWalker::initFuncDeclIndexSymbol(FuncDecl *D,
16581662
if (initIndexSymbol(D, D->getLoc(/*SerializedOK*/false), /*IsRef=*/false, Info))
16591663
return true;
16601664

1661-
if (isDynamicVarAccessorOrFunc(D, Info.symInfo)) {
1665+
if (ide::isDeclOverridable(D)) {
16621666
Info.roles |= (SymbolRoleSet)SymbolRole::Dynamic;
16631667
}
16641668

@@ -1702,20 +1706,9 @@ bool IndexSwiftASTWalker::initFuncRefIndexSymbol(ValueDecl *D, SourceLoc Loc,
17021706
return true;
17031707
}
17041708

1705-
Expr *BaseE = ide::getBase(ExprStack);
1706-
if (!BaseE)
1707-
return false;
1708-
1709-
if (ide::isDynamicCall(BaseE, D))
1710-
Info.roles |= (unsigned)SymbolRole::Dynamic;
1709+
if (reportIsDynamicRef(D, Info))
1710+
return true;
17111711

1712-
SmallVector<NominalTypeDecl *, 1> Types;
1713-
ide::getReceiverType(BaseE, Types);
1714-
for (auto *ReceiverTy : Types) {
1715-
if (addRelation(Info, (SymbolRoleSet) SymbolRole::RelationReceivedBy,
1716-
ReceiverTy))
1717-
return true;
1718-
}
17191712
return false;
17201713
}
17211714

@@ -1740,6 +1733,9 @@ bool IndexSwiftASTWalker::initVarRefIndexSymbols(Expr *CurrentE, ValueDecl *D,
17401733
Info.roles |= (unsigned)SymbolRole::Write;
17411734
}
17421735

1736+
if (reportIsDynamicRef(D, Info))
1737+
return true;
1738+
17431739
return false;
17441740
}
17451741

test/Index/Store/record-sourcefile.swift

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
// CHECK: record-sourcefile.swift
88
// CHECK: ------------
99
// CHECK: struct/Swift | S1 | s:4file2S1V | <no-cgname> | Def,Ref,RelCont -
10-
// CHECK: instance-method/acc-get/Swift | getter:property | s:4file2S1V8propertySivg | <no-cgname> | Def,Ref,Call,Impl,RelChild,RelRec,RelCall,RelAcc,RelCont -
10+
// CHECK: instance-method/acc-get/Swift | getter:property | s:4file2S1V8propertySivg | <no-cgname> | Def,Ref,Call,Impl,RelChild,RelCall,RelAcc,RelCont -
1111
// CHECK: instance-property/Swift | property | [[property_USR:s:4file2S1V8propertySivp]] | <no-cgname> | Def,Ref,Read,RelChild,RelCont -
12-
// CHECK: static-method/acc-get/Swift | getter:staticProperty | s:4file2S1V14staticPropertySivgZ | <no-cgname> | Def,Ref,Call,Impl,RelChild,RelRec,RelCall,RelAcc,RelCont -
12+
// CHECK: static-method/acc-get/Swift | getter:staticProperty | s:4file2S1V14staticPropertySivgZ | <no-cgname> | Def,Ref,Call,Impl,RelChild,RelCall,RelAcc,RelCont -
1313
// CHECK: static-property/Swift | staticProperty | s:{{.*}} | <no-cgname> | Def,Ref,Read,RelChild,RelCont -
1414
// CHECK: instance-property/Swift | computedPropertyGetSet | s:{{.*}} | <no-cgname> | Def,RelChild -
1515
// CHECK: struct/Swift | Int | s:Si | <no-cgname> | Ref,RelCont -
@@ -83,20 +83,18 @@ struct S1 {
8383
// CHECK-NEXT: RelChild | [[S1_USR]]
8484
func method() {
8585
_ = self
86-
// CHECK: [[@LINE+4]]:9 | instance-method/acc-get/Swift | s:{{.*}} | Ref,Call,Impl,RelRec,RelCall,RelCont | rel: 2
86+
// CHECK: [[@LINE+3]]:9 | instance-method/acc-get/Swift | s:{{.*}} | Ref,Call,Impl,RelCall,RelCont | rel: 1
8787
// CHECK-NEXT: RelCall,RelCont | [[method_USR]]
88-
// CHECK-NEXT: RelRec | [[S1_USR]]
8988
// CHECK: [[@LINE+1]]:9 | instance-property/Swift | s:{{.*}} | Ref,Read,RelCont | rel: 1
9089
_ = property
9190
}
9291

9392
// CHECK: [[@LINE+2]]:15 | static-method/Swift | [[staticMethod_USR:s:.*]] | Def,RelChild | rel: 1
9493
// CHECK-NEXT: RelChild | [[S1_USR]]
9594
static func staticMethod() {
96-
// CHECK: [[@LINE+5]]:9 | struct/Swift | s:{{.*}} | Ref,RelCont | rel: 1
97-
// CHECK: [[@LINE+4]]:12 | static-method/acc-get/Swift | s:{{.*}} | Ref,Call,Impl,RelRec,RelCall,RelCont | rel: 2
95+
// CHECK: [[@LINE+4]]:9 | struct/Swift | s:{{.*}} | Ref,RelCont | rel: 1
96+
// CHECK: [[@LINE+3]]:12 | static-method/acc-get/Swift | s:{{.*}} | Ref,Call,Impl,RelCall,RelCont | rel: 1
9897
// CHECK-NEXT: RelCall,RelCont | [[staticMethod_USR]]
99-
// CHECK-NEXT: RelRec | [[S1_USR]]
10098
// CHECK: [[@LINE+1]]:12 | static-property/Swift | s:{{.*}} | Ref,Read,RelCont | rel: 1
10199
_ = S1.staticProperty
102100
}

test/Index/index_callasfunction.swift

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,24 @@ let global = 1
1818

1919
add3(global)
2020
// CHECK: [[@LINE-1]]:1 | variable/Swift | add3 | [[add3]] | Ref,Read |
21-
// CHECK: [[@LINE-2]]:5 | instance-method/Swift | callAsFunction(_:) | [[callAsFunc1]] | Ref,Call,RelRec | rel: 1
22-
// CHECK: RelRec | struct/Swift | Adder |
23-
// CHECK: [[@LINE-4]]:6 | variable/Swift | global | {{.*}} | Ref,Read |
21+
// CHECK: [[@LINE-2]]:5 | instance-method/Swift | callAsFunction(_:) | [[callAsFunc1]] | Ref,Call | rel: 0
22+
// CHECK: [[@LINE-3]]:6 | variable/Swift | global | {{.*}} | Ref,Read |
2423

2524
add3(x: 10, y: 11)
2625
// CHECK: [[@LINE-1]]:1 | variable/Swift | add3 | [[add3]] | Ref,Read |
27-
// CHECK: [[@LINE-2]]:5 | instance-method/Swift | callAsFunction(x:y:) | [[callAsFunc2]] | Ref,Call,RelRec | rel: 1
28-
// CHECK: RelRec | struct/Swift | Adder |
26+
// CHECK: [[@LINE-2]]:5 | instance-method/Swift | callAsFunction(x:y:) | [[callAsFunc2]] | Ref,Call | rel: 0
2927

3028
func getAdder(_ base: Int) -> Adder { return Adder(base: base) }
3129
// CHECK: [[@LINE-1]]:6 | function/Swift | getAdder(_:) | [[getAdder:.*]] | Def | rel: 0
3230

3331
getAdder(5)(10)
3432
// CHECK: [[@LINE-1]]:1 | function/Swift | getAdder(_:) | [[getAdder]] | Ref,Call | rel: 0
35-
// CHECK: [[@LINE-2]]:12 | instance-method/Swift | callAsFunction(_:) | [[callAsFunc1]] | Ref,Call,RelRec | rel: 1
36-
// CHECK: RelRec | struct/Swift | Adder |
33+
// CHECK: [[@LINE-2]]:12 | instance-method/Swift | callAsFunction(_:) | [[callAsFunc1]] | Ref,Call | rel: 0
3734

3835
getAdder(5)(x: 1, y: 42)
3936
// CHECK: [[@LINE-1]]:1 | function/Swift | getAdder(_:) | [[getAdder]] | Ref,Call | rel: 0
40-
// CHECK: [[@LINE-2]]:12 | instance-method/Swift | callAsFunction(x:y:) | [[callAsFunc2]] | Ref,Call,RelRec | rel: 1
41-
// CHECK: RelRec | struct/Swift | Adder |
37+
// CHECK: [[@LINE-2]]:12 | instance-method/Swift | callAsFunction(x:y:) | [[callAsFunc2]] | Ref,Call | rel: 0
4238

4339
((add3.callAsFunction)(x: 5, y: 10))(x: 1, y: 42)
44-
// CHECK: [[@LINE-1]]:8 | instance-method/Swift | callAsFunction(x:y:) | [[callAsFunc2]] | Ref,Call,RelRec | rel: 1
45-
// CHECK: RelRec | struct/Swift | Adder |
46-
// CHECK: [[@LINE-3]]:37 | instance-method/Swift | callAsFunction(x:y:) | [[callAsFunc2]] | Ref,Call,RelRec | rel: 1
47-
// CHECK: RelRec | struct/Swift | Adder |
40+
// CHECK: [[@LINE-1]]:8 | instance-method/Swift | callAsFunction(x:y:) | [[callAsFunc2]] | Ref,Call | rel: 0
41+
// CHECK: [[@LINE-2]]:37 | instance-method/Swift | callAsFunction(x:y:) | [[callAsFunc2]] | Ref,Call | rel: 0

test/Index/index_curry_thunk.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ struct SomeStruct {
66

77
func test(s: SomeStruct) {
88
s.simple { }
9-
// CHECK: [[@LINE-1]]:5 | instance-method/Swift | simple(_:) | s:14swift_ide_test10SomeStructV6simpleyyyyXEF | Ref,Call,RelRec,RelCall,RelCont | rel: 2
9+
// CHECK: [[@LINE-1]]:5 | instance-method/Swift | simple(_:) | s:14swift_ide_test10SomeStructV6simpleyyyyXEF | Ref,Call,RelCall,RelCont | rel: 1
1010
(((s).simple)) { }
11-
// CHECK: [[@LINE-1]]:9 | instance-method/Swift | simple(_:) | s:14swift_ide_test10SomeStructV6simpleyyyyXEF | Ref,Call,RelRec,RelCall,RelCont | rel: 2
11+
// CHECK: [[@LINE-1]]:9 | instance-method/Swift | simple(_:) | s:14swift_ide_test10SomeStructV6simpleyyyyXEF | Ref,Call,RelCall,RelCont | rel: 1
1212
}

test/Index/index_keypath_member_lookup.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func testRead1(r: Lens<Rectangle>, a: Lens<[Int]>) {
4949

5050
// => implicit dynamicMember subscript (topLeft)
5151
// CHECK: [[TL_LINE]]:8 | instance-property/subscript/Swift | subscript(dynamicMember:) | [[SUB_USR]] | Ref,Read,Impl,RelCont | rel: 1
52-
// CHECK: [[TL_LINE]]:8 | instance-method/acc-get/Swift | getter:subscript(dynamicMember:) | [[SUB_GET_USR]] | Ref,Call,Impl,RelRec,RelCall,RelCont | rel: 2
52+
// CHECK: [[TL_LINE]]:8 | instance-method/acc-get/Swift | getter:subscript(dynamicMember:) | [[SUB_GET_USR]] | Ref,Call,Impl,RelCall,RelCont | rel: 1
5353

5454
// => property topLeft
5555
// CHECK: [[TL_LINE]]:9 | instance-property/Swift | topLeft | [[TL_USR]] | Ref,Read,RelCont | rel: 1
@@ -60,15 +60,15 @@ func testRead1(r: Lens<Rectangle>, a: Lens<[Int]>) {
6060

6161
// => implicit dynamicMember subscript (bottomRight)
6262
// CHECK: [[BR_LINE]]:8 | instance-property/subscript/Swift | subscript(dynamicMember:) | [[SUB_USR]] | Ref,Read,Impl,RelCont | rel: 1
63-
// CHECK: [[BR_LINE]]:8 | instance-method/acc-get/Swift | getter:subscript(dynamicMember:) | [[SUB_GET_USR]] | Ref,Call,Impl,RelRec,RelCall,RelCont | rel: 2
63+
// CHECK: [[BR_LINE]]:8 | instance-method/acc-get/Swift | getter:subscript(dynamicMember:) | [[SUB_GET_USR]] | Ref,Call,Impl,RelCall,RelCont | rel: 1
6464

6565
// => property bottomRight
6666
// CHECK: [[BR_LINE]]:9 | instance-property/Swift | bottomRight | [[BR_USR]] | Ref,Read,RelCont | rel: 1
6767
// CHECK: [[BR_LINE]]:9 | instance-method/acc-get/Swift | getter:bottomRight | [[BR_GET_USR]] | Ref,Call,Impl,RelCall,RelCont | rel: 1
6868

6969
// => implicit dynamicMember subscript (y)
7070
// CHECK: [[BR_LINE]]:20 | instance-property/subscript/Swift | subscript(dynamicMember:) | [[SUB_USR]] | Ref,Read,Impl,RelCont | rel: 1
71-
// CHECK: [[BR_LINE]]:20 | instance-method/acc-get/Swift | getter:subscript(dynamicMember:) | [[SUB_GET_USR]] | Ref,Call,Impl,RelRec,RelCall,RelCont | rel: 2
71+
// CHECK: [[BR_LINE]]:20 | instance-method/acc-get/Swift | getter:subscript(dynamicMember:) | [[SUB_GET_USR]] | Ref,Call,Impl,RelCall,RelCont | rel: 1
7272

7373
// => property y
7474
// CHECK: [[BR_LINE]]:21 | instance-property/Swift | y | [[PY_USR]] | Ref,Read,RelCont | rel: 1
@@ -79,7 +79,7 @@ func testRead1(r: Lens<Rectangle>, a: Lens<[Int]>) {
7979

8080
// => implicit dynamicMember subscript
8181
// CHECK: [[A_LINE]]:8 | instance-property/subscript/Swift | subscript(dynamicMember:) | [[SUB_USR]] | Ref,Read,Impl,RelCont | rel: 1
82-
// CHECK: [[A_LINE]]:8 | instance-method/acc-get/Swift | getter:subscript(dynamicMember:) | [[SUB_GET_USR]] | Ref,Call,Impl,RelRec,RelCall,RelCont | rel: 2
82+
// CHECK: [[A_LINE]]:8 | instance-method/acc-get/Swift | getter:subscript(dynamicMember:) | [[SUB_GET_USR]] | Ref,Call,Impl,RelCall,RelCont | rel: 1
8383

8484
// => subscript [Int]
8585
// CHECK: [[A_LINE]]:8 | instance-property/subscript/Swift | subscript(_:) | s:SayxSicip | Ref,Read,RelCont | rel: 1
@@ -155,7 +155,7 @@ extension Foo {
155155
// CHECK-NEXT: RelChild,RelAcc | instance-property/subscript/Swift | subscript(dynamicMember:) | [[SUB2_USR]]
156156

157157
prop[keyPath: keyPath]
158-
// CHECK: [[@LINE-1]]:5 | instance-property/Swift | prop | [[PROP_USR]] | Ref,Read,RelCont | rel: 1
158+
// CHECK: [[@LINE-1]]:5 | instance-property/Swift | prop | [[PROP_USR]] | Ref,Read,Dyn,RelCont | rel: 1
159159
}
160160
}
161161

0 commit comments

Comments
 (0)