Skip to content

Commit d0cfe43

Browse files
committed
Merge pull request #8210 from Microsoft/Fix8162
Fix #8162 and #8173: Add root symbols to search in find all referecnes
2 parents 704f3bf + b85f34b commit d0cfe43

6 files changed

+103
-7
lines changed

src/services/services.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6286,7 +6286,7 @@ namespace ts {
62866286
if (type) {
62876287
const propertySymbol = typeChecker.getPropertyOfType(type, propertyName);
62886288
if (propertySymbol) {
6289-
result.push(propertySymbol);
6289+
result.push(...typeChecker.getRootSymbols(propertySymbol));
62906290
}
62916291

62926292
// Visit the typeReference as well to see if it directly or indirectly use that property
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
////class Base {
4+
//// /*1*/a: number;
5+
//// /*2*/method(): void { }
6+
////}
7+
////class MyClass extends Base {
8+
//// /*3*/a;
9+
//// /*4*/method() { }
10+
////}
11+
////
12+
////var c: MyClass;
13+
////c./*5*/a;
14+
////c./*6*/method();
15+
16+
goTo.marker("1");
17+
verify.referencesCountIs(3);
18+
19+
goTo.marker("2");
20+
verify.referencesCountIs(3);
21+
22+
goTo.marker("3");
23+
verify.referencesCountIs(3);
24+
25+
goTo.marker("4");
26+
verify.referencesCountIs(3);
27+
28+
goTo.marker("5");
29+
verify.referencesCountIs(3);
30+
31+
goTo.marker("6");
32+
verify.referencesCountIs(3);
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
////abstract class Base {
4+
//// abstract /*1*/a: number;
5+
//// abstract /*2*/method(): void;
6+
////}
7+
////class MyClass extends Base {
8+
//// /*3*/a;
9+
//// /*4*/method() { }
10+
////}
11+
////
12+
////var c: MyClass;
13+
////c./*5*/a;
14+
////c./*6*/method();
15+
16+
goTo.marker("1");
17+
verify.referencesCountIs(3);
18+
19+
goTo.marker("2");
20+
verify.referencesCountIs(3);
21+
22+
goTo.marker("3");
23+
verify.referencesCountIs(3);
24+
25+
goTo.marker("4");
26+
verify.referencesCountIs(3);
27+
28+
goTo.marker("5");
29+
verify.referencesCountIs(3);
30+
31+
goTo.marker("6");
32+
verify.referencesCountIs(3);
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
////class Base<T> {
4+
//// /*1*/a: this;
5+
//// /*2*/method<U>(a?:T, b?:U): this { }
6+
////}
7+
////class MyClass extends Base<number> {
8+
//// /*3*/a;
9+
//// /*4*/method() { }
10+
////}
11+
////
12+
////var c: MyClass;
13+
////c./*5*/a;
14+
////c./*6*/method();
15+
16+
goTo.marker("1");
17+
verify.referencesCountIs(3);
18+
19+
goTo.marker("2");
20+
verify.referencesCountIs(3);
21+
22+
goTo.marker("3");
23+
verify.referencesCountIs(3);
24+
25+
goTo.marker("4");
26+
verify.referencesCountIs(3);
27+
28+
goTo.marker("5");
29+
verify.referencesCountIs(3);
30+
31+
goTo.marker("6");
32+
verify.referencesCountIs(3);

tests/cases/fourslash/referencesForInheritedProperties6.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
//// v./*6*/doStuff();
1515

1616
goTo.marker("1");
17-
verify.referencesCountIs(1);
17+
verify.referencesCountIs(3);
1818

1919
goTo.marker("2");
2020
verify.referencesCountIs(3);
2121

2222
goTo.marker("3");
23-
verify.referencesCountIs(2);
23+
verify.referencesCountIs(3);
2424

2525
goTo.marker("4");
2626
verify.referencesCountIs(3);
@@ -29,4 +29,4 @@ goTo.marker("5");
2929
verify.referencesCountIs(3);
3030

3131
goTo.marker("6");
32-
verify.referencesCountIs(2);
32+
verify.referencesCountIs(3);

tests/cases/fourslash/referencesForInheritedProperties7.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
//// v./*8*/doStuff();
1919

2020
goTo.marker("1");
21-
verify.referencesCountIs(1);
21+
verify.referencesCountIs(3);
2222

2323
goTo.marker("2");
2424
verify.referencesCountIs(3);
@@ -30,7 +30,7 @@ goTo.marker("4");
3030
verify.referencesCountIs(3);
3131

3232
goTo.marker("5");
33-
verify.referencesCountIs(3);
33+
verify.referencesCountIs(4);
3434

3535
goTo.marker("6");
3636
verify.referencesCountIs(4);
@@ -39,4 +39,4 @@ goTo.marker("7");
3939
verify.referencesCountIs(4);
4040

4141
goTo.marker("8");
42-
verify.referencesCountIs(3);
42+
verify.referencesCountIs(4);

0 commit comments

Comments
 (0)