Fix #8162 and #8173: Add root symbols to search in find all referecnes

This commit is contained in:
Mohamed Hegazy 2016-04-19 19:30:11 -07:00
parent d960200dac
commit b85f34ba59
6 changed files with 103 additions and 7 deletions

View File

@ -6286,7 +6286,7 @@ namespace ts {
if (type) {
const propertySymbol = typeChecker.getPropertyOfType(type, propertyName);
if (propertySymbol) {
result.push(propertySymbol);
result.push(...typeChecker.getRootSymbols(propertySymbol));
}
// Visit the typeReference as well to see if it directly or indirectly use that property

View File

@ -0,0 +1,32 @@
/// <reference path='fourslash.ts'/>
////class Base {
//// /*1*/a: number;
//// /*2*/method(): void { }
////}
////class MyClass extends Base {
//// /*3*/a;
//// /*4*/method() { }
////}
////
////var c: MyClass;
////c./*5*/a;
////c./*6*/method();
goTo.marker("1");
verify.referencesCountIs(3);
goTo.marker("2");
verify.referencesCountIs(3);
goTo.marker("3");
verify.referencesCountIs(3);
goTo.marker("4");
verify.referencesCountIs(3);
goTo.marker("5");
verify.referencesCountIs(3);
goTo.marker("6");
verify.referencesCountIs(3);

View File

@ -0,0 +1,32 @@
/// <reference path='fourslash.ts'/>
////abstract class Base {
//// abstract /*1*/a: number;
//// abstract /*2*/method(): void;
////}
////class MyClass extends Base {
//// /*3*/a;
//// /*4*/method() { }
////}
////
////var c: MyClass;
////c./*5*/a;
////c./*6*/method();
goTo.marker("1");
verify.referencesCountIs(3);
goTo.marker("2");
verify.referencesCountIs(3);
goTo.marker("3");
verify.referencesCountIs(3);
goTo.marker("4");
verify.referencesCountIs(3);
goTo.marker("5");
verify.referencesCountIs(3);
goTo.marker("6");
verify.referencesCountIs(3);

View File

@ -0,0 +1,32 @@
/// <reference path='fourslash.ts'/>
////class Base<T> {
//// /*1*/a: this;
//// /*2*/method<U>(a?:T, b?:U): this { }
////}
////class MyClass extends Base<number> {
//// /*3*/a;
//// /*4*/method() { }
////}
////
////var c: MyClass;
////c./*5*/a;
////c./*6*/method();
goTo.marker("1");
verify.referencesCountIs(3);
goTo.marker("2");
verify.referencesCountIs(3);
goTo.marker("3");
verify.referencesCountIs(3);
goTo.marker("4");
verify.referencesCountIs(3);
goTo.marker("5");
verify.referencesCountIs(3);
goTo.marker("6");
verify.referencesCountIs(3);

View File

@ -14,13 +14,13 @@
//// v./*6*/doStuff();
goTo.marker("1");
verify.referencesCountIs(1);
verify.referencesCountIs(3);
goTo.marker("2");
verify.referencesCountIs(3);
goTo.marker("3");
verify.referencesCountIs(2);
verify.referencesCountIs(3);
goTo.marker("4");
verify.referencesCountIs(3);
@ -29,4 +29,4 @@ goTo.marker("5");
verify.referencesCountIs(3);
goTo.marker("6");
verify.referencesCountIs(2);
verify.referencesCountIs(3);

View File

@ -18,7 +18,7 @@
//// v./*8*/doStuff();
goTo.marker("1");
verify.referencesCountIs(1);
verify.referencesCountIs(3);
goTo.marker("2");
verify.referencesCountIs(3);
@ -30,7 +30,7 @@ goTo.marker("4");
verify.referencesCountIs(3);
goTo.marker("5");
verify.referencesCountIs(3);
verify.referencesCountIs(4);
goTo.marker("6");
verify.referencesCountIs(4);
@ -39,4 +39,4 @@ goTo.marker("7");
verify.referencesCountIs(4);
goTo.marker("8");
verify.referencesCountIs(3);
verify.referencesCountIs(4);