mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Add suggestion diagnostics for unused label and unreachable code (#24261)
* Add suggestion diagnostics for unused label and unreachable code * Always error on unused left hand side of comma
This commit is contained in:
+31
-20
@@ -1208,7 +1208,7 @@ namespace ts {
|
||||
bind(node.statement);
|
||||
popActiveLabel();
|
||||
if (!activeLabel.referenced && !options.allowUnusedLabels) {
|
||||
file.bindDiagnostics.push(createDiagnosticForNode(node.label, Diagnostics.Unused_label));
|
||||
errorOrSuggestionOnFirstToken(unusedLabelIsError(options), node, Diagnostics.Unused_label);
|
||||
}
|
||||
if (!node.statement || node.statement.kind !== SyntaxKind.DoStatement) {
|
||||
// do statement sets current flow inside bindDoStatement
|
||||
@@ -1914,6 +1914,17 @@ namespace ts {
|
||||
file.bindDiagnostics.push(createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2));
|
||||
}
|
||||
|
||||
function errorOrSuggestionOnFirstToken(isError: boolean, node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any) {
|
||||
const span = getSpanOfTokenAtPosition(file, node.pos);
|
||||
const diag = createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2);
|
||||
if (isError) {
|
||||
file.bindDiagnostics.push(diag);
|
||||
}
|
||||
else {
|
||||
file.bindSuggestionDiagnostics = append(file.bindSuggestionDiagnostics, { ...diag, category: DiagnosticCategory.Suggestion });
|
||||
}
|
||||
}
|
||||
|
||||
function bind(node: Node): void {
|
||||
if (!node) {
|
||||
return;
|
||||
@@ -2730,26 +2741,26 @@ namespace ts {
|
||||
if (reportError) {
|
||||
currentFlow = reportedUnreachableFlow;
|
||||
|
||||
// unreachable code is reported if
|
||||
// - user has explicitly asked about it AND
|
||||
// - statement is in not ambient context (statements in ambient context is already an error
|
||||
// so we should not report extras) AND
|
||||
// - node is not variable statement OR
|
||||
// - node is block scoped variable statement OR
|
||||
// - node is not block scoped variable statement and at least one variable declaration has initializer
|
||||
// Rationale: we don't want to report errors on non-initialized var's since they are hoisted
|
||||
// On the other side we do want to report errors on non-initialized 'lets' because of TDZ
|
||||
const reportUnreachableCode =
|
||||
!options.allowUnreachableCode &&
|
||||
!(node.flags & NodeFlags.Ambient) &&
|
||||
(
|
||||
node.kind !== SyntaxKind.VariableStatement ||
|
||||
getCombinedNodeFlags((<VariableStatement>node).declarationList) & NodeFlags.BlockScoped ||
|
||||
forEach((<VariableStatement>node).declarationList.declarations, d => d.initializer)
|
||||
);
|
||||
if (!options.allowUnreachableCode) {
|
||||
// unreachable code is reported if
|
||||
// - user has explicitly asked about it AND
|
||||
// - statement is in not ambient context (statements in ambient context is already an error
|
||||
// so we should not report extras) AND
|
||||
// - node is not variable statement OR
|
||||
// - node is block scoped variable statement OR
|
||||
// - node is not block scoped variable statement and at least one variable declaration has initializer
|
||||
// Rationale: we don't want to report errors on non-initialized var's since they are hoisted
|
||||
// On the other side we do want to report errors on non-initialized 'lets' because of TDZ
|
||||
const isError =
|
||||
unreachableCodeIsError(options) &&
|
||||
!(node.flags & NodeFlags.Ambient) &&
|
||||
(
|
||||
!isVariableStatement(node) ||
|
||||
!!(getCombinedNodeFlags(node.declarationList) & NodeFlags.BlockScoped) ||
|
||||
node.declarationList.declarations.some(d => !!d.initializer)
|
||||
);
|
||||
|
||||
if (reportUnreachableCode) {
|
||||
errorOnFirstToken(node, Diagnostics.Unreachable_code_detected);
|
||||
errorOrSuggestionOnFirstToken(isError, node, Diagnostics.Unreachable_code_detected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1991,6 +1991,14 @@ namespace ts {
|
||||
return moduleResolution;
|
||||
}
|
||||
|
||||
export function unreachableCodeIsError(options: CompilerOptions): boolean {
|
||||
return options.allowUnreachableCode === false;
|
||||
}
|
||||
|
||||
export function unusedLabelIsError(options: CompilerOptions): boolean {
|
||||
return options.allowUnusedLabels === false;
|
||||
}
|
||||
|
||||
export function getAreDeclarationMapsEnabled(options: CompilerOptions) {
|
||||
return !!(options.declaration && options.declarationMap);
|
||||
}
|
||||
|
||||
@@ -2238,7 +2238,8 @@
|
||||
},
|
||||
"Left side of comma operator is unused and has no side effects.": {
|
||||
"category": "Error",
|
||||
"code": 2695
|
||||
"code": 2695,
|
||||
"reportsUnnecessary": true
|
||||
},
|
||||
"The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?": {
|
||||
"category": "Error",
|
||||
@@ -3673,7 +3674,8 @@
|
||||
},
|
||||
"Unreachable code detected.": {
|
||||
"category": "Error",
|
||||
"code": 7027
|
||||
"code": 7027,
|
||||
"reportsUnnecessary": true
|
||||
},
|
||||
"Unused label.": {
|
||||
"category": "Error",
|
||||
|
||||
@@ -2463,6 +2463,7 @@ namespace ts {
|
||||
if (node.symbolCount !== undefined) updated.symbolCount = node.symbolCount;
|
||||
if (node.parseDiagnostics !== undefined) updated.parseDiagnostics = node.parseDiagnostics;
|
||||
if (node.bindDiagnostics !== undefined) updated.bindDiagnostics = node.bindDiagnostics;
|
||||
if (node.bindSuggestionDiagnostics !== undefined) updated.bindSuggestionDiagnostics = node.bindSuggestionDiagnostics;
|
||||
if (node.lineMap !== undefined) updated.lineMap = node.lineMap;
|
||||
if (node.classifiableNames !== undefined) updated.classifiableNames = node.classifiableNames;
|
||||
if (node.resolvedModules !== undefined) updated.resolvedModules = node.resolvedModules;
|
||||
|
||||
@@ -912,6 +912,7 @@ namespace ts {
|
||||
|
||||
sourceFile.text = sourceText;
|
||||
sourceFile.bindDiagnostics = [];
|
||||
sourceFile.bindSuggestionDiagnostics = undefined;
|
||||
sourceFile.languageVersion = languageVersion;
|
||||
sourceFile.fileName = normalizePath(fileName);
|
||||
sourceFile.languageVariant = getLanguageVariant(scriptKind);
|
||||
|
||||
@@ -2603,6 +2603,7 @@ namespace ts {
|
||||
|
||||
// File-level diagnostics reported by the binder.
|
||||
/* @internal */ bindDiagnostics: Diagnostic[];
|
||||
/* @internal */ bindSuggestionDiagnostics?: Diagnostic[];
|
||||
|
||||
// File-level JSDoc diagnostics reported by the JSDoc parser
|
||||
/* @internal */ jsDocDiagnostics?: Diagnostic[];
|
||||
|
||||
@@ -1317,8 +1317,13 @@ Actual: ${stringify(fullActual)}`);
|
||||
}
|
||||
|
||||
private testDiagnostics(expected: ReadonlyArray<FourSlashInterface.Diagnostic>, diagnostics: ReadonlyArray<ts.Diagnostic>, category: string) {
|
||||
assert.deepEqual(ts.realizeDiagnostics(diagnostics, ts.newLineCharacter), expected.map<ts.RealizedDiagnostic>(e => (
|
||||
{ message: e.message, category, code: e.code, ...ts.createTextSpanFromRange(e.range || this.getRanges()[0]) })));
|
||||
assert.deepEqual(ts.realizeDiagnostics(diagnostics, ts.newLineCharacter), expected.map((e): ts.RealizedDiagnostic => ({
|
||||
message: e.message,
|
||||
category,
|
||||
code: e.code,
|
||||
...ts.createTextSpanFromRange(e.range || this.getRanges()[0]),
|
||||
reportsUnnecessary: e.reportsUnnecessary,
|
||||
})));
|
||||
}
|
||||
|
||||
public verifyQuickInfoAt(markerName: string, expectedText: string, expectedDocumentation?: string) {
|
||||
@@ -4422,15 +4427,15 @@ namespace FourSlashInterface {
|
||||
this.state.verifyQuickInfoDisplayParts(kind, kindModifiers, textSpan, displayParts, documentation, tags);
|
||||
}
|
||||
|
||||
public getSyntacticDiagnostics(expected: ReadonlyArray<ts.RealizedDiagnostic>) {
|
||||
public getSyntacticDiagnostics(expected: ReadonlyArray<Diagnostic>) {
|
||||
this.state.getSyntacticDiagnostics(expected);
|
||||
}
|
||||
|
||||
public getSemanticDiagnostics(expected: ReadonlyArray<ts.RealizedDiagnostic>) {
|
||||
public getSemanticDiagnostics(expected: ReadonlyArray<Diagnostic>) {
|
||||
this.state.getSemanticDiagnostics(expected);
|
||||
}
|
||||
|
||||
public getSuggestionDiagnostics(expected: ReadonlyArray<ts.RealizedDiagnostic>) {
|
||||
public getSuggestionDiagnostics(expected: ReadonlyArray<Diagnostic>) {
|
||||
this.state.getSuggestionDiagnostics(expected);
|
||||
}
|
||||
|
||||
@@ -4837,6 +4842,7 @@ namespace FourSlashInterface {
|
||||
message: string;
|
||||
range?: FourSlash.Range;
|
||||
code: number;
|
||||
reportsUnnecessary?: true;
|
||||
}
|
||||
|
||||
export interface GetEditsForFileRenameOptions {
|
||||
|
||||
@@ -548,6 +548,7 @@ namespace ts {
|
||||
public syntacticDiagnostics: Diagnostic[];
|
||||
public parseDiagnostics: Diagnostic[];
|
||||
public bindDiagnostics: Diagnostic[];
|
||||
public bindSuggestionDiagnostics?: Diagnostic[];
|
||||
|
||||
public isDeclarationFile: boolean;
|
||||
public isDefaultLib: boolean;
|
||||
|
||||
@@ -586,7 +586,7 @@ namespace ts {
|
||||
length: number;
|
||||
category: string;
|
||||
code: number;
|
||||
unused?: {};
|
||||
reportsUnnecessary?: {};
|
||||
}
|
||||
export function realizeDiagnostics(diagnostics: ReadonlyArray<Diagnostic>, newLine: string): RealizedDiagnostic[] {
|
||||
return diagnostics.map(d => realizeDiagnostic(d, newLine));
|
||||
@@ -598,7 +598,8 @@ namespace ts {
|
||||
start: diagnostic.start,
|
||||
length: diagnostic.length,
|
||||
category: diagnosticCategoryName(diagnostic),
|
||||
code: diagnostic.code
|
||||
code: diagnostic.code,
|
||||
reportsUnnecessary: diagnostic.reportsUnnecessary,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
addRange(diags, sourceFile.bindSuggestionDiagnostics);
|
||||
return diags.concat(checker.getSuggestionDiagnostics(sourceFile)).sort((d1, d2) => d1.start - d2.start);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(2
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(30,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(31,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(32,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(35,3): error TS7028: Unused label.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(35,9): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(38,2): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(38,6): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
|
||||
@@ -39,7 +38,7 @@ tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(6
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(70,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts (39 errors) ====
|
||||
==== tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts (38 errors) ====
|
||||
// expected error for all the LHS of assignments
|
||||
var value: any;
|
||||
|
||||
@@ -105,8 +104,6 @@ tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(7
|
||||
|
||||
// object literals
|
||||
{ a: 0} = value;
|
||||
~
|
||||
!!! error TS7028: Unused label.
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
tests/cases/compiler/blockScopedBindingUsedBeforeDef.ts(2,12): error TS2448: Block-scoped variable 'a' used before its declaration.
|
||||
tests/cases/compiler/blockScopedBindingUsedBeforeDef.ts(5,12): error TS2448: Block-scoped variable 'a' used before its declaration.
|
||||
tests/cases/compiler/blockScopedBindingUsedBeforeDef.ts(5,35): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/blockScopedBindingUsedBeforeDef.ts(8,7): error TS2448: Block-scoped variable 'b' used before its declaration.
|
||||
|
||||
|
||||
==== tests/cases/compiler/blockScopedBindingUsedBeforeDef.ts (4 errors) ====
|
||||
==== tests/cases/compiler/blockScopedBindingUsedBeforeDef.ts (3 errors) ====
|
||||
// 1:
|
||||
for (let {[a]: a} of [{ }]) continue;
|
||||
~
|
||||
@@ -14,8 +13,6 @@ tests/cases/compiler/blockScopedBindingUsedBeforeDef.ts(8,7): error TS2448: Bloc
|
||||
for (let {[a]: a} = { }; false; ) continue;
|
||||
~
|
||||
!!! error TS2448: Block-scoped variable 'a' used before its declaration.
|
||||
~~~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
|
||||
// 3:
|
||||
let {[b]: b} = { };
|
||||
|
||||
@@ -53,7 +53,7 @@ tests/cases/compiler/cf.ts(36,13): error TS7027: Unreachable code detected.
|
||||
}
|
||||
catch (e) {
|
||||
x++;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
x+=3;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ function f() {
|
||||
}
|
||||
catch (e) {
|
||||
x++;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
x+=3;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ function f() {
|
||||
|
||||
x++;
|
||||
>x : Symbol(x, Decl(cf.ts, 2, 7))
|
||||
}
|
||||
}
|
||||
finally {
|
||||
x+=3;
|
||||
>x : Symbol(x, Decl(cf.ts, 2, 7))
|
||||
|
||||
@@ -121,7 +121,7 @@ function f() {
|
||||
x++;
|
||||
>x++ : number
|
||||
>x : number
|
||||
}
|
||||
}
|
||||
finally {
|
||||
x+=3;
|
||||
>x+=3 : number
|
||||
|
||||
@@ -14,7 +14,6 @@ tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignm
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(38,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(39,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(40,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(43,3): error TS7028: Unused label.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(43,10): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(46,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(52,15): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
@@ -40,7 +39,7 @@ tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignm
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(85,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts (40 errors) ====
|
||||
==== tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts (39 errors) ====
|
||||
// expected error for all the LHS of compound assignments (arithmetic and addition)
|
||||
var value: any;
|
||||
|
||||
@@ -116,8 +115,6 @@ tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignm
|
||||
|
||||
// object literals
|
||||
{ a: 0 } **= value;
|
||||
~
|
||||
!!! error TS7028: Unused label.
|
||||
~~~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
tests/cases/compiler/constDeclarations-scopes.ts(12,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/constDeclarations-scopes.ts(21,1): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/constDeclarations-scopes.ts(27,1): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/constDeclarations-scopes.ts (3 errors) ====
|
||||
==== tests/cases/compiler/constDeclarations-scopes.ts (1 errors) ====
|
||||
// global
|
||||
const c = "string";
|
||||
|
||||
@@ -16,8 +14,6 @@ tests/cases/compiler/constDeclarations-scopes.ts(27,1): error TS2410: The 'with'
|
||||
}
|
||||
else {
|
||||
const c = 0;
|
||||
~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
n = c;
|
||||
}
|
||||
|
||||
@@ -27,8 +23,6 @@ tests/cases/compiler/constDeclarations-scopes.ts(27,1): error TS2410: The 'with'
|
||||
}
|
||||
|
||||
do {
|
||||
~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
const c = 0;
|
||||
n = c;
|
||||
} while (true);
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
tests/cases/compiler/declarationEmitInvalidExport.ts(2,3): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/declarationEmitInvalidExport.ts(4,30): error TS4081: Exported type alias 'MyClass' has or is using private name 'myClass'.
|
||||
tests/cases/compiler/declarationEmitInvalidExport.ts(5,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/declarationEmitInvalidExport.ts (3 errors) ====
|
||||
==== tests/cases/compiler/declarationEmitInvalidExport.ts (2 errors) ====
|
||||
if (false) {
|
||||
export var myClass = 0;
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
export type MyClass = typeof myClass;
|
||||
~~~~~~~
|
||||
|
||||
@@ -10,7 +10,6 @@ tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassS
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(12,13): error TS1005: ';' expected.
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(13,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(16,5): error TS2304: Cannot find name 'set'.
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(16,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(16,9): error TS1005: ';' expected.
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(16,9): error TS2304: Cannot find name 'C'.
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(16,11): error TS2304: Cannot find name 'v'.
|
||||
@@ -38,7 +37,7 @@ tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassS
|
||||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(31,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts (38 errors) ====
|
||||
==== tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts (37 errors) ====
|
||||
// error to use super calls outside a constructor
|
||||
|
||||
class Base {
|
||||
@@ -79,8 +78,6 @@ tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassS
|
||||
set C(v) {
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'set'.
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
tests/cases/compiler/invalidContinueInDownlevelAsync.ts(3,9): error TS1107: Jump target cannot cross function boundary.
|
||||
tests/cases/compiler/invalidContinueInDownlevelAsync.ts(6,9): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/invalidContinueInDownlevelAsync.ts (2 errors) ====
|
||||
==== tests/cases/compiler/invalidContinueInDownlevelAsync.ts (1 errors) ====
|
||||
async function func() {
|
||||
if (true) {
|
||||
continue;
|
||||
@@ -11,7 +10,5 @@ tests/cases/compiler/invalidContinueInDownlevelAsync.ts(6,9): error TS7027: Unre
|
||||
}
|
||||
else {
|
||||
await 1;
|
||||
~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,12 @@
|
||||
tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(4,1): error TS1105: A 'break' statement can only be used within an enclosing iteration or switch statement.
|
||||
tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(7,1): error TS7028: Unused label.
|
||||
tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(8,14): error TS1116: A 'break' statement can only jump to a label of an enclosing statement.
|
||||
tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(11,1): error TS7027: Unreachable code detected.
|
||||
tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(14,9): error TS1107: Jump target cannot cross function boundary.
|
||||
tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(21,9): error TS1107: Jump target cannot cross function boundary.
|
||||
tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(27,5): error TS1116: A 'break' statement can only jump to a label of an enclosing statement.
|
||||
tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(37,5): error TS1116: A 'break' statement can only jump to a label of an enclosing statement.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts (8 errors) ====
|
||||
==== tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts (6 errors) ====
|
||||
// All errors
|
||||
|
||||
// naked break not allowed
|
||||
@@ -18,16 +16,12 @@ tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.t
|
||||
|
||||
// non-existent label
|
||||
ONE:
|
||||
~~~
|
||||
!!! error TS7028: Unused label.
|
||||
while (true) break TWO;
|
||||
~~~~~~~~~~
|
||||
!!! error TS1116: A 'break' statement can only jump to a label of an enclosing statement.
|
||||
|
||||
// break from inside function
|
||||
TWO:
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
while (true){
|
||||
var x = () => {
|
||||
break TWO;
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
tests/cases/compiler/nestedBlockScopedBindings13.ts(2,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/nestedBlockScopedBindings13.ts(7,5): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/nestedBlockScopedBindings13.ts (2 errors) ====
|
||||
for (; false;) {
|
||||
let x;
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
() => x;
|
||||
}
|
||||
|
||||
for (; false;) {
|
||||
let y;
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
y = 1;
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
tests/cases/compiler/nestedBlockScopedBindings14.ts(3,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/nestedBlockScopedBindings14.ts(9,5): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/nestedBlockScopedBindings14.ts (2 errors) ====
|
||||
var x;
|
||||
for (; false;) {
|
||||
let x;
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
() => x;
|
||||
}
|
||||
|
||||
var y;
|
||||
for (; false;) {
|
||||
let y;
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
y = 1;
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
tests/cases/compiler/nestedBlockScopedBindings15.ts(3,9): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/nestedBlockScopedBindings15.ts(10,9): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/nestedBlockScopedBindings15.ts(16,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/nestedBlockScopedBindings15.ts(25,5): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/nestedBlockScopedBindings15.ts (4 errors) ====
|
||||
for (; false;) {
|
||||
{
|
||||
let x;
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
() => x;
|
||||
}
|
||||
}
|
||||
|
||||
for (; false;) {
|
||||
{
|
||||
let y;
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
y = 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (; false;) {
|
||||
switch (1){
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
case 1:
|
||||
let z0;
|
||||
() => z0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (; false;) {
|
||||
switch (1){
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
case 1:
|
||||
let z;
|
||||
z = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
tests/cases/compiler/nestedBlockScopedBindings16.ts(4,9): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/nestedBlockScopedBindings16.ts(12,9): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/nestedBlockScopedBindings16.ts(19,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/nestedBlockScopedBindings16.ts(29,5): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/nestedBlockScopedBindings16.ts (4 errors) ====
|
||||
var x;
|
||||
for (; false;) {
|
||||
{
|
||||
let x;
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
() => x;
|
||||
}
|
||||
}
|
||||
|
||||
var y;
|
||||
for (; false;) {
|
||||
{
|
||||
let y;
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
y = 1;
|
||||
}
|
||||
}
|
||||
|
||||
var z0;
|
||||
for (; false;) {
|
||||
switch (1){
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
case 1:
|
||||
let z0;
|
||||
() => z0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var z;
|
||||
for (; false;) {
|
||||
switch (1){
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
case 1:
|
||||
let z;
|
||||
z = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
tests/cases/compiler/nestedBlockScopedBindings5.ts(37,9): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/nestedBlockScopedBindings5.ts(54,9): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/nestedBlockScopedBindings5.ts(71,9): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/nestedBlockScopedBindings5.ts (3 errors) ====
|
||||
function a0() {
|
||||
for (let x in []) {
|
||||
x = x + 1;
|
||||
}
|
||||
for (let x;;) {
|
||||
x = x + 2;
|
||||
}
|
||||
}
|
||||
|
||||
function a1() {
|
||||
for (let x in []) {
|
||||
x = x + 1;
|
||||
() => x;
|
||||
}
|
||||
for (let x;;) {
|
||||
x = x + 2;
|
||||
}
|
||||
}
|
||||
|
||||
function a2() {
|
||||
for (let x in []) {
|
||||
x = x + 1;
|
||||
}
|
||||
for (let x;;) {
|
||||
x = x + 2;
|
||||
() => x;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function a3() {
|
||||
for (let x in []) {
|
||||
x = x + 1;
|
||||
() => x;
|
||||
}
|
||||
for (let x;false;) {
|
||||
x = x + 2;
|
||||
~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
() => x;
|
||||
}
|
||||
switch (1) {
|
||||
case 1:
|
||||
let x;
|
||||
() => x;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function a4() {
|
||||
for (let x in []) {
|
||||
x = x + 1;
|
||||
}
|
||||
for (let x;false;) {
|
||||
x = x + 2;
|
||||
~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
switch (1) {
|
||||
case 1:
|
||||
let x;
|
||||
() => x;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function a5() {
|
||||
let y;
|
||||
for (let x in []) {
|
||||
x = x + 1;
|
||||
}
|
||||
for (let x;false;) {
|
||||
x = x + 2;
|
||||
~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
() => x;
|
||||
}
|
||||
switch (1) {
|
||||
case 1:
|
||||
let x;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
tests/cases/compiler/nestedBlockScopedBindings7.ts(2,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/nestedBlockScopedBindings7.ts(6,5): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/nestedBlockScopedBindings7.ts (2 errors) ====
|
||||
for (let x; false;) {
|
||||
() => x;
|
||||
~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
|
||||
for (let y; false;) {
|
||||
y = 1;
|
||||
~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
tests/cases/compiler/nestedBlockScopedBindings8.ts(3,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/nestedBlockScopedBindings8.ts(8,5): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/nestedBlockScopedBindings8.ts (2 errors) ====
|
||||
var x;
|
||||
for (let x; false; ) {
|
||||
() => x;
|
||||
~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
|
||||
var y;
|
||||
for (let y; false; ) {
|
||||
y = 1;
|
||||
~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
@@ -1,16 +1,13 @@
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ModuleElements/parserErrorRecovery_ModuleElement1.ts(2,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ModuleElements/parserErrorRecovery_ModuleElement1.ts(3,1): error TS7027: Unreachable code detected.
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ModuleElements/parserErrorRecovery_ModuleElement1.ts(4,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ModuleElements/parserErrorRecovery_ModuleElement1.ts (3 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ModuleElements/parserErrorRecovery_ModuleElement1.ts (2 errors) ====
|
||||
return foo;
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
return bar;
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
@@ -1,14 +1,11 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/parserLabeledStatement1.d.ts(1,1): error TS1036: Statements are not allowed in ambient contexts.
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/parserLabeledStatement1.d.ts(1,1): error TS7028: Unused label.
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/parserLabeledStatement1.d.ts(2,3): error TS2304: Cannot find name 'bar'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/parserLabeledStatement1.d.ts (3 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/parserLabeledStatement1.d.ts (2 errors) ====
|
||||
foo:
|
||||
~~~
|
||||
!!! error TS1036: Statements are not allowed in ambient contexts.
|
||||
~~~
|
||||
!!! error TS7028: Unused label.
|
||||
bar();
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'bar'.
|
||||
@@ -1,11 +1,8 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget5.ts(1,1): error TS7028: Unused label.
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget5.ts(5,7): error TS1107: Jump target cannot cross function boundary.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget5.ts (2 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget5.ts (1 errors) ====
|
||||
target:
|
||||
~~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
while (true) {
|
||||
function f() {
|
||||
while (true) {
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueNotInIterationStatement4.ts(1,1): error TS7028: Unused label.
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueNotInIterationStatement4.ts(4,5): error TS1107: Jump target cannot cross function boundary.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueNotInIterationStatement4.ts (2 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueNotInIterationStatement4.ts (1 errors) ====
|
||||
TWO:
|
||||
~~~
|
||||
!!! error TS7028: Unused label.
|
||||
while (true){
|
||||
var x = () => {
|
||||
continue TWO;
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget5.ts(1,1): error TS7028: Unused label.
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget5.ts(5,7): error TS1107: Jump target cannot cross function boundary.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget5.ts (2 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget5.ts (1 errors) ====
|
||||
target:
|
||||
~~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
while (true) {
|
||||
function f() {
|
||||
while (true) {
|
||||
|
||||
@@ -1,16 +1,10 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel1.ts(1,1): error TS7028: Unused label.
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel1.ts(2,1): error TS1114: Duplicate label 'target'.
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel1.ts(2,1): error TS7028: Unused label.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel1.ts (3 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel1.ts (1 errors) ====
|
||||
target:
|
||||
~~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
target:
|
||||
~~~~~~
|
||||
!!! error TS1114: Duplicate label 'target'.
|
||||
~~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
while (true) {
|
||||
}
|
||||
@@ -1,18 +1,12 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel2.ts(1,1): error TS7028: Unused label.
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel2.ts(3,3): error TS1114: Duplicate label 'target'.
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel2.ts(3,3): error TS7028: Unused label.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel2.ts (3 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel2.ts (1 errors) ====
|
||||
target:
|
||||
~~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
while (true) {
|
||||
target:
|
||||
~~~~~~
|
||||
!!! error TS1114: Duplicate label 'target'.
|
||||
~~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
while (true) {
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@ tests/cases/compiler/recursiveLetConst.ts(3,12): error TS2448: Block-scoped vari
|
||||
tests/cases/compiler/recursiveLetConst.ts(4,11): error TS2448: Block-scoped variable 'y' used before its declaration.
|
||||
tests/cases/compiler/recursiveLetConst.ts(5,14): error TS2448: Block-scoped variable 'y1' used before its declaration.
|
||||
tests/cases/compiler/recursiveLetConst.ts(6,14): error TS2448: Block-scoped variable 'v' used before its declaration.
|
||||
tests/cases/compiler/recursiveLetConst.ts(7,1): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/recursiveLetConst.ts(7,16): error TS2448: Block-scoped variable 'v' used before its declaration.
|
||||
tests/cases/compiler/recursiveLetConst.ts(8,15): error TS2448: Block-scoped variable 'v' used before its declaration.
|
||||
tests/cases/compiler/recursiveLetConst.ts(9,15): error TS2448: Block-scoped variable 'v' used before its declaration.
|
||||
@@ -11,7 +10,7 @@ tests/cases/compiler/recursiveLetConst.ts(10,17): error TS2448: Block-scoped var
|
||||
tests/cases/compiler/recursiveLetConst.ts(11,11): error TS2448: Block-scoped variable 'x2' used before its declaration.
|
||||
|
||||
|
||||
==== tests/cases/compiler/recursiveLetConst.ts (11 errors) ====
|
||||
==== tests/cases/compiler/recursiveLetConst.ts (10 errors) ====
|
||||
'use strict'
|
||||
let x = x + 1;
|
||||
~
|
||||
@@ -29,8 +28,6 @@ tests/cases/compiler/recursiveLetConst.ts(11,11): error TS2448: Block-scoped var
|
||||
~
|
||||
!!! error TS2448: Block-scoped variable 'v' used before its declaration.
|
||||
for (let [v] = v; ;) { }
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
~
|
||||
!!! error TS2448: Block-scoped variable 'v' used before its declaration.
|
||||
for (let v in v) { }
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
tests/cases/compiler/recursiveNamedLambdaCall.ts(3,8): error TS2304: Cannot find name 'top'.
|
||||
tests/cases/compiler/recursiveNamedLambdaCall.ts(3,15): error TS2304: Cannot find name 'top'.
|
||||
tests/cases/compiler/recursiveNamedLambdaCall.ts(7,6): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/recursiveNamedLambdaCall.ts(8,7): error TS2304: Cannot find name 'top'.
|
||||
tests/cases/compiler/recursiveNamedLambdaCall.ts(10,14): error TS2304: Cannot find name 'setTimeout'.
|
||||
tests/cases/compiler/recursiveNamedLambdaCall.ts(14,6): error TS2304: Cannot find name 'detach'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/recursiveNamedLambdaCall.ts (6 errors) ====
|
||||
==== tests/cases/compiler/recursiveNamedLambdaCall.ts (5 errors) ====
|
||||
var promise = function( obj ) {
|
||||
|
||||
if ( top && top.doScroll ) {
|
||||
@@ -18,8 +17,6 @@ tests/cases/compiler/recursiveNamedLambdaCall.ts(14,6): error TS2304: Cannot fin
|
||||
if ( false ) {
|
||||
|
||||
try {
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
top.doScroll("left");
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'top'.
|
||||
|
||||
@@ -15,7 +15,6 @@ tests/cases/compiler/reservedWords2.ts(5,9): error TS2567: Enum declarations can
|
||||
tests/cases/compiler/reservedWords2.ts(5,10): error TS1003: Identifier expected.
|
||||
tests/cases/compiler/reservedWords2.ts(5,18): error TS1005: '=>' expected.
|
||||
tests/cases/compiler/reservedWords2.ts(6,1): error TS2304: Cannot find name 'module'.
|
||||
tests/cases/compiler/reservedWords2.ts(6,1): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/reservedWords2.ts(6,8): error TS1005: ';' expected.
|
||||
tests/cases/compiler/reservedWords2.ts(7,11): error TS2300: Duplicate identifier '(Missing)'.
|
||||
tests/cases/compiler/reservedWords2.ts(7,11): error TS1005: ':' expected.
|
||||
@@ -33,7 +32,7 @@ tests/cases/compiler/reservedWords2.ts(10,5): error TS2567: Enum declarations ca
|
||||
tests/cases/compiler/reservedWords2.ts(10,6): error TS1003: Identifier expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/reservedWords2.ts (33 errors) ====
|
||||
==== tests/cases/compiler/reservedWords2.ts (32 errors) ====
|
||||
import while = require("dfdf");
|
||||
~~~~~
|
||||
!!! error TS1109: Expression expected.
|
||||
@@ -74,8 +73,6 @@ tests/cases/compiler/reservedWords2.ts(10,6): error TS1003: Identifier expected.
|
||||
module void {}
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'module'.
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
var {while, return} = { while: 1, return: 2 };
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
tests/cases/conformance/scanner/ecmascript5/scanner10.1.1-8gs.ts(16,7): error TS2304: Cannot find name 'NotEarlyError'.
|
||||
tests/cases/conformance/scanner/ecmascript5/scanner10.1.1-8gs.ts(17,1): error TS7027: Unreachable code detected.
|
||||
tests/cases/conformance/scanner/ecmascript5/scanner10.1.1-8gs.ts(17,5): error TS1212: Identifier expected. 'public' is a reserved word in strict mode.
|
||||
|
||||
|
||||
==== tests/cases/conformance/scanner/ecmascript5/scanner10.1.1-8gs.ts (3 errors) ====
|
||||
==== tests/cases/conformance/scanner/ecmascript5/scanner10.1.1-8gs.ts (2 errors) ====
|
||||
/// Copyright (c) 2012 Ecma International. All rights reserved.
|
||||
/// Ecma International makes this code available under the terms and conditions set
|
||||
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
|
||||
@@ -23,8 +22,6 @@ tests/cases/conformance/scanner/ecmascript5/scanner10.1.1-8gs.ts(17,5): error TS
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'NotEarlyError'.
|
||||
var public = 1;
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
~~~~~~
|
||||
!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode.
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
tests/cases/compiler/setterWithReturn.ts(2,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/setterWithReturn.ts(4,13): error TS2408: Setters cannot return a value.
|
||||
tests/cases/compiler/setterWithReturn.ts(7,13): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/setterWithReturn.ts(7,13): error TS2408: Setters cannot return a value.
|
||||
|
||||
|
||||
==== tests/cases/compiler/setterWithReturn.ts (4 errors) ====
|
||||
==== tests/cases/compiler/setterWithReturn.ts (3 errors) ====
|
||||
class C234 {
|
||||
public set p1(arg1) {
|
||||
~~
|
||||
@@ -16,8 +15,6 @@ tests/cases/compiler/setterWithReturn.ts(7,13): error TS2408: Setters cannot ret
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
~~~~~~~~~
|
||||
!!! error TS2408: Setters cannot return a value.
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
tests/cases/compiler/sourceMapValidationFor.ts(20,1): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/sourceMapValidationFor.ts(32,21): error TS2695: Left side of comma operator is unused and has no side effects.
|
||||
|
||||
|
||||
==== tests/cases/compiler/sourceMapValidationFor.ts (2 errors) ====
|
||||
==== tests/cases/compiler/sourceMapValidationFor.ts (1 errors) ====
|
||||
for (var i = 0; i < 10; i++) {
|
||||
WScript.Echo("i: " + i);
|
||||
}
|
||||
@@ -23,8 +22,6 @@ tests/cases/compiler/sourceMapValidationFor.ts(32,21): error TS2695: Left side o
|
||||
for (var k = 0;; k++) {
|
||||
}
|
||||
for (k = 0;; k++)
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
{
|
||||
}
|
||||
for (; k < 10; k++) {
|
||||
|
||||
@@ -93,13 +93,12 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,39): e
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,40): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,42): error TS2693: 'number' only refers to a type, but is being used as a value here.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,49): error TS1005: ';' expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(175,1): error TS7027: Unreachable code detected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(175,29): error TS2304: Cannot find name 'm'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(175,32): error TS1005: ';' expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(175,35): error TS2304: Cannot find name 'm'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts (65 errors) ====
|
||||
==== tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts (64 errors) ====
|
||||
class C {
|
||||
n: number;
|
||||
explicitThis(this: this, m: number): number {
|
||||
@@ -431,8 +430,6 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(175,35): e
|
||||
|
||||
// can't name parameters 'this' in a lambda.
|
||||
c.explicitProperty = (this, m) => m + this.n;
|
||||
~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'm'.
|
||||
~~
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
tests/cases/compiler/throwWithoutNewLine2.ts(1,6): error TS1142: Line break not permitted here.
|
||||
tests/cases/compiler/throwWithoutNewLine2.ts(2,1): error TS2304: Cannot find name 'a'.
|
||||
tests/cases/compiler/throwWithoutNewLine2.ts(2,1): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/throwWithoutNewLine2.ts (3 errors) ====
|
||||
==== tests/cases/compiler/throwWithoutNewLine2.ts (2 errors) ====
|
||||
throw
|
||||
|
||||
!!! error TS1142: Line break not permitted here.
|
||||
a;
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'a'.
|
||||
~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
!!! error TS2304: Cannot find name 'a'.
|
||||
@@ -8,7 +8,6 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(21,33)
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(25,33): error TS1225: Cannot find parameter 'x'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(29,10): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(30,5): error TS1131: Property or signature expected.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(30,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(31,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(33,38): error TS1225: Cannot find parameter 'x'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(37,51): error TS2677: A type predicate's type must be assignable to its parameter's type.
|
||||
@@ -71,7 +70,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(166,45
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(166,54): error TS2344: Type 'number' does not satisfy the constraint 'Foo'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts (57 errors) ====
|
||||
==== tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts (56 errors) ====
|
||||
class A {
|
||||
~
|
||||
!!! error TS2300: Duplicate identifier 'A'.
|
||||
@@ -122,8 +121,6 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(166,54
|
||||
return true;
|
||||
~~~~~~
|
||||
!!! error TS1131: Property or signature expected.
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
|
||||
@@ -2,16 +2,9 @@ tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperator
|
||||
tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(47,32): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'.
|
||||
tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(48,32): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'.
|
||||
tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(58,1): error TS2695: Left side of comma operator is unused and has no side effects.
|
||||
tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(68,1): error TS7028: Unused label.
|
||||
tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(69,1): error TS7028: Unused label.
|
||||
tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(70,1): error TS7028: Unused label.
|
||||
tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(71,1): error TS7028: Unused label.
|
||||
tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(72,1): error TS7028: Unused label.
|
||||
tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(73,1): error TS7028: Unused label.
|
||||
tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(74,1): error TS7028: Unused label.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts (11 errors) ====
|
||||
==== tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts (4 errors) ====
|
||||
// typeof operator on any type
|
||||
|
||||
var ANY: any;
|
||||
@@ -88,23 +81,9 @@ tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperator
|
||||
var x: any[];
|
||||
var r: () => any;
|
||||
z: typeof ANY;
|
||||
~
|
||||
!!! error TS7028: Unused label.
|
||||
x: typeof ANY2;
|
||||
~
|
||||
!!! error TS7028: Unused label.
|
||||
r: typeof foo;
|
||||
~
|
||||
!!! error TS7028: Unused label.
|
||||
z: typeof objA.a;
|
||||
~
|
||||
!!! error TS7028: Unused label.
|
||||
z: typeof A.foo;
|
||||
~
|
||||
!!! error TS7028: Unused label.
|
||||
z: typeof M.n;
|
||||
~
|
||||
!!! error TS7028: Unused label.
|
||||
z: typeof obj1.x;
|
||||
~
|
||||
!!! error TS7028: Unused label.
|
||||
z: typeof obj1.x;
|
||||
@@ -1,14 +1,7 @@
|
||||
tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithStringType.ts(44,1): error TS2695: Left side of comma operator is unused and has no side effects.
|
||||
tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithStringType.ts(50,1): error TS7028: Unused label.
|
||||
tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithStringType.ts(51,1): error TS7028: Unused label.
|
||||
tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithStringType.ts(52,1): error TS7028: Unused label.
|
||||
tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithStringType.ts(54,1): error TS7028: Unused label.
|
||||
tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithStringType.ts(55,1): error TS7028: Unused label.
|
||||
tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithStringType.ts(56,1): error TS7028: Unused label.
|
||||
tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithStringType.ts(57,1): error TS7028: Unused label.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithStringType.ts (8 errors) ====
|
||||
==== tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithStringType.ts (1 errors) ====
|
||||
// typeof operator on string type
|
||||
var STRING: string;
|
||||
var STRING1: string[] = ["", "abc"];
|
||||
@@ -61,24 +54,10 @@ tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperator
|
||||
var x: string[];
|
||||
var r: () => string;
|
||||
z: typeof STRING;
|
||||
~
|
||||
!!! error TS7028: Unused label.
|
||||
x: typeof STRING1;
|
||||
~
|
||||
!!! error TS7028: Unused label.
|
||||
r: typeof foo;
|
||||
~
|
||||
!!! error TS7028: Unused label.
|
||||
var y = { a: "", b: "" };
|
||||
z: typeof y.a;
|
||||
~
|
||||
!!! error TS7028: Unused label.
|
||||
z: typeof objA.a;
|
||||
~
|
||||
!!! error TS7028: Unused label.
|
||||
z: typeof A.foo;
|
||||
~
|
||||
!!! error TS7028: Unused label.
|
||||
z: typeof M.n;
|
||||
~
|
||||
!!! error TS7028: Unused label.
|
||||
z: typeof M.n;
|
||||
@@ -1,10 +1,7 @@
|
||||
tests/cases/compiler/undeclaredVarEmit.ts(1,1): error TS7028: Unused label.
|
||||
tests/cases/compiler/undeclaredVarEmit.ts(1,4): error TS2693: 'number' only refers to a type, but is being used as a value here.
|
||||
|
||||
|
||||
==== tests/cases/compiler/undeclaredVarEmit.ts (2 errors) ====
|
||||
==== tests/cases/compiler/undeclaredVarEmit.ts (1 errors) ====
|
||||
f: number;
|
||||
~
|
||||
!!! error TS7028: Unused label.
|
||||
~~~~~~
|
||||
!!! error TS2693: 'number' only refers to a type, but is being used as a value here.
|
||||
@@ -1,45 +0,0 @@
|
||||
tests/cases/conformance/statements/VariableStatements/validMultipleVariableDeclarations.ts(9,1): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/VariableStatements/validMultipleVariableDeclarations.ts (1 errors) ====
|
||||
// all expected to be valid
|
||||
|
||||
var x: number;
|
||||
var x = 2;
|
||||
if (true) {
|
||||
var x = 3;
|
||||
for (var x = 0; ;) { }
|
||||
}
|
||||
var x = <number>undefined;
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
|
||||
// new declaration space, making redeclaring x as a string valid
|
||||
function declSpace() {
|
||||
var x = 'this is a string';
|
||||
}
|
||||
|
||||
interface Point { x: number; y: number; }
|
||||
|
||||
var p: Point;
|
||||
var p = { x: 1, y: 2 };
|
||||
var p: Point = { x: 0, y: undefined };
|
||||
var p = { x: 1, y: <number>undefined };
|
||||
var p: { x: number; y: number; } = { x: 1, y: 2 };
|
||||
var p = <{ x: number; y: number; }>{ x: 0, y: undefined };
|
||||
var p: typeof p;
|
||||
|
||||
var fn = function (s: string) { return 42; }
|
||||
var fn = (s: string) => 3;
|
||||
var fn: (s: string) => number;
|
||||
var fn: { (s: string): number };
|
||||
var fn = <(s: string) => number> null;
|
||||
var fn: typeof fn;
|
||||
|
||||
var a: string[];
|
||||
var a = ['a', 'b']
|
||||
var a = <string[]>[];
|
||||
var a: string[] = [];
|
||||
var a = new Array<string>();
|
||||
var a: typeof a;
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
tests/cases/conformance/statements/continueStatements/whileContinueStatements.ts(5,1): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/continueStatements/whileContinueStatements.ts (1 errors) ====
|
||||
while(true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
if (true) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
ONE:
|
||||
|
||||
while (true) {
|
||||
continue ONE;
|
||||
}
|
||||
|
||||
TWO:
|
||||
THREE:
|
||||
while (true) {
|
||||
continue THREE;
|
||||
}
|
||||
|
||||
FOUR:
|
||||
while (true) {
|
||||
FIVE:
|
||||
while (true) {
|
||||
continue FOUR;
|
||||
}
|
||||
}
|
||||
|
||||
while (true) {
|
||||
SIX:
|
||||
while (true)
|
||||
continue SIX;
|
||||
}
|
||||
|
||||
SEVEN:
|
||||
while (true)
|
||||
while (true)
|
||||
while (true)
|
||||
continue SEVEN;
|
||||
|
||||
EIGHT:
|
||||
while (true) {
|
||||
var fn = function () { }
|
||||
continue EIGHT;
|
||||
}
|
||||
|
||||
NINE:
|
||||
while (true) {
|
||||
if (true) { continue NINE; }
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// @allowUnreachableCode: false
|
||||
function f() {
|
||||
var z;
|
||||
var x=10;
|
||||
@@ -38,7 +39,7 @@ function f() {
|
||||
}
|
||||
catch (e) {
|
||||
x++;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
x+=3;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// @allowUnreachableCode: false
|
||||
var v1 = ((1, 2, 3), 4, 5, (6, 7));
|
||||
function f1() {
|
||||
var a = 1;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// @allowUnreachableCode: false
|
||||
var xx: any;
|
||||
var yy: any;
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// @allowUnreachableCode: false
|
||||
(0,eval)("10"); // fine: special case for eval
|
||||
|
||||
declare var eva;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// @allowJs: true
|
||||
// @checkJs: true
|
||||
// @noEmit: true
|
||||
// @allowUnreachableCode: false
|
||||
|
||||
// @filename: a.js
|
||||
let C = "sss";
|
||||
let C = 0; // Error: Cannot redeclare block-scoped variable 'C'.
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
// @allowJs: true
|
||||
// @checkJs: true
|
||||
// @noEmit: true
|
||||
// @filename: a.js
|
||||
// @noFallthroughCasesInSwitch: true
|
||||
// @allowUnreachableCode: false
|
||||
// @allowUnusedLabels: false
|
||||
|
||||
// @filename: a.js
|
||||
function foo(a, b) {
|
||||
switch (a) {
|
||||
case 10:
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// @allowJs: true
|
||||
// @checkJs: true
|
||||
// @outDir: out
|
||||
// @allowUnreachableCode: false
|
||||
function unreachable() {
|
||||
return 1;
|
||||
return 2;
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// @allowUnreachableCode: false
|
||||
// expected error for all the LHS of compound assignments (arithmetic and addition)
|
||||
var value: any;
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// @allowUnreachableCode: false
|
||||
var ANY: any;
|
||||
var BOOLEAN: boolean;
|
||||
var NUMBER: number;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
////function f() {
|
||||
//// return f();
|
||||
//// return 1;
|
||||
//// [|return|] 1;
|
||||
//// function f() {}
|
||||
//// return 2;
|
||||
//// type T = number;
|
||||
@@ -10,11 +10,18 @@
|
||||
//// const enum E {}
|
||||
//// enum E {}
|
||||
//// namespace N { export type T = number; }
|
||||
//// namespace N { export const x = 0; }
|
||||
//// var x;
|
||||
//// var y = 0;
|
||||
//// namespace N { export const x: T = 0; }
|
||||
//// var x: I;
|
||||
//// var y: T = 0;
|
||||
//// E; N; x; y;
|
||||
////}
|
||||
|
||||
verify.getSuggestionDiagnostics([{
|
||||
message: "Unreachable code detected.",
|
||||
code: 7027,
|
||||
reportsUnnecessary: true,
|
||||
}]);
|
||||
|
||||
verify.codeFix({
|
||||
description: "Remove unreachable code",
|
||||
index: 0,
|
||||
@@ -26,6 +33,6 @@ verify.codeFix({
|
||||
interface I {}
|
||||
const enum E {}
|
||||
namespace N { export type T = number; }
|
||||
var x;
|
||||
var x: I;
|
||||
}`,
|
||||
});
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @allowUnreachableCode: true
|
||||
|
||||
////if (false) 0;
|
||||
|
||||
verify.getSuggestionDiagnostics([]);
|
||||
@@ -10,13 +10,13 @@ verify.getSuggestionDiagnostics([
|
||||
message: "'p' is declared but its value is never read.",
|
||||
range: r0,
|
||||
code: 6133,
|
||||
unused: true,
|
||||
reportsUnnecessary: true,
|
||||
},
|
||||
{
|
||||
message: "'x' is declared but its value is never read.",
|
||||
range: r1,
|
||||
code: 6133,
|
||||
unused: true,
|
||||
reportsUnnecessary: true,
|
||||
}
|
||||
]);
|
||||
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @noUnusedLocals: true
|
||||
/////* a */[|label|]/* b */:/* c */while (1) {}
|
||||
|
||||
/////* a */label/* b */:/* c */while (1) {}
|
||||
verify.getSuggestionDiagnostics([{
|
||||
message: "Unused label.",
|
||||
code: 7028,
|
||||
reportsUnnecessary: true,
|
||||
}]);
|
||||
|
||||
verify.codeFix({
|
||||
description: "Remove unused label",
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @allowUnusedLabels: true
|
||||
|
||||
////foo: while (true) {}
|
||||
|
||||
verify.getSuggestionDiagnostics([]);
|
||||
@@ -516,7 +516,7 @@ declare namespace FourSlashInterface {
|
||||
/** @default `test.ranges()[0]` */
|
||||
range?: Range;
|
||||
code: number;
|
||||
unused?: true;
|
||||
reportsUnnecessary?: true;
|
||||
}
|
||||
interface VerifyDocumentHighlightsOptions {
|
||||
filesToSearch?: ReadonlyArray<string>;
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
//@allowJs: true
|
||||
|
||||
// @Filename: /mymodule.js
|
||||
////(function ([|root|], factory) {
|
||||
//// module.exports = factory();
|
||||
////}(this, function () {
|
||||
//// var [|unusedVar|] = "something";
|
||||
//// return {};
|
||||
////(function ([|root|], factory) {
|
||||
//// module.exports = factory();
|
||||
////}(this, function () {
|
||||
//// var [|unusedVar|] = "something";
|
||||
//// return {};
|
||||
////}));
|
||||
|
||||
// @Filename: /app.js
|
||||
//////@ts-check
|
||||
//////@ts-check
|
||||
////require("./mymodule");
|
||||
|
||||
const [range0, range1] = test.ranges();
|
||||
@@ -20,12 +20,17 @@ goTo.file("/app.js");
|
||||
verify.getSuggestionDiagnostics([]);
|
||||
|
||||
goTo.file("/mymodule.js");
|
||||
verify.getSuggestionDiagnostics([{
|
||||
message: "'root' is declared but its value is never read.",
|
||||
code: 6133,
|
||||
range: range0
|
||||
}, {
|
||||
verify.getSuggestionDiagnostics([
|
||||
{
|
||||
message: "'root' is declared but its value is never read.",
|
||||
code: 6133,
|
||||
range: range0,
|
||||
reportsUnnecessary: true,
|
||||
},
|
||||
{
|
||||
message: "'unusedVar' is declared but its value is never read.",
|
||||
code: 6133,
|
||||
range: range1
|
||||
}]);
|
||||
range: range1,
|
||||
reportsUnnecessary: true,
|
||||
},
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user