File tree Expand file tree Collapse file tree 2 files changed +25
-7
lines changed
test/SymbolGraph/Relationships/Synthesized Expand file tree Collapse file tree 2 files changed +25
-7
lines changed Original file line number Diff line number Diff line change @@ -276,15 +276,21 @@ void SymbolGraph::recordMemberRelationship(Symbol S) {
276
276
277
277
bool SymbolGraph::synthesizedMemberIsBestCandidate (const ValueDecl *VD,
278
278
const NominalTypeDecl *Owner) const {
279
- const auto *FD = dyn_cast<FuncDecl>(VD);
280
- if (!FD) {
279
+ DeclName Name;
280
+ if (const auto *FD = dyn_cast<FuncDecl>(VD)) {
281
+ Name = FD->getEffectiveFullName ();
282
+ } else {
283
+ Name = VD->getName ();
284
+ }
285
+
286
+ if (!Name) {
281
287
return true ;
282
288
}
289
+
283
290
auto *DC = const_cast <DeclContext*>(Owner->getDeclContext ());
284
291
285
292
ResolvedMemberResult Result =
286
- resolveValueMember (*DC, Owner->getSelfTypeInContext (),
287
- FD->getEffectiveFullName ());
293
+ resolveValueMember (*DC, Owner->getSelfTypeInContext (), Name);
288
294
289
295
const auto ViableCandidates =
290
296
Result.getMemberDecls (InterestedMemberKind::All);
Original file line number Diff line number Diff line change 6
6
public protocol P {
7
7
func foo( )
8
8
func bar( )
9
+
10
+ var baz : Int { get }
11
+ var qux : Int { get }
9
12
}
10
13
11
14
public protocol Q : P { }
12
15
extension Q {
13
16
public func foo( ) { }
14
17
public func bar( ) { }
18
+
19
+ public var baz : Int { 0 }
20
+ public var qux : Int { 0 }
15
21
}
16
22
17
23
public protocol R : Q { }
18
24
extension R {
19
25
public func foo( ) { }
20
26
public func bar( ) { }
27
+
28
+ public var baz : Int { 1 }
29
+ public var qux : Int { 1 }
21
30
}
22
31
23
32
public struct MyStruct : R {
24
33
public func bar( ) { }
34
+
35
+ public var qux : Int { 2 }
25
36
}
26
37
27
- // MyStruct gets one and only one synthesized `foo`.
28
- // MyStruct gets no synthesized `bar`, because it has its own implementation.
29
- // CHECK-COUNT-1: ::SYNTHESIZED::
38
+ // MyStruct gets one and only one synthesized `foo` and `baz`.
39
+ // MyStruct gets no synthesized `bar` and `qux`, because it has its own implementation.
40
+ // CHECK-COUNT-2: "precise": {{.*}}::SYNTHESIZED::
41
+ // CHECK-NOT: "precise": {{.*}}::SYNTHESIZED::
You can’t perform that action at this time.
0 commit comments