-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(26217): Add missing function declaration QF
- Loading branch information
1 parent
899e2d0
commit dc448f9
Showing
28 changed files
with
588 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
tests/cases/fourslash/codeFixAddMissingFunctionDeclaration1.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
////foo(); | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "foo"], | ||
newFileContent: | ||
`foo(); | ||
function foo() { | ||
throw new Error("Function not implemented."); | ||
} | ||
` | ||
}); |
22 changes: 22 additions & 0 deletions
22
tests/cases/fourslash/codeFixAddMissingFunctionDeclaration10.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
////namespace Foo { | ||
//// export const x = 0; | ||
////} | ||
//// | ||
////Foo.test<string, number>(); | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "test"], | ||
newFileContent: | ||
`namespace Foo { | ||
export const x = 0; | ||
export function test<T, U>() { | ||
throw new Error("Function not implemented."); | ||
} | ||
} | ||
Foo.test<string, number>();` | ||
}); |
23 changes: 23 additions & 0 deletions
23
tests/cases/fourslash/codeFixAddMissingFunctionDeclaration11.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
// @filename: /test.ts | ||
////export const x = 1; | ||
|
||
// @filename: /foo.ts | ||
////import * as test from "./test"; | ||
////test.foo(); | ||
|
||
goTo.file("/foo.ts"); | ||
verify.codeFix({ | ||
index: 0, | ||
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "foo"], | ||
newFileContent: { | ||
"/test.ts": | ||
`export const x = 1; | ||
export function foo() { | ||
throw new Error("Function not implemented."); | ||
} | ||
` | ||
} | ||
}); |
28 changes: 28 additions & 0 deletions
28
tests/cases/fourslash/codeFixAddMissingFunctionDeclaration12.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
// @filename: /test.ts | ||
////export const x = 1; | ||
|
||
// @filename: /foo.ts | ||
////import * as test from "./test"; | ||
////test.foo(); | ||
////test.foo(); | ||
////test.foo(); | ||
|
||
goTo.file("/foo.ts"); | ||
verify.codeFix({ | ||
index: 0, | ||
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "foo"], | ||
applyChanges: true, | ||
newFileContent: { | ||
"/test.ts": | ||
`export const x = 1; | ||
export function foo() { | ||
throw new Error("Function not implemented."); | ||
} | ||
` | ||
} | ||
}); | ||
|
||
verify.not.codeFixAvailable(); |
23 changes: 23 additions & 0 deletions
23
tests/cases/fourslash/codeFixAddMissingFunctionDeclaration13.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
// @filename: /test.ts | ||
////export const x = 1; | ||
|
||
// @filename: /foo.ts | ||
////import * as test from "./test"; | ||
////test.foo(1, "", { x: 1, y: 1 }); | ||
|
||
goTo.file("/foo.ts"); | ||
verify.codeFix({ | ||
index: 0, | ||
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "foo"], | ||
newFileContent: { | ||
"/test.ts": | ||
`export const x = 1; | ||
export function foo(arg0: number, arg1: string, arg2: { x: number; y: number; }) { | ||
throw new Error("Function not implemented."); | ||
} | ||
` | ||
} | ||
}); |
23 changes: 23 additions & 0 deletions
23
tests/cases/fourslash/codeFixAddMissingFunctionDeclaration14.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
// @filename: /test.ts | ||
////export const x = 1; | ||
|
||
// @filename: /foo.ts | ||
////import * as test from "./test"; | ||
////const foo: string = test.foo(); | ||
|
||
goTo.file("/foo.ts"); | ||
verify.codeFix({ | ||
index: 0, | ||
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "foo"], | ||
newFileContent: { | ||
"/test.ts": | ||
`export const x = 1; | ||
export function foo(): string { | ||
throw new Error("Function not implemented."); | ||
} | ||
` | ||
} | ||
}); |
23 changes: 23 additions & 0 deletions
23
tests/cases/fourslash/codeFixAddMissingFunctionDeclaration15.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
// @filename: /test.ts | ||
////export const x = 1; | ||
|
||
// @filename: /foo.ts | ||
////import * as test from "./test"; | ||
////test.foo<string, number>(); | ||
|
||
goTo.file("/foo.ts"); | ||
verify.codeFix({ | ||
index: 0, | ||
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "foo"], | ||
newFileContent: { | ||
"/test.ts": | ||
`export const x = 1; | ||
export function foo<T, U>() { | ||
throw new Error("Function not implemented."); | ||
} | ||
` | ||
} | ||
}); |
12 changes: 12 additions & 0 deletions
12
tests/cases/fourslash/codeFixAddMissingFunctionDeclaration16.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
// @moduleResolution: node | ||
// @filename: /node_modules/test/index.js | ||
////export const x = 1; | ||
|
||
// @filename: /foo.ts | ||
////import * as test from "test"; | ||
////test.foo(); | ||
|
||
goTo.file("/foo.ts"); | ||
verify.not.codeFixAvailable(); |
22 changes: 22 additions & 0 deletions
22
tests/cases/fourslash/codeFixAddMissingFunctionDeclaration2.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
////foo(); | ||
////foo(); | ||
////foo(); | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "foo"], | ||
applyChanges: true, | ||
newFileContent: | ||
`foo(); | ||
foo(); | ||
foo(); | ||
function foo() { | ||
throw new Error("Function not implemented."); | ||
} | ||
` | ||
}); | ||
|
||
verify.not.codeFixAvailable(); |
15 changes: 15 additions & 0 deletions
15
tests/cases/fourslash/codeFixAddMissingFunctionDeclaration3.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
////foo(1, "", { x: 1, y: 1 }); | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "foo"], | ||
newFileContent: | ||
`foo(1, "", { x: 1, y: 1 }); | ||
function foo(arg0: number, arg1: string, arg2: { x: number; y: number; }) { | ||
throw new Error("Function not implemented."); | ||
} | ||
` | ||
}); |
15 changes: 15 additions & 0 deletions
15
tests/cases/fourslash/codeFixAddMissingFunctionDeclaration4.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
////const test: string = foo(); | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "foo"], | ||
newFileContent: | ||
`const test: string = foo(); | ||
function foo(): string { | ||
throw new Error("Function not implemented."); | ||
} | ||
` | ||
}); |
15 changes: 15 additions & 0 deletions
15
tests/cases/fourslash/codeFixAddMissingFunctionDeclaration5.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
////foo<string, number>(); | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "foo"], | ||
newFileContent: | ||
`foo<string, number>(); | ||
function foo<T, U>() { | ||
throw new Error("Function not implemented."); | ||
} | ||
` | ||
}); |
Oops, something went wrong.