Skip to content

Commit 4a37fd7

Browse files
committed
More PR feedback
1 parent f91a123 commit 4a37fd7

File tree

51 files changed

+192
-225
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+192
-225
lines changed

src/harness/fourslash.ts

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1680,13 +1680,13 @@ namespace FourSlash {
16801680
assertFn(actualCount, expectedCount, this.messageAtLastKnownMarker("Type definitions Count"));
16811681
}
16821682

1683-
public verifyImplementationsCount(negative: boolean, expectedCount: number) {
1683+
public verifyImplementationListIsEmpty(negative: boolean) {
16841684
const assertFn = negative ? assert.notEqual : assert.equal;
16851685

16861686
const implementations = this.languageService.getImplementationAtPosition(this.activeFile.fileName, this.currentCaretPosition);
16871687
const actualCount = implementations && implementations.length || 0;
16881688

1689-
assertFn(actualCount, expectedCount, this.messageAtLastKnownMarker("Implementations Count"));
1689+
assertFn(actualCount, 0, this.messageAtLastKnownMarker("Implementations Count"));
16901690
}
16911691

16921692
public verifyGoToDefinitionName(expectedName: string, expectedContainerName: string) {
@@ -1697,26 +1697,22 @@ namespace FourSlash {
16971697
assert.equal(actualDefinitionContainerName, expectedContainerName, this.messageAtLastKnownMarker("Definition Info Container Name"));
16981698
}
16991699

1700-
public goToImplementation(implIndex?: number) {
1700+
public goToImplementation() {
17011701
const implementations = this.languageService.getImplementationAtPosition(this.activeFile.fileName, this.currentCaretPosition);
17021702
if (!implementations || !implementations.length) {
17031703
this.raiseError("goToImplementation failed - expected to find at least one implementation location but got 0");
17041704
}
1705-
1706-
if (implIndex === undefined && implementations.length > 1) {
1707-
this.raiseError(`goToImplementation failed - no index given but more than 1 implementation returned (${implementations.length})`);
1708-
}
1709-
1710-
if (implIndex >= implementations.length) {
1711-
this.raiseError(`goToImplementation failed - implIndex value (${implIndex}) exceeds implementation list size (${implementations.length})`);
1705+
if (implementations.length > 1) {
1706+
this.raiseError(`goToImplementation failed - more than 1 implementation returned (${implementations.length})`);
17121707
}
17131708

1714-
const implementation = implementations[implIndex || 0];
1709+
const implementation = implementations[0];
17151710
this.openFile(implementation.fileName);
17161711
this.currentCaretPosition = implementation.textSpan.start;
17171712
}
17181713

1719-
public verifyRangesInImplementationList() {
1714+
public verifyRangesInImplementationList(markerName: string) {
1715+
this.goToMarker(markerName);
17201716
const implementations: ImplementationLocationInformation[] = this.languageService.getImplementationAtPosition(this.activeFile.fileName, this.currentCaretPosition);
17211717
if (!implementations || !implementations.length) {
17221718
this.raiseError("verifyRangesInImplementationList failed - expected to find at least one implementation location but got 0");
@@ -2954,8 +2950,8 @@ namespace FourSlashInterface {
29542950
this.state.goToTypeDefinition(definitionIndex);
29552951
}
29562952

2957-
public implementation(implementationIndex?: number) {
2958-
this.state.goToImplementation(implementationIndex);
2953+
public implementation() {
2954+
this.state.goToImplementation();
29592955
}
29602956

29612957
public position(position: number, fileIndex?: number): void;
@@ -3062,8 +3058,8 @@ namespace FourSlashInterface {
30623058
this.state.verifyTypeDefinitionsCount(this.negative, expectedCount);
30633059
}
30643060

3065-
public implementationCountIs(expectedCount: number) {
3066-
this.state.verifyImplementationsCount(this.negative, expectedCount);
3061+
public implementationListIsEmpty() {
3062+
this.state.verifyImplementationListIsEmpty(this.negative);
30673063
}
30683064

30693065
public isValidBraceCompletionAtPosition(openingBrace: string) {
@@ -3319,8 +3315,8 @@ namespace FourSlashInterface {
33193315
this.state.verifyProjectInfo(expected);
33203316
}
33213317

3322-
public allRangesAppearInImplementationList() {
3323-
this.state.verifyRangesInImplementationList();
3318+
public allRangesAppearInImplementationList(markerName: string) {
3319+
this.state.verifyRangesInImplementationList(markerName);
33243320
}
33253321
}
33263322

src/services/services.ts

Lines changed: 84 additions & 85 deletions
Large diffs are not rendered by default.

src/services/shims.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ namespace ts {
179179

180180
/**
181181
* Returns a JSON-encoded value of the type:
182-
* { fileName: string; textSpan: { start: number; length: number}; isWriteAccess: boolean, isDefinition?: boolean }[]
182+
* { fileName: string; textSpan: { start: number; length: number}; }[]
183183
*/
184184
getImplementationAtPosition(fileName: string, position: number): string;
185185

tests/cases/fourslash/fourslash.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ declare namespace FourSlashInterface {
110110
bof(): void;
111111
eof(): void;
112112
type(definitionIndex?: number): void;
113-
implementation(implementationIndex?: number): void;
113+
implementation(): void;
114114
position(position: number, fileIndex?: number): any;
115115
position(position: number, fileName?: string): any;
116116
file(index: number, content?: string, scriptKindName?: string): any;
@@ -134,7 +134,7 @@ declare namespace FourSlashInterface {
134134
quickInfoIs(expectedText?: string, expectedDocumentation?: string): void;
135135
quickInfoExists(): void;
136136
typeDefinitionCountIs(expectedCount: number): void;
137-
implementationCountIs(expectedCount: number): void;
137+
implementationListIsEmpty(): void;
138138
isValidBraceCompletionAtPosition(openingBrace?: string): void;
139139
}
140140
class verify extends verifyNegatable {
@@ -242,7 +242,7 @@ declare namespace FourSlashInterface {
242242
getSyntacticDiagnostics(expected: string): void;
243243
getSemanticDiagnostics(expected: string): void;
244244
ProjectInfo(expected: string[]): void;
245-
allRangesAppearInImplementationList(): void;
245+
allRangesAppearInImplementationList(markerName: string): void;
246246
}
247247
class edit {
248248
backspace(count?: number): void;

tests/cases/fourslash/goToImplementationClassMethod_00.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@
88
////
99
//// new Bar().hel/*reference*/lo;
1010

11-
goTo.marker("reference");
12-
verify.allRangesAppearInImplementationList();
11+
verify.allRangesAppearInImplementationList("reference");

tests/cases/fourslash/goToImplementationClassMethod_01.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,5 @@
1414
//// x.he/*reference*/llo();
1515
//// }
1616

17-
goTo.marker("reference");
18-
verify.allRangesAppearInImplementationList();
19-
20-
goTo.marker("declaration");
21-
verify.allRangesAppearInImplementationList();
17+
verify.allRangesAppearInImplementationList("reference");
18+
verify.allRangesAppearInImplementationList("declaration");

tests/cases/fourslash/goToImplementationEnum_00.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@
99
////
1010
//// Foo.Fo/*reference*/o1;
1111

12-
goTo.marker("reference");
13-
verify.allRangesAppearInImplementationList();
12+
verify.allRangesAppearInImplementationList("reference");

tests/cases/fourslash/goToImplementationEnum_01.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@
99
////
1010
//// Fo/*reference*/o;
1111

12-
goTo.marker("reference");
13-
verify.allRangesAppearInImplementationList();
12+
verify.allRangesAppearInImplementationList("reference");

tests/cases/fourslash/goToImplementationInterfaceMethod_00.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,5 @@
2121
//// constructor(public f: Foo = { [|hello() {/**3*/}|] } ) {}
2222
//// }
2323

24-
goTo.marker("function_call");
25-
verify.allRangesAppearInImplementationList();
26-
27-
goTo.marker("declaration");
28-
verify.allRangesAppearInImplementationList();
24+
verify.allRangesAppearInImplementationList("function_call");
25+
verify.allRangesAppearInImplementationList("declaration");

tests/cases/fourslash/goToImplementationInterfaceMethod_01.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,5 @@
1818
////
1919
//// whatever(new Bar());
2020

21-
goTo.marker("function_call");
22-
verify.allRangesAppearInImplementationList();
23-
24-
goTo.marker("declaration");
25-
verify.allRangesAppearInImplementationList();
21+
verify.allRangesAppearInImplementationList("function_call");
22+
verify.allRangesAppearInImplementationList("declaration");

tests/cases/fourslash/goToImplementationInterfaceMethod_02.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,5 @@
1818
//// a.he/*function_call*/llo();
1919
//// }
2020

21-
goTo.marker("function_call");
22-
verify.allRangesAppearInImplementationList();
23-
24-
goTo.marker("declaration");
25-
verify.allRangesAppearInImplementationList();
21+
verify.allRangesAppearInImplementationList("function_call");
22+
verify.allRangesAppearInImplementationList("declaration");

tests/cases/fourslash/goToImplementationInterfaceMethod_03.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,4 @@
2121
//// new Bar().hel/*function_call*/lo();
2222
//// new Bar()["hello"]();
2323

24-
goTo.marker("function_call");
25-
verify.allRangesAppearInImplementationList();
24+
verify.allRangesAppearInImplementationList("function_call");

tests/cases/fourslash/goToImplementationInterfaceMethod_04.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,4 @@
2222
//// x.he/*function_call*/llo()
2323
//// }
2424

25-
goTo.marker("function_call");
26-
verify.allRangesAppearInImplementationList();
25+
verify.allRangesAppearInImplementationList("function_call");

tests/cases/fourslash/goToImplementationInterfaceMethod_05.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,4 @@
3434
//// x.he/*function_call*/llo()
3535
//// }
3636

37-
goTo.marker("function_call");
38-
verify.allRangesAppearInImplementationList();
37+
verify.allRangesAppearInImplementationList("function_call");

tests/cases/fourslash/goToImplementationInterfaceMethod_06.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,4 @@
4545
//// x.he/*function_call*/llo()
4646
//// }
4747

48-
goTo.marker("function_call");
49-
verify.allRangesAppearInImplementationList();
48+
verify.allRangesAppearInImplementationList("function_call");

tests/cases/fourslash/goToImplementationInterfaceMethod_08.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@
1919
//// }
2020

2121

22-
goTo.marker("function_call");
23-
verify.allRangesAppearInImplementationList();
22+
verify.allRangesAppearInImplementationList("function_call");

tests/cases/fourslash/goToImplementationInterfaceMethod_09.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,5 @@
2727
//// hello() {}
2828
//// }
2929

30-
goTo.marker("function_call");
31-
verify.allRangesAppearInImplementationList();
32-
33-
goTo.marker("element_access");
34-
verify.allRangesAppearInImplementationList();
30+
verify.allRangesAppearInImplementationList("function_call");
31+
verify.allRangesAppearInImplementationList("element_access");

tests/cases/fourslash/goToImplementationInterfaceMethod_10.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,5 @@
4444
//// }
4545

4646
for (var i = 0; i < 2; i++) {
47-
goTo.marker("function_call" + i);
48-
verify.allRangesAppearInImplementationList();
47+
verify.allRangesAppearInImplementationList("function_call" + i);
4948
}

tests/cases/fourslash/goToImplementationInterfaceMethod_11.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
////
99
//// var x = <Foo> { [|hello: () => {}|] };
1010
//// var y = <Foo> (((({ [|hello: () => {}|] }))));
11-
goTo.marker("reference");
12-
verify.allRangesAppearInImplementationList();
11+
12+
verify.allRangesAppearInImplementationList("reference");

tests/cases/fourslash/goToImplementationInterfaceProperty_00.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@
1919
//// constructor(public f: Foo = { [|hello: 7|] } ) {}
2020
//// }
2121

22-
goTo.marker("reference");
23-
verify.allRangesAppearInImplementationList();
22+
verify.allRangesAppearInImplementationList("reference");

tests/cases/fourslash/goToImplementationInterfaceProperty_01.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@
1212
//// foo.he/*reference*/llo;
1313
//// }
1414

15-
goTo.marker("reference");
16-
verify.allRangesAppearInImplementationList();
15+
verify.allRangesAppearInImplementationList("reference");

tests/cases/fourslash/goToImplementationInterface_00.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,4 @@
2222
//// constructor(public f: Foo = [|{ hello() {/**3*/} }|] ) {}
2323
//// }
2424

25-
26-
goTo.marker("interface_definition");
27-
verify.allRangesAppearInImplementationList();
25+
verify.allRangesAppearInImplementationList("interface_definition");

tests/cases/fourslash/goToImplementationInterface_01.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,4 @@
2121
//// var y: SuperBar = new SuperBar();
2222
//// var z: AbstractBar = new NotAbstractBar();
2323

24-
goTo.marker("interface_definition");
25-
verify.allRangesAppearInImplementationList();
24+
verify.allRangesAppearInImplementationList("interface_definition");

tests/cases/fourslash/goToImplementationInterface_02.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@
1717
//// }|];
1818
//// }
1919
////
20+
//// let createFoo2 = (): Foo => [|({hello() {}})|];
21+
////
2022
//// function createFooLike() {
2123
//// return {
2224
//// hello() {}
2325
//// };
2426
//// }
2527

26-
goTo.marker("interface_definition");
27-
verify.allRangesAppearInImplementationList();
28+
verify.allRangesAppearInImplementationList("interface_definition");

tests/cases/fourslash/goToImplementationInterface_03.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@
66
////
77
//// var x = <Foo> [|{ hello: () => {} }|];
88

9-
goTo.marker("interface_definition");
10-
verify.allRangesAppearInImplementationList();
9+
verify.allRangesAppearInImplementationList("interface_definition");

tests/cases/fourslash/goToImplementationInterface_04.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,4 @@
1717
//// constructor(public f: Foo = [|function(a) {}|] ) {}
1818
//// }
1919

20-
21-
goTo.marker("interface_definition");
22-
verify.allRangesAppearInImplementationList();
20+
verify.allRangesAppearInImplementationList("interface_definition");

tests/cases/fourslash/goToImplementationInterface_05.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,4 @@
99
//// let bar2 = <Foo> [|function(a) {}|];
1010
////
1111

12-
13-
goTo.marker("interface_definition");
14-
verify.allRangesAppearInImplementationList();
12+
verify.allRangesAppearInImplementationList("interface_definition");

tests/cases/fourslash/goToImplementationInterface_06.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,4 @@
1111
//// let x: Foo = [|class { constructor (a: number) {} }|];
1212
//// let y = <Foo> [|class { constructor (a: number) {} }|];
1313

14-
15-
goTo.marker("interface_definition");
16-
verify.allRangesAppearInImplementationList();
14+
verify.allRangesAppearInImplementationList("interface_definition");

tests/cases/fourslash/goToImplementationInterface_07.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,4 @@
2525
//// return true;
2626
//// }
2727

28-
goTo.marker("interface_definition");
29-
verify.allRangesAppearInImplementationList();
28+
verify.allRangesAppearInImplementationList("interface_definition");
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
// Should not hang on inheritance loops
4+
5+
//// interface Base {
6+
//// hello (): void;
7+
//// }
8+
////
9+
//// interface A extends Base {}
10+
//// interface B extends C, A {}
11+
//// interface C extends B, A {}
12+
////
13+
//// class X implements B {
14+
//// [|hello() {}|]
15+
//// }
16+
////
17+
//// function someFunction(d : A) {
18+
//// d.he/*function_call*/llo();
19+
//// }
20+
21+
verify.allRangesAppearInImplementationList("function_call");

0 commit comments

Comments
 (0)