2018-05-11 01:44:48 +02:00
|
|
|
/// <reference path='fourslash.ts' />
|
|
|
|
|
|
|
|
////function f() {
|
|
|
|
//// return f();
|
2018-07-10 20:45:16 +02:00
|
|
|
//// [|return 1;|]
|
2018-07-20 09:48:26 +02:00
|
|
|
//// function f(a?: EE) { return a; }
|
2018-07-10 20:45:16 +02:00
|
|
|
//// [|return 2;|]
|
2018-05-11 01:44:48 +02:00
|
|
|
//// type T = number;
|
|
|
|
//// interface I {}
|
|
|
|
//// const enum E {}
|
2018-07-20 09:48:26 +02:00
|
|
|
//// enum EE {}
|
2018-05-11 01:44:48 +02:00
|
|
|
//// namespace N { export type T = number; }
|
2018-07-10 20:45:16 +02:00
|
|
|
//// [|namespace N { export const x: T = 0; }|]
|
2018-05-22 16:56:29 +02:00
|
|
|
//// var x: I;
|
2018-07-10 20:45:16 +02:00
|
|
|
//// [|var y: T = 0;
|
|
|
|
//// E; N; x; y;|]
|
2018-05-11 01:44:48 +02:00
|
|
|
////}
|
|
|
|
|
2018-07-10 20:45:16 +02:00
|
|
|
verify.getSuggestionDiagnostics(test.ranges().map((range): FourSlashInterface.Diagnostic => ({
|
2018-05-22 16:56:29 +02:00
|
|
|
message: "Unreachable code detected.",
|
|
|
|
code: 7027,
|
|
|
|
reportsUnnecessary: true,
|
2018-07-10 20:45:16 +02:00
|
|
|
range,
|
|
|
|
})));
|
2018-05-22 16:56:29 +02:00
|
|
|
|
2018-07-10 20:45:16 +02:00
|
|
|
verify.codeFixAll({
|
|
|
|
fixId: "fixUnreachableCode",
|
|
|
|
fixAllDescription: "Remove all unreachable code",
|
2018-05-11 01:44:48 +02:00
|
|
|
newFileContent:
|
|
|
|
`function f() {
|
|
|
|
return f();
|
2018-07-20 09:48:26 +02:00
|
|
|
function f(a?: EE) { return a; }
|
2018-05-11 01:44:48 +02:00
|
|
|
type T = number;
|
|
|
|
interface I {}
|
|
|
|
const enum E {}
|
2018-07-20 09:48:26 +02:00
|
|
|
enum EE {}
|
2018-05-11 01:44:48 +02:00
|
|
|
namespace N { export type T = number; }
|
2018-05-22 16:56:29 +02:00
|
|
|
var x: I;
|
2018-05-11 01:44:48 +02:00
|
|
|
}`,
|
|
|
|
});
|
2018-07-20 09:48:26 +02:00
|
|
|
|
|
|
|
function f() {
|
|
|
|
return f();
|
|
|
|
function f(a?: EE) { return a; }
|
|
|
|
type T = number;
|
|
|
|
interface I {}
|
|
|
|
const enum E {}
|
|
|
|
enum EE {}
|
|
|
|
namespace N { export type T = number; }
|
|
|
|
var x: I;
|
|
|
|
}
|