mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-23 10:29:01 -06:00
updated command line options, accepted baselines
This commit is contained in:
parent
ca0d580a14
commit
f0f5a0d71e
@ -557,14 +557,11 @@ namespace ts {
|
||||
function bindBreakOrContinueStatement(n: BreakOrContinueStatement): boolean {
|
||||
// call bind on label (don't affect reachability)
|
||||
bind(n.label);
|
||||
if (n.kind === SyntaxKind.BreakStatement) {
|
||||
jumpToLabel(n.label, currentReachabilityState);
|
||||
// for continue case touch label so it will be marked a used
|
||||
const isValidJump = jumpToLabel(n.label, n.kind === SyntaxKind.BreakStatement ? currentReachabilityState : Reachability.Unreachable);
|
||||
if (isValidJump) {
|
||||
currentReachabilityState = Reachability.Unreachable;
|
||||
}
|
||||
else {
|
||||
jumpToLabel(n.label, Reachability.Unreachable); // touch label so it will be marked a used
|
||||
}
|
||||
currentReachabilityState = Reachability.Unreachable;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1406,7 +1403,7 @@ namespace ts {
|
||||
initializeReachabilityStateIfNecessary();
|
||||
|
||||
if (innerMergedState === Reachability.Unintialized) {
|
||||
if (label && options.noUnusedLabels) {
|
||||
if (label && !options.allowUnusedLabels) {
|
||||
file.bindDiagnostics.push(createDiagnosticForNode(label, Diagnostics.Unused_label));
|
||||
}
|
||||
currentReachabilityState = outerState;
|
||||
@ -1416,17 +1413,18 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function jumpToLabel(label: Identifier, outerState: Reachability): void {
|
||||
function jumpToLabel(label: Identifier, outerState: Reachability): boolean {
|
||||
initializeReachabilityStateIfNecessary();
|
||||
|
||||
const index = label ? labelIndexMap[label.text] : lastOrUndefined(implicitLabels);
|
||||
if (index === undefined) {
|
||||
// reference to unknown label or
|
||||
// break/continue used outside of loops
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
const stateAtLabel = labelStack[index];
|
||||
labelStack[index] = stateAtLabel === Reachability.Unintialized ? outerState : or(stateAtLabel, outerState);
|
||||
return true;
|
||||
}
|
||||
|
||||
function checkUnreachable(node: Node): boolean {
|
||||
@ -1455,7 +1453,7 @@ namespace ts {
|
||||
// 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.noUnreachableCode &&
|
||||
!options.allowUnreachableCode &&
|
||||
!isInAmbientContext(node) &&
|
||||
(
|
||||
node.kind !== SyntaxKind.VariableStatement ||
|
||||
@ -1464,7 +1462,7 @@ namespace ts {
|
||||
);
|
||||
|
||||
if (reportUnreachableCode) {
|
||||
file.bindDiagnostics.push(createDiagnosticForNode(node, Diagnostics.Unreachable_code_detected));
|
||||
errorOnFirstToken(node, Diagnostics.Unreachable_code_detected);
|
||||
}
|
||||
}
|
||||
case Reachability.ReportedUnreachable:
|
||||
|
||||
@ -248,9 +248,9 @@ namespace ts {
|
||||
error: Diagnostics.Argument_for_moduleResolution_option_must_be_node_or_classic,
|
||||
},
|
||||
{
|
||||
name: "noUnusedLabels",
|
||||
name: "allowUnusedLabels",
|
||||
type: "boolean",
|
||||
description: Diagnostics.Report_error_on_unused_labels
|
||||
description: Diagnostics.Do_not_report_errors_on_unused_labels
|
||||
},
|
||||
{
|
||||
name: "noImplicitReturns",
|
||||
@ -263,9 +263,9 @@ namespace ts {
|
||||
description: Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement
|
||||
},
|
||||
{
|
||||
name: "noUnreachableCode",
|
||||
name: "allowUnreachableCode",
|
||||
type: "boolean",
|
||||
description: Diagnostics.Report_errors_on_unreachable_code
|
||||
description: Diagnostics.Do_not_report_errors_on_unreachable_code
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@ -2302,7 +2302,7 @@
|
||||
"category": "Message",
|
||||
"code": 6072
|
||||
},
|
||||
"Report error on unused labels.": {
|
||||
"Do not report errors on unused labels.": {
|
||||
"category": "Message",
|
||||
"code": 6073
|
||||
},
|
||||
@ -2314,7 +2314,7 @@
|
||||
"category": "Message",
|
||||
"code": 6075
|
||||
},
|
||||
"Report errors on unreachable code.": {
|
||||
"Do not report errors on unreachable code.": {
|
||||
"category": "Message",
|
||||
"code": 6076
|
||||
},
|
||||
|
||||
@ -2075,10 +2075,10 @@ namespace ts {
|
||||
experimentalAsyncFunctions?: boolean;
|
||||
emitDecoratorMetadata?: boolean;
|
||||
moduleResolution?: ModuleResolutionKind;
|
||||
noUnusedLabels?: boolean;
|
||||
allowUnusedLabels?: boolean;
|
||||
allowUnreachableCode?: boolean;
|
||||
noImplicitReturns?: boolean;
|
||||
noFallthroughCasesInSwitch?: boolean;
|
||||
noUnreachableCode?: boolean;
|
||||
/* @internal */ stripInternal?: boolean;
|
||||
|
||||
// Skip checking lib.d.ts to help speed up tests.
|
||||
|
||||
@ -1203,7 +1203,7 @@ namespace ts {
|
||||
case SyntaxKind.LabeledStatement:
|
||||
case SyntaxKind.ReturnStatement:
|
||||
case SyntaxKind.SwitchStatement:
|
||||
case SyntaxKind.ThrowKeyword:
|
||||
case SyntaxKind.ThrowStatement:
|
||||
case SyntaxKind.TryStatement:
|
||||
case SyntaxKind.VariableStatement:
|
||||
case SyntaxKind.WhileStatement:
|
||||
|
||||
@ -13,6 +13,7 @@ tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(2
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(30,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(31,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(32,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
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: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(38,6): error TS2364: Invalid left-hand side of assignment expression.
|
||||
@ -38,7 +39,7 @@ tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(6
|
||||
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(70,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts (38 errors) ====
|
||||
==== tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts (39 errors) ====
|
||||
// expected error for all the LHS of assignments
|
||||
var value;
|
||||
|
||||
@ -104,6 +105,8 @@ tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(7
|
||||
|
||||
// object literals
|
||||
{ a: 0} = value;
|
||||
~
|
||||
!!! error TS7028: Unused label.
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
tests/cases/compiler/bestCommonTypeReturnStatement.ts(7,5): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/bestCommonTypeReturnStatement.ts (1 errors) ====
|
||||
interface IPromise<T> {
|
||||
then(successCallback: (promiseValue: T) => any, errorCallback?: (reason: any) => any): IPromise<any>;
|
||||
}
|
||||
|
||||
function f() {
|
||||
if (true) return b();
|
||||
return d();
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
|
||||
|
||||
function b(): IPromise<void> { return null; }
|
||||
function d(): IPromise<any> { return null; }
|
||||
@ -1,34 +0,0 @@
|
||||
=== tests/cases/compiler/bestCommonTypeReturnStatement.ts ===
|
||||
interface IPromise<T> {
|
||||
>IPromise : Symbol(IPromise, Decl(bestCommonTypeReturnStatement.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(bestCommonTypeReturnStatement.ts, 0, 19))
|
||||
|
||||
then(successCallback: (promiseValue: T) => any, errorCallback?: (reason: any) => any): IPromise<any>;
|
||||
>then : Symbol(then, Decl(bestCommonTypeReturnStatement.ts, 0, 23))
|
||||
>successCallback : Symbol(successCallback, Decl(bestCommonTypeReturnStatement.ts, 1, 9))
|
||||
>promiseValue : Symbol(promiseValue, Decl(bestCommonTypeReturnStatement.ts, 1, 27))
|
||||
>T : Symbol(T, Decl(bestCommonTypeReturnStatement.ts, 0, 19))
|
||||
>errorCallback : Symbol(errorCallback, Decl(bestCommonTypeReturnStatement.ts, 1, 51))
|
||||
>reason : Symbol(reason, Decl(bestCommonTypeReturnStatement.ts, 1, 69))
|
||||
>IPromise : Symbol(IPromise, Decl(bestCommonTypeReturnStatement.ts, 0, 0))
|
||||
}
|
||||
|
||||
function f() {
|
||||
>f : Symbol(f, Decl(bestCommonTypeReturnStatement.ts, 2, 1))
|
||||
|
||||
if (true) return b();
|
||||
>b : Symbol(b, Decl(bestCommonTypeReturnStatement.ts, 7, 1))
|
||||
|
||||
return d();
|
||||
>d : Symbol(d, Decl(bestCommonTypeReturnStatement.ts, 10, 45))
|
||||
}
|
||||
|
||||
|
||||
function b(): IPromise<void> { return null; }
|
||||
>b : Symbol(b, Decl(bestCommonTypeReturnStatement.ts, 7, 1))
|
||||
>IPromise : Symbol(IPromise, Decl(bestCommonTypeReturnStatement.ts, 0, 0))
|
||||
|
||||
function d(): IPromise<any> { return null; }
|
||||
>d : Symbol(d, Decl(bestCommonTypeReturnStatement.ts, 10, 45))
|
||||
>IPromise : Symbol(IPromise, Decl(bestCommonTypeReturnStatement.ts, 0, 0))
|
||||
|
||||
@ -1,39 +0,0 @@
|
||||
=== tests/cases/compiler/bestCommonTypeReturnStatement.ts ===
|
||||
interface IPromise<T> {
|
||||
>IPromise : IPromise<T>
|
||||
>T : T
|
||||
|
||||
then(successCallback: (promiseValue: T) => any, errorCallback?: (reason: any) => any): IPromise<any>;
|
||||
>then : (successCallback: (promiseValue: T) => any, errorCallback?: (reason: any) => any) => IPromise<any>
|
||||
>successCallback : (promiseValue: T) => any
|
||||
>promiseValue : T
|
||||
>T : T
|
||||
>errorCallback : (reason: any) => any
|
||||
>reason : any
|
||||
>IPromise : IPromise<T>
|
||||
}
|
||||
|
||||
function f() {
|
||||
>f : () => IPromise<void>
|
||||
|
||||
if (true) return b();
|
||||
>true : boolean
|
||||
>b() : IPromise<void>
|
||||
>b : () => IPromise<void>
|
||||
|
||||
return d();
|
||||
>d() : IPromise<any>
|
||||
>d : () => IPromise<any>
|
||||
}
|
||||
|
||||
|
||||
function b(): IPromise<void> { return null; }
|
||||
>b : () => IPromise<void>
|
||||
>IPromise : IPromise<T>
|
||||
>null : null
|
||||
|
||||
function d(): IPromise<any> { return null; }
|
||||
>d : () => IPromise<any>
|
||||
>IPromise : IPromise<T>
|
||||
>null : null
|
||||
|
||||
11
tests/baselines/reference/breakTarget3.errors.txt
Normal file
11
tests/baselines/reference/breakTarget3.errors.txt
Normal file
@ -0,0 +1,11 @@
|
||||
tests/cases/compiler/breakTarget3.ts(2,1): error TS7028: Unused label.
|
||||
|
||||
|
||||
==== tests/cases/compiler/breakTarget3.ts (1 errors) ====
|
||||
target1:
|
||||
target2:
|
||||
~~~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
while (true) {
|
||||
break target1;
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
=== tests/cases/compiler/breakTarget3.ts ===
|
||||
target1:
|
||||
No type information for this code.target2:
|
||||
No type information for this code.while (true) {
|
||||
No type information for this code. break target1;
|
||||
No type information for this code.}
|
||||
No type information for this code.
|
||||
@ -1,13 +0,0 @@
|
||||
=== tests/cases/compiler/breakTarget3.ts ===
|
||||
target1:
|
||||
>target1 : any
|
||||
|
||||
target2:
|
||||
>target2 : any
|
||||
|
||||
while (true) {
|
||||
>true : boolean
|
||||
|
||||
break target1;
|
||||
>target1 : any
|
||||
}
|
||||
11
tests/baselines/reference/breakTarget4.errors.txt
Normal file
11
tests/baselines/reference/breakTarget4.errors.txt
Normal file
@ -0,0 +1,11 @@
|
||||
tests/cases/compiler/breakTarget4.ts(1,1): error TS7028: Unused label.
|
||||
|
||||
|
||||
==== tests/cases/compiler/breakTarget4.ts (1 errors) ====
|
||||
target1:
|
||||
~~~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
target2:
|
||||
while (true) {
|
||||
break target2;
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
=== tests/cases/compiler/breakTarget4.ts ===
|
||||
target1:
|
||||
No type information for this code.target2:
|
||||
No type information for this code.while (true) {
|
||||
No type information for this code. break target2;
|
||||
No type information for this code.}
|
||||
No type information for this code.
|
||||
@ -1,13 +0,0 @@
|
||||
=== tests/cases/compiler/breakTarget4.ts ===
|
||||
target1:
|
||||
>target1 : any
|
||||
|
||||
target2:
|
||||
>target2 : any
|
||||
|
||||
while (true) {
|
||||
>true : boolean
|
||||
|
||||
break target2;
|
||||
>target2 : any
|
||||
}
|
||||
@ -1,8 +1,11 @@
|
||||
tests/cases/compiler/breakTarget5.ts(1,1): error TS7028: Unused label.
|
||||
tests/cases/compiler/breakTarget5.ts(5,7): error TS1107: Jump target cannot cross function boundary.
|
||||
|
||||
|
||||
==== tests/cases/compiler/breakTarget5.ts (1 errors) ====
|
||||
==== tests/cases/compiler/breakTarget5.ts (2 errors) ====
|
||||
target:
|
||||
~~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
while (true) {
|
||||
function f() {
|
||||
while (true) {
|
||||
|
||||
@ -0,0 +1,126 @@
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference.ts(28,9): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference.ts (1 errors) ====
|
||||
// Call signatures without a return type should infer one from the function body (if present)
|
||||
|
||||
// Simple types
|
||||
function foo(x) {
|
||||
return 1;
|
||||
}
|
||||
var r = foo(1);
|
||||
|
||||
function foo2(x) {
|
||||
return foo(x);
|
||||
}
|
||||
var r2 = foo2(1);
|
||||
|
||||
function foo3() {
|
||||
return foo3();
|
||||
}
|
||||
var r3 = foo3();
|
||||
|
||||
function foo4<T>(x: T) {
|
||||
return x;
|
||||
}
|
||||
var r4 = foo4(1);
|
||||
|
||||
function foo5(x) {
|
||||
if (true) {
|
||||
return 1;
|
||||
} else {
|
||||
return 2;
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
}
|
||||
var r5 = foo5(1);
|
||||
|
||||
function foo6(x) {
|
||||
try {
|
||||
}
|
||||
catch (e) {
|
||||
return [];
|
||||
}
|
||||
finally {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
var r6 = foo6(1);
|
||||
|
||||
function foo7(x) {
|
||||
return typeof x;
|
||||
}
|
||||
var r7 = foo7(1);
|
||||
|
||||
// object types
|
||||
function foo8(x: number) {
|
||||
return { x: x };
|
||||
}
|
||||
var r8 = foo8(1);
|
||||
|
||||
interface I {
|
||||
foo: string;
|
||||
}
|
||||
function foo9(x: number) {
|
||||
var i: I;
|
||||
return i;
|
||||
}
|
||||
var r9 = foo9(1);
|
||||
|
||||
class C {
|
||||
foo: string;
|
||||
}
|
||||
function foo10(x: number) {
|
||||
var c: C;
|
||||
return c;
|
||||
}
|
||||
var r10 = foo10(1);
|
||||
|
||||
module M {
|
||||
export var x = 1;
|
||||
export class C { foo: string }
|
||||
}
|
||||
function foo11() {
|
||||
return M;
|
||||
}
|
||||
var r11 = foo11();
|
||||
|
||||
// merged declarations
|
||||
interface I2 {
|
||||
x: number;
|
||||
}
|
||||
interface I2 {
|
||||
y: number;
|
||||
}
|
||||
function foo12() {
|
||||
var i2: I2;
|
||||
return i2;
|
||||
}
|
||||
var r12 = foo12();
|
||||
|
||||
function m1() { return 1; }
|
||||
module m1 { export var y = 2; }
|
||||
function foo13() {
|
||||
return m1;
|
||||
}
|
||||
var r13 = foo13();
|
||||
|
||||
class c1 {
|
||||
foo: string;
|
||||
constructor(x) { }
|
||||
}
|
||||
module c1 {
|
||||
export var x = 1;
|
||||
}
|
||||
function foo14() {
|
||||
return c1;
|
||||
}
|
||||
var r14 = foo14();
|
||||
|
||||
enum e1 { A }
|
||||
module e1 { export var y = 1; }
|
||||
function foo15() {
|
||||
return e1;
|
||||
}
|
||||
var r15 = foo15();
|
||||
@ -1,255 +0,0 @@
|
||||
=== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference.ts ===
|
||||
// Call signatures without a return type should infer one from the function body (if present)
|
||||
|
||||
// Simple types
|
||||
function foo(x) {
|
||||
>foo : Symbol(foo, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 0, 0))
|
||||
>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 3, 13))
|
||||
|
||||
return 1;
|
||||
}
|
||||
var r = foo(1);
|
||||
>r : Symbol(r, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 6, 3))
|
||||
>foo : Symbol(foo, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 0, 0))
|
||||
|
||||
function foo2(x) {
|
||||
>foo2 : Symbol(foo2, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 6, 15))
|
||||
>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 8, 14))
|
||||
|
||||
return foo(x);
|
||||
>foo : Symbol(foo, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 0, 0))
|
||||
>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 8, 14))
|
||||
}
|
||||
var r2 = foo2(1);
|
||||
>r2 : Symbol(r2, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 11, 3))
|
||||
>foo2 : Symbol(foo2, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 6, 15))
|
||||
|
||||
function foo3() {
|
||||
>foo3 : Symbol(foo3, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 11, 17))
|
||||
|
||||
return foo3();
|
||||
>foo3 : Symbol(foo3, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 11, 17))
|
||||
}
|
||||
var r3 = foo3();
|
||||
>r3 : Symbol(r3, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 16, 3))
|
||||
>foo3 : Symbol(foo3, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 11, 17))
|
||||
|
||||
function foo4<T>(x: T) {
|
||||
>foo4 : Symbol(foo4, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 16, 16))
|
||||
>T : Symbol(T, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 18, 14))
|
||||
>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 18, 17))
|
||||
>T : Symbol(T, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 18, 14))
|
||||
|
||||
return x;
|
||||
>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 18, 17))
|
||||
}
|
||||
var r4 = foo4(1);
|
||||
>r4 : Symbol(r4, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 21, 3))
|
||||
>foo4 : Symbol(foo4, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 16, 16))
|
||||
|
||||
function foo5(x) {
|
||||
>foo5 : Symbol(foo5, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 21, 17))
|
||||
>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 23, 14))
|
||||
|
||||
if (true) {
|
||||
return 1;
|
||||
} else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
var r5 = foo5(1);
|
||||
>r5 : Symbol(r5, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 30, 3))
|
||||
>foo5 : Symbol(foo5, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 21, 17))
|
||||
|
||||
function foo6(x) {
|
||||
>foo6 : Symbol(foo6, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 30, 17))
|
||||
>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 32, 14))
|
||||
|
||||
try {
|
||||
}
|
||||
catch (e) {
|
||||
>e : Symbol(e, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 35, 11))
|
||||
|
||||
return [];
|
||||
}
|
||||
finally {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
var r6 = foo6(1);
|
||||
>r6 : Symbol(r6, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 42, 3))
|
||||
>foo6 : Symbol(foo6, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 30, 17))
|
||||
|
||||
function foo7(x) {
|
||||
>foo7 : Symbol(foo7, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 42, 17))
|
||||
>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 44, 14))
|
||||
|
||||
return typeof x;
|
||||
>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 44, 14))
|
||||
}
|
||||
var r7 = foo7(1);
|
||||
>r7 : Symbol(r7, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 47, 3))
|
||||
>foo7 : Symbol(foo7, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 42, 17))
|
||||
|
||||
// object types
|
||||
function foo8(x: number) {
|
||||
>foo8 : Symbol(foo8, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 47, 17))
|
||||
>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 50, 14))
|
||||
|
||||
return { x: x };
|
||||
>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 51, 12))
|
||||
>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 50, 14))
|
||||
}
|
||||
var r8 = foo8(1);
|
||||
>r8 : Symbol(r8, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 53, 3))
|
||||
>foo8 : Symbol(foo8, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 47, 17))
|
||||
|
||||
interface I {
|
||||
>I : Symbol(I, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 53, 17))
|
||||
|
||||
foo: string;
|
||||
>foo : Symbol(foo, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 55, 13))
|
||||
}
|
||||
function foo9(x: number) {
|
||||
>foo9 : Symbol(foo9, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 57, 1))
|
||||
>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 58, 14))
|
||||
|
||||
var i: I;
|
||||
>i : Symbol(i, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 59, 7))
|
||||
>I : Symbol(I, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 53, 17))
|
||||
|
||||
return i;
|
||||
>i : Symbol(i, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 59, 7))
|
||||
}
|
||||
var r9 = foo9(1);
|
||||
>r9 : Symbol(r9, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 62, 3))
|
||||
>foo9 : Symbol(foo9, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 57, 1))
|
||||
|
||||
class C {
|
||||
>C : Symbol(C, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 62, 17))
|
||||
|
||||
foo: string;
|
||||
>foo : Symbol(foo, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 64, 9))
|
||||
}
|
||||
function foo10(x: number) {
|
||||
>foo10 : Symbol(foo10, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 66, 1))
|
||||
>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 67, 15))
|
||||
|
||||
var c: C;
|
||||
>c : Symbol(c, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 68, 7))
|
||||
>C : Symbol(C, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 62, 17))
|
||||
|
||||
return c;
|
||||
>c : Symbol(c, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 68, 7))
|
||||
}
|
||||
var r10 = foo10(1);
|
||||
>r10 : Symbol(r10, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 71, 3))
|
||||
>foo10 : Symbol(foo10, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 66, 1))
|
||||
|
||||
module M {
|
||||
>M : Symbol(M, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 71, 19))
|
||||
|
||||
export var x = 1;
|
||||
>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 74, 14))
|
||||
|
||||
export class C { foo: string }
|
||||
>C : Symbol(C, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 74, 21))
|
||||
>foo : Symbol(foo, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 75, 20))
|
||||
}
|
||||
function foo11() {
|
||||
>foo11 : Symbol(foo11, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 76, 1))
|
||||
|
||||
return M;
|
||||
>M : Symbol(M, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 71, 19))
|
||||
}
|
||||
var r11 = foo11();
|
||||
>r11 : Symbol(r11, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 80, 3))
|
||||
>foo11 : Symbol(foo11, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 76, 1))
|
||||
|
||||
// merged declarations
|
||||
interface I2 {
|
||||
>I2 : Symbol(I2, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 80, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 85, 1))
|
||||
|
||||
x: number;
|
||||
>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 83, 14))
|
||||
}
|
||||
interface I2 {
|
||||
>I2 : Symbol(I2, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 80, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 85, 1))
|
||||
|
||||
y: number;
|
||||
>y : Symbol(y, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 86, 14))
|
||||
}
|
||||
function foo12() {
|
||||
>foo12 : Symbol(foo12, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 88, 1))
|
||||
|
||||
var i2: I2;
|
||||
>i2 : Symbol(i2, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 90, 7))
|
||||
>I2 : Symbol(I2, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 80, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 85, 1))
|
||||
|
||||
return i2;
|
||||
>i2 : Symbol(i2, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 90, 7))
|
||||
}
|
||||
var r12 = foo12();
|
||||
>r12 : Symbol(r12, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 93, 3))
|
||||
>foo12 : Symbol(foo12, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 88, 1))
|
||||
|
||||
function m1() { return 1; }
|
||||
>m1 : Symbol(m1, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 93, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 95, 27))
|
||||
|
||||
module m1 { export var y = 2; }
|
||||
>m1 : Symbol(m1, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 93, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 95, 27))
|
||||
>y : Symbol(y, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 96, 22))
|
||||
|
||||
function foo13() {
|
||||
>foo13 : Symbol(foo13, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 96, 31))
|
||||
|
||||
return m1;
|
||||
>m1 : Symbol(m1, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 93, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 95, 27))
|
||||
}
|
||||
var r13 = foo13();
|
||||
>r13 : Symbol(r13, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 100, 3))
|
||||
>foo13 : Symbol(foo13, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 96, 31))
|
||||
|
||||
class c1 {
|
||||
>c1 : Symbol(c1, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 100, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 105, 1))
|
||||
|
||||
foo: string;
|
||||
>foo : Symbol(foo, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 102, 10))
|
||||
|
||||
constructor(x) { }
|
||||
>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 104, 16))
|
||||
}
|
||||
module c1 {
|
||||
>c1 : Symbol(c1, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 100, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 105, 1))
|
||||
|
||||
export var x = 1;
|
||||
>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 107, 14))
|
||||
}
|
||||
function foo14() {
|
||||
>foo14 : Symbol(foo14, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 108, 1))
|
||||
|
||||
return c1;
|
||||
>c1 : Symbol(c1, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 100, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 105, 1))
|
||||
}
|
||||
var r14 = foo14();
|
||||
>r14 : Symbol(r14, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 112, 3))
|
||||
>foo14 : Symbol(foo14, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 108, 1))
|
||||
|
||||
enum e1 { A }
|
||||
>e1 : Symbol(e1, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 112, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 114, 13))
|
||||
>A : Symbol(e1.A, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 114, 9))
|
||||
|
||||
module e1 { export var y = 1; }
|
||||
>e1 : Symbol(e1, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 112, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 114, 13))
|
||||
>y : Symbol(y, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 115, 22))
|
||||
|
||||
function foo15() {
|
||||
>foo15 : Symbol(foo15, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 115, 31))
|
||||
|
||||
return e1;
|
||||
>e1 : Symbol(e1, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 112, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 114, 13))
|
||||
}
|
||||
var r15 = foo15();
|
||||
>r15 : Symbol(r15, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 119, 3))
|
||||
>foo15 : Symbol(foo15, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 115, 31))
|
||||
|
||||
@ -1,296 +0,0 @@
|
||||
=== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference.ts ===
|
||||
// Call signatures without a return type should infer one from the function body (if present)
|
||||
|
||||
// Simple types
|
||||
function foo(x) {
|
||||
>foo : (x: any) => number
|
||||
>x : any
|
||||
|
||||
return 1;
|
||||
>1 : number
|
||||
}
|
||||
var r = foo(1);
|
||||
>r : number
|
||||
>foo(1) : number
|
||||
>foo : (x: any) => number
|
||||
>1 : number
|
||||
|
||||
function foo2(x) {
|
||||
>foo2 : (x: any) => number
|
||||
>x : any
|
||||
|
||||
return foo(x);
|
||||
>foo(x) : number
|
||||
>foo : (x: any) => number
|
||||
>x : any
|
||||
}
|
||||
var r2 = foo2(1);
|
||||
>r2 : number
|
||||
>foo2(1) : number
|
||||
>foo2 : (x: any) => number
|
||||
>1 : number
|
||||
|
||||
function foo3() {
|
||||
>foo3 : () => any
|
||||
|
||||
return foo3();
|
||||
>foo3() : any
|
||||
>foo3 : () => any
|
||||
}
|
||||
var r3 = foo3();
|
||||
>r3 : any
|
||||
>foo3() : any
|
||||
>foo3 : () => any
|
||||
|
||||
function foo4<T>(x: T) {
|
||||
>foo4 : <T>(x: T) => T
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
|
||||
return x;
|
||||
>x : T
|
||||
}
|
||||
var r4 = foo4(1);
|
||||
>r4 : number
|
||||
>foo4(1) : number
|
||||
>foo4 : <T>(x: T) => T
|
||||
>1 : number
|
||||
|
||||
function foo5(x) {
|
||||
>foo5 : (x: any) => number
|
||||
>x : any
|
||||
|
||||
if (true) {
|
||||
>true : boolean
|
||||
|
||||
return 1;
|
||||
>1 : number
|
||||
|
||||
} else {
|
||||
return 2;
|
||||
>2 : number
|
||||
}
|
||||
}
|
||||
var r5 = foo5(1);
|
||||
>r5 : number
|
||||
>foo5(1) : number
|
||||
>foo5 : (x: any) => number
|
||||
>1 : number
|
||||
|
||||
function foo6(x) {
|
||||
>foo6 : (x: any) => any[]
|
||||
>x : any
|
||||
|
||||
try {
|
||||
}
|
||||
catch (e) {
|
||||
>e : any
|
||||
|
||||
return [];
|
||||
>[] : undefined[]
|
||||
}
|
||||
finally {
|
||||
return [];
|
||||
>[] : undefined[]
|
||||
}
|
||||
}
|
||||
var r6 = foo6(1);
|
||||
>r6 : any[]
|
||||
>foo6(1) : any[]
|
||||
>foo6 : (x: any) => any[]
|
||||
>1 : number
|
||||
|
||||
function foo7(x) {
|
||||
>foo7 : (x: any) => string
|
||||
>x : any
|
||||
|
||||
return typeof x;
|
||||
>typeof x : string
|
||||
>x : any
|
||||
}
|
||||
var r7 = foo7(1);
|
||||
>r7 : string
|
||||
>foo7(1) : string
|
||||
>foo7 : (x: any) => string
|
||||
>1 : number
|
||||
|
||||
// object types
|
||||
function foo8(x: number) {
|
||||
>foo8 : (x: number) => { x: number; }
|
||||
>x : number
|
||||
|
||||
return { x: x };
|
||||
>{ x: x } : { x: number; }
|
||||
>x : number
|
||||
>x : number
|
||||
}
|
||||
var r8 = foo8(1);
|
||||
>r8 : { x: number; }
|
||||
>foo8(1) : { x: number; }
|
||||
>foo8 : (x: number) => { x: number; }
|
||||
>1 : number
|
||||
|
||||
interface I {
|
||||
>I : I
|
||||
|
||||
foo: string;
|
||||
>foo : string
|
||||
}
|
||||
function foo9(x: number) {
|
||||
>foo9 : (x: number) => I
|
||||
>x : number
|
||||
|
||||
var i: I;
|
||||
>i : I
|
||||
>I : I
|
||||
|
||||
return i;
|
||||
>i : I
|
||||
}
|
||||
var r9 = foo9(1);
|
||||
>r9 : I
|
||||
>foo9(1) : I
|
||||
>foo9 : (x: number) => I
|
||||
>1 : number
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
foo: string;
|
||||
>foo : string
|
||||
}
|
||||
function foo10(x: number) {
|
||||
>foo10 : (x: number) => C
|
||||
>x : number
|
||||
|
||||
var c: C;
|
||||
>c : C
|
||||
>C : C
|
||||
|
||||
return c;
|
||||
>c : C
|
||||
}
|
||||
var r10 = foo10(1);
|
||||
>r10 : C
|
||||
>foo10(1) : C
|
||||
>foo10 : (x: number) => C
|
||||
>1 : number
|
||||
|
||||
module M {
|
||||
>M : typeof M
|
||||
|
||||
export var x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
|
||||
export class C { foo: string }
|
||||
>C : C
|
||||
>foo : string
|
||||
}
|
||||
function foo11() {
|
||||
>foo11 : () => typeof M
|
||||
|
||||
return M;
|
||||
>M : typeof M
|
||||
}
|
||||
var r11 = foo11();
|
||||
>r11 : typeof M
|
||||
>foo11() : typeof M
|
||||
>foo11 : () => typeof M
|
||||
|
||||
// merged declarations
|
||||
interface I2 {
|
||||
>I2 : I2
|
||||
|
||||
x: number;
|
||||
>x : number
|
||||
}
|
||||
interface I2 {
|
||||
>I2 : I2
|
||||
|
||||
y: number;
|
||||
>y : number
|
||||
}
|
||||
function foo12() {
|
||||
>foo12 : () => I2
|
||||
|
||||
var i2: I2;
|
||||
>i2 : I2
|
||||
>I2 : I2
|
||||
|
||||
return i2;
|
||||
>i2 : I2
|
||||
}
|
||||
var r12 = foo12();
|
||||
>r12 : I2
|
||||
>foo12() : I2
|
||||
>foo12 : () => I2
|
||||
|
||||
function m1() { return 1; }
|
||||
>m1 : typeof m1
|
||||
>1 : number
|
||||
|
||||
module m1 { export var y = 2; }
|
||||
>m1 : typeof m1
|
||||
>y : number
|
||||
>2 : number
|
||||
|
||||
function foo13() {
|
||||
>foo13 : () => typeof m1
|
||||
|
||||
return m1;
|
||||
>m1 : typeof m1
|
||||
}
|
||||
var r13 = foo13();
|
||||
>r13 : typeof m1
|
||||
>foo13() : typeof m1
|
||||
>foo13 : () => typeof m1
|
||||
|
||||
class c1 {
|
||||
>c1 : c1
|
||||
|
||||
foo: string;
|
||||
>foo : string
|
||||
|
||||
constructor(x) { }
|
||||
>x : any
|
||||
}
|
||||
module c1 {
|
||||
>c1 : typeof c1
|
||||
|
||||
export var x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
}
|
||||
function foo14() {
|
||||
>foo14 : () => typeof c1
|
||||
|
||||
return c1;
|
||||
>c1 : typeof c1
|
||||
}
|
||||
var r14 = foo14();
|
||||
>r14 : typeof c1
|
||||
>foo14() : typeof c1
|
||||
>foo14 : () => typeof c1
|
||||
|
||||
enum e1 { A }
|
||||
>e1 : e1
|
||||
>A : e1
|
||||
|
||||
module e1 { export var y = 1; }
|
||||
>e1 : typeof e1
|
||||
>y : number
|
||||
>1 : number
|
||||
|
||||
function foo15() {
|
||||
>foo15 : () => typeof e1
|
||||
|
||||
return e1;
|
||||
>e1 : typeof e1
|
||||
}
|
||||
var r15 = foo15();
|
||||
>r15 : typeof e1
|
||||
>foo15() : typeof e1
|
||||
>foo15 : () => typeof e1
|
||||
|
||||
72
tests/baselines/reference/cf.errors.txt
Normal file
72
tests/baselines/reference/cf.errors.txt
Normal file
@ -0,0 +1,72 @@
|
||||
tests/cases/compiler/cf.ts(9,13): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/cf.ts(21,17): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/cf.ts(32,13): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/cf.ts(36,13): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/cf.ts (4 errors) ====
|
||||
function f() {
|
||||
var z;
|
||||
var x=10;
|
||||
var y=3;
|
||||
|
||||
L1: for (var i=0;i<19;i++) {
|
||||
if (y==7) {
|
||||
continue L1;
|
||||
x=11;
|
||||
~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
if (y==3) {
|
||||
y++;
|
||||
}
|
||||
else {
|
||||
y--;
|
||||
}
|
||||
do {
|
||||
y+=2;
|
||||
if (y==20) {
|
||||
break;
|
||||
x=12;
|
||||
~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
} while (y<41);
|
||||
y++;
|
||||
}
|
||||
while (y>2) {
|
||||
y=y>>1;
|
||||
}
|
||||
L2: try {
|
||||
L3: if (x<y) {
|
||||
break L2;
|
||||
x=13;
|
||||
~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
else {
|
||||
break L3;
|
||||
x=14;
|
||||
~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
x++;
|
||||
}
|
||||
finally {
|
||||
x+=3;
|
||||
}
|
||||
y++;
|
||||
for (var k=0;k<10;k++) {
|
||||
z;
|
||||
break;
|
||||
}
|
||||
for (k=0;k<10;k++) {
|
||||
if (k==6) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,111 +0,0 @@
|
||||
=== tests/cases/compiler/cf.ts ===
|
||||
function f() {
|
||||
>f : Symbol(f, Decl(cf.ts, 0, 0))
|
||||
|
||||
var z;
|
||||
>z : Symbol(z, Decl(cf.ts, 1, 7))
|
||||
|
||||
var x=10;
|
||||
>x : Symbol(x, Decl(cf.ts, 2, 7))
|
||||
|
||||
var y=3;
|
||||
>y : Symbol(y, Decl(cf.ts, 3, 7))
|
||||
|
||||
L1: for (var i=0;i<19;i++) {
|
||||
>i : Symbol(i, Decl(cf.ts, 5, 16))
|
||||
>i : Symbol(i, Decl(cf.ts, 5, 16))
|
||||
>i : Symbol(i, Decl(cf.ts, 5, 16))
|
||||
|
||||
if (y==7) {
|
||||
>y : Symbol(y, Decl(cf.ts, 3, 7))
|
||||
|
||||
continue L1;
|
||||
x=11;
|
||||
>x : Symbol(x, Decl(cf.ts, 2, 7))
|
||||
}
|
||||
if (y==3) {
|
||||
>y : Symbol(y, Decl(cf.ts, 3, 7))
|
||||
|
||||
y++;
|
||||
>y : Symbol(y, Decl(cf.ts, 3, 7))
|
||||
}
|
||||
else {
|
||||
y--;
|
||||
>y : Symbol(y, Decl(cf.ts, 3, 7))
|
||||
}
|
||||
do {
|
||||
y+=2;
|
||||
>y : Symbol(y, Decl(cf.ts, 3, 7))
|
||||
|
||||
if (y==20) {
|
||||
>y : Symbol(y, Decl(cf.ts, 3, 7))
|
||||
|
||||
break;
|
||||
x=12;
|
||||
>x : Symbol(x, Decl(cf.ts, 2, 7))
|
||||
}
|
||||
} while (y<41);
|
||||
>y : Symbol(y, Decl(cf.ts, 3, 7))
|
||||
|
||||
y++;
|
||||
>y : Symbol(y, Decl(cf.ts, 3, 7))
|
||||
}
|
||||
while (y>2) {
|
||||
>y : Symbol(y, Decl(cf.ts, 3, 7))
|
||||
|
||||
y=y>>1;
|
||||
>y : Symbol(y, Decl(cf.ts, 3, 7))
|
||||
>y : Symbol(y, Decl(cf.ts, 3, 7))
|
||||
}
|
||||
L2: try {
|
||||
L3: if (x<y) {
|
||||
>x : Symbol(x, Decl(cf.ts, 2, 7))
|
||||
>y : Symbol(y, Decl(cf.ts, 3, 7))
|
||||
|
||||
break L2;
|
||||
x=13;
|
||||
>x : Symbol(x, Decl(cf.ts, 2, 7))
|
||||
}
|
||||
else {
|
||||
break L3;
|
||||
x=14;
|
||||
>x : Symbol(x, Decl(cf.ts, 2, 7))
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
>e : Symbol(e, Decl(cf.ts, 38, 11))
|
||||
|
||||
x++;
|
||||
>x : Symbol(x, Decl(cf.ts, 2, 7))
|
||||
}
|
||||
finally {
|
||||
x+=3;
|
||||
>x : Symbol(x, Decl(cf.ts, 2, 7))
|
||||
}
|
||||
y++;
|
||||
>y : Symbol(y, Decl(cf.ts, 3, 7))
|
||||
|
||||
for (var k=0;k<10;k++) {
|
||||
>k : Symbol(k, Decl(cf.ts, 45, 12))
|
||||
>k : Symbol(k, Decl(cf.ts, 45, 12))
|
||||
>k : Symbol(k, Decl(cf.ts, 45, 12))
|
||||
|
||||
z;
|
||||
>z : Symbol(z, Decl(cf.ts, 1, 7))
|
||||
|
||||
break;
|
||||
}
|
||||
for (k=0;k<10;k++) {
|
||||
>k : Symbol(k, Decl(cf.ts, 45, 12))
|
||||
>k : Symbol(k, Decl(cf.ts, 45, 12))
|
||||
>k : Symbol(k, Decl(cf.ts, 45, 12))
|
||||
|
||||
if (k==6) {
|
||||
>k : Symbol(k, Decl(cf.ts, 45, 12))
|
||||
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,169 +0,0 @@
|
||||
=== tests/cases/compiler/cf.ts ===
|
||||
function f() {
|
||||
>f : () => void
|
||||
|
||||
var z;
|
||||
>z : any
|
||||
|
||||
var x=10;
|
||||
>x : number
|
||||
>10 : number
|
||||
|
||||
var y=3;
|
||||
>y : number
|
||||
>3 : number
|
||||
|
||||
L1: for (var i=0;i<19;i++) {
|
||||
>L1 : any
|
||||
>i : number
|
||||
>0 : number
|
||||
>i<19 : boolean
|
||||
>i : number
|
||||
>19 : number
|
||||
>i++ : number
|
||||
>i : number
|
||||
|
||||
if (y==7) {
|
||||
>y==7 : boolean
|
||||
>y : number
|
||||
>7 : number
|
||||
|
||||
continue L1;
|
||||
>L1 : any
|
||||
|
||||
x=11;
|
||||
>x=11 : number
|
||||
>x : number
|
||||
>11 : number
|
||||
}
|
||||
if (y==3) {
|
||||
>y==3 : boolean
|
||||
>y : number
|
||||
>3 : number
|
||||
|
||||
y++;
|
||||
>y++ : number
|
||||
>y : number
|
||||
}
|
||||
else {
|
||||
y--;
|
||||
>y-- : number
|
||||
>y : number
|
||||
}
|
||||
do {
|
||||
y+=2;
|
||||
>y+=2 : number
|
||||
>y : number
|
||||
>2 : number
|
||||
|
||||
if (y==20) {
|
||||
>y==20 : boolean
|
||||
>y : number
|
||||
>20 : number
|
||||
|
||||
break;
|
||||
x=12;
|
||||
>x=12 : number
|
||||
>x : number
|
||||
>12 : number
|
||||
}
|
||||
} while (y<41);
|
||||
>y<41 : boolean
|
||||
>y : number
|
||||
>41 : number
|
||||
|
||||
y++;
|
||||
>y++ : number
|
||||
>y : number
|
||||
}
|
||||
while (y>2) {
|
||||
>y>2 : boolean
|
||||
>y : number
|
||||
>2 : number
|
||||
|
||||
y=y>>1;
|
||||
>y=y>>1 : number
|
||||
>y : number
|
||||
>y>>1 : number
|
||||
>y : number
|
||||
>1 : number
|
||||
}
|
||||
L2: try {
|
||||
>L2 : any
|
||||
|
||||
L3: if (x<y) {
|
||||
>L3 : any
|
||||
>x<y : boolean
|
||||
>x : number
|
||||
>y : number
|
||||
|
||||
break L2;
|
||||
>L2 : any
|
||||
|
||||
x=13;
|
||||
>x=13 : number
|
||||
>x : number
|
||||
>13 : number
|
||||
}
|
||||
else {
|
||||
break L3;
|
||||
>L3 : any
|
||||
|
||||
x=14;
|
||||
>x=14 : number
|
||||
>x : number
|
||||
>14 : number
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
>e : any
|
||||
|
||||
x++;
|
||||
>x++ : number
|
||||
>x : number
|
||||
}
|
||||
finally {
|
||||
x+=3;
|
||||
>x+=3 : number
|
||||
>x : number
|
||||
>3 : number
|
||||
}
|
||||
y++;
|
||||
>y++ : number
|
||||
>y : number
|
||||
|
||||
for (var k=0;k<10;k++) {
|
||||
>k : number
|
||||
>0 : number
|
||||
>k<10 : boolean
|
||||
>k : number
|
||||
>10 : number
|
||||
>k++ : number
|
||||
>k : number
|
||||
|
||||
z;
|
||||
>z : any
|
||||
|
||||
break;
|
||||
}
|
||||
for (k=0;k<10;k++) {
|
||||
>k=0 : number
|
||||
>k : number
|
||||
>0 : number
|
||||
>k<10 : boolean
|
||||
>k : number
|
||||
>10 : number
|
||||
>k++ : number
|
||||
>k : number
|
||||
|
||||
if (k==6) {
|
||||
>k==6 : boolean
|
||||
>k : number
|
||||
>6 : number
|
||||
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
10
tests/baselines/reference/commentsAtEndOfFile1.errors.txt
Normal file
10
tests/baselines/reference/commentsAtEndOfFile1.errors.txt
Normal file
@ -0,0 +1,10 @@
|
||||
tests/cases/compiler/commentsAtEndOfFile1.ts(1,1): error TS7028: Unused label.
|
||||
|
||||
|
||||
==== tests/cases/compiler/commentsAtEndOfFile1.ts (1 errors) ====
|
||||
Input:
|
||||
~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
;
|
||||
//Testing two
|
||||
|
||||
@ -1,6 +0,0 @@
|
||||
=== tests/cases/compiler/commentsAtEndOfFile1.ts ===
|
||||
Input:
|
||||
No type information for this code.;
|
||||
No type information for this code.//Testing two
|
||||
No type information for this code.
|
||||
No type information for this code.
|
||||
@ -1,7 +0,0 @@
|
||||
=== tests/cases/compiler/commentsAtEndOfFile1.ts ===
|
||||
Input:
|
||||
>Input : any
|
||||
|
||||
;
|
||||
//Testing two
|
||||
|
||||
@ -28,6 +28,7 @@ tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsVa
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(53,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(54,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(55,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(58,3): error TS7028: Unused label.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(58,9): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(59,9): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(62,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
@ -74,7 +75,7 @@ tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsVa
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(122,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts (74 errors) ====
|
||||
==== tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts (75 errors) ====
|
||||
// expected error for all the LHS of compound assignments (arithmetic and addition)
|
||||
var value;
|
||||
|
||||
@ -193,6 +194,8 @@ tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsVa
|
||||
|
||||
// object literals
|
||||
{ a: 0} *= value;
|
||||
~
|
||||
!!! error TS7028: Unused label.
|
||||
~~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
{ a: 0} += value;
|
||||
|
||||
15
tests/baselines/reference/conditionalExpressions2.errors.txt
Normal file
15
tests/baselines/reference/conditionalExpressions2.errors.txt
Normal file
@ -0,0 +1,15 @@
|
||||
tests/cases/compiler/conditionalExpressions2.ts(9,54): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/conditionalExpressions2.ts (1 errors) ====
|
||||
var a = false ? 1 : null;
|
||||
var b = false ? undefined : 0;
|
||||
var c = false ? 1 : 0;
|
||||
var d = false ? false : true;
|
||||
var e = false ? "foo" : "bar";
|
||||
var f = false ? null : undefined;
|
||||
var g = true ? {g:5} : null;
|
||||
var h = [{h:5}, null];
|
||||
function i() { if (true) { return { x: 5 }; } else { return null; } }
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
@ -1,33 +0,0 @@
|
||||
=== tests/cases/compiler/conditionalExpressions2.ts ===
|
||||
var a = false ? 1 : null;
|
||||
>a : Symbol(a, Decl(conditionalExpressions2.ts, 0, 3))
|
||||
|
||||
var b = false ? undefined : 0;
|
||||
>b : Symbol(b, Decl(conditionalExpressions2.ts, 1, 3))
|
||||
>undefined : Symbol(undefined)
|
||||
|
||||
var c = false ? 1 : 0;
|
||||
>c : Symbol(c, Decl(conditionalExpressions2.ts, 2, 3))
|
||||
|
||||
var d = false ? false : true;
|
||||
>d : Symbol(d, Decl(conditionalExpressions2.ts, 3, 3))
|
||||
|
||||
var e = false ? "foo" : "bar";
|
||||
>e : Symbol(e, Decl(conditionalExpressions2.ts, 4, 3))
|
||||
|
||||
var f = false ? null : undefined;
|
||||
>f : Symbol(f, Decl(conditionalExpressions2.ts, 5, 3))
|
||||
>undefined : Symbol(undefined)
|
||||
|
||||
var g = true ? {g:5} : null;
|
||||
>g : Symbol(g, Decl(conditionalExpressions2.ts, 6, 3))
|
||||
>g : Symbol(g, Decl(conditionalExpressions2.ts, 6, 16))
|
||||
|
||||
var h = [{h:5}, null];
|
||||
>h : Symbol(h, Decl(conditionalExpressions2.ts, 7, 3))
|
||||
>h : Symbol(h, Decl(conditionalExpressions2.ts, 7, 10))
|
||||
|
||||
function i() { if (true) { return { x: 5 }; } else { return null; } }
|
||||
>i : Symbol(i, Decl(conditionalExpressions2.ts, 7, 22))
|
||||
>x : Symbol(x, Decl(conditionalExpressions2.ts, 8, 35))
|
||||
|
||||
@ -1,68 +0,0 @@
|
||||
=== tests/cases/compiler/conditionalExpressions2.ts ===
|
||||
var a = false ? 1 : null;
|
||||
>a : number
|
||||
>false ? 1 : null : number
|
||||
>false : boolean
|
||||
>1 : number
|
||||
>null : null
|
||||
|
||||
var b = false ? undefined : 0;
|
||||
>b : number
|
||||
>false ? undefined : 0 : number
|
||||
>false : boolean
|
||||
>undefined : undefined
|
||||
>0 : number
|
||||
|
||||
var c = false ? 1 : 0;
|
||||
>c : number
|
||||
>false ? 1 : 0 : number
|
||||
>false : boolean
|
||||
>1 : number
|
||||
>0 : number
|
||||
|
||||
var d = false ? false : true;
|
||||
>d : boolean
|
||||
>false ? false : true : boolean
|
||||
>false : boolean
|
||||
>false : boolean
|
||||
>true : boolean
|
||||
|
||||
var e = false ? "foo" : "bar";
|
||||
>e : string
|
||||
>false ? "foo" : "bar" : string
|
||||
>false : boolean
|
||||
>"foo" : string
|
||||
>"bar" : string
|
||||
|
||||
var f = false ? null : undefined;
|
||||
>f : any
|
||||
>false ? null : undefined : null
|
||||
>false : boolean
|
||||
>null : null
|
||||
>undefined : undefined
|
||||
|
||||
var g = true ? {g:5} : null;
|
||||
>g : { g: number; }
|
||||
>true ? {g:5} : null : { g: number; }
|
||||
>true : boolean
|
||||
>{g:5} : { g: number; }
|
||||
>g : number
|
||||
>5 : number
|
||||
>null : null
|
||||
|
||||
var h = [{h:5}, null];
|
||||
>h : { h: number; }[]
|
||||
>[{h:5}, null] : { h: number; }[]
|
||||
>{h:5} : { h: number; }
|
||||
>h : number
|
||||
>5 : number
|
||||
>null : null
|
||||
|
||||
function i() { if (true) { return { x: 5 }; } else { return null; } }
|
||||
>i : () => { x: number; }
|
||||
>true : boolean
|
||||
>{ x: 5 } : { x: number; }
|
||||
>x : number
|
||||
>5 : number
|
||||
>null : null
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
tests/cases/compiler/constDeclarations-invalidContexts.ts(4,5): error TS1156: 'const' declarations can only be declared inside a block.
|
||||
tests/cases/compiler/constDeclarations-invalidContexts.ts(6,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/constDeclarations-invalidContexts.ts(6,5): error TS1156: 'const' declarations can only be declared inside a block.
|
||||
tests/cases/compiler/constDeclarations-invalidContexts.ts(9,5): error TS1156: 'const' declarations can only be declared inside a block.
|
||||
tests/cases/compiler/constDeclarations-invalidContexts.ts(11,1): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/constDeclarations-invalidContexts.ts(12,5): error TS1156: 'const' declarations can only be declared inside a block.
|
||||
tests/cases/compiler/constDeclarations-invalidContexts.ts(16,7): error TS2410: All symbols within a 'with' block will be resolved to 'any'.
|
||||
tests/cases/compiler/constDeclarations-invalidContexts.ts(20,5): error TS1156: 'const' declarations can only be declared inside a block.
|
||||
@ -9,7 +11,7 @@ tests/cases/compiler/constDeclarations-invalidContexts.ts(26,12): error TS1156:
|
||||
tests/cases/compiler/constDeclarations-invalidContexts.ts(29,29): error TS1156: 'const' declarations can only be declared inside a block.
|
||||
|
||||
|
||||
==== tests/cases/compiler/constDeclarations-invalidContexts.ts (9 errors) ====
|
||||
==== tests/cases/compiler/constDeclarations-invalidContexts.ts (11 errors) ====
|
||||
|
||||
// Errors, const must be defined inside a block
|
||||
if (true)
|
||||
@ -18,6 +20,8 @@ tests/cases/compiler/constDeclarations-invalidContexts.ts(29,29): error TS1156:
|
||||
!!! error TS1156: 'const' declarations can only be declared inside a block.
|
||||
else
|
||||
const c2 = 0;
|
||||
~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1156: 'const' declarations can only be declared inside a block.
|
||||
|
||||
@ -27,6 +31,8 @@ tests/cases/compiler/constDeclarations-invalidContexts.ts(29,29): error TS1156:
|
||||
!!! error TS1156: 'const' declarations can only be declared inside a block.
|
||||
|
||||
do
|
||||
~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
const c4 = 0;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1156: 'const' declarations can only be declared inside a block.
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
tests/cases/compiler/constDeclarations-scopes.ts(13,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/constDeclarations-scopes.ts(22,1): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/constDeclarations-scopes.ts(28,7): error TS2410: All symbols within a 'with' block will be resolved to 'any'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/constDeclarations-scopes.ts (1 errors) ====
|
||||
==== tests/cases/compiler/constDeclarations-scopes.ts (3 errors) ====
|
||||
|
||||
// global
|
||||
const c = "string";
|
||||
@ -15,6 +17,8 @@ tests/cases/compiler/constDeclarations-scopes.ts(28,7): error TS2410: All symbol
|
||||
}
|
||||
else {
|
||||
const c = 0;
|
||||
~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
n = c;
|
||||
}
|
||||
|
||||
@ -24,6 +28,8 @@ tests/cases/compiler/constDeclarations-scopes.ts(28,7): error TS2410: All symbol
|
||||
}
|
||||
|
||||
do {
|
||||
~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
const c = 0;
|
||||
n = c;
|
||||
} while (true);
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
tests/cases/compiler/constDeclarations-validContexts.ts(8,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/constDeclarations-validContexts.ts(15,1): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/constDeclarations-validContexts.ts(20,7): error TS2410: All symbols within a 'with' block will be resolved to 'any'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/constDeclarations-validContexts.ts (1 errors) ====
|
||||
==== tests/cases/compiler/constDeclarations-validContexts.ts (3 errors) ====
|
||||
|
||||
|
||||
// Control flow statements with blocks
|
||||
@ -10,6 +12,8 @@ tests/cases/compiler/constDeclarations-validContexts.ts(20,7): error TS2410: All
|
||||
}
|
||||
else {
|
||||
const c2 = 0;
|
||||
~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
|
||||
while (true) {
|
||||
@ -17,6 +21,8 @@ tests/cases/compiler/constDeclarations-validContexts.ts(20,7): error TS2410: All
|
||||
}
|
||||
|
||||
do {
|
||||
~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
const c4 = 0;
|
||||
} while (true);
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(27,18): error TS
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(27,26): error TS2304: Cannot find name 'bfs'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(28,30): error TS1005: '=' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(31,18): error TS1109: Expression expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(31,18): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(34,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(34,26): error TS1005: ';' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(34,28): error TS2304: Cannot find name 'bfs'.
|
||||
@ -52,6 +53,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,28): error T
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,36): error TS1005: ';' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(238,9): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(238,16): error TS2304: Cannot find name 'method2'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(238,16): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(238,26): error TS1005: ';' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(241,5): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(246,25): error TS2339: Property 'method1' does not exist on type 'B'.
|
||||
@ -83,7 +85,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,55): error T
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts (83 errors) ====
|
||||
==== tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts (85 errors) ====
|
||||
declare module "fs" {
|
||||
export class File {
|
||||
constructor(filename: string);
|
||||
@ -140,6 +142,8 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS
|
||||
^
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
retValue = bfs.TYPES();
|
||||
@ -433,6 +437,8 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'method2'.
|
||||
~~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
return 2 * this.method1(2);
|
||||
|
||||
@ -1,8 +1,11 @@
|
||||
tests/cases/compiler/continueNotInIterationStatement4.ts(1,1): error TS7028: Unused label.
|
||||
tests/cases/compiler/continueNotInIterationStatement4.ts(4,5): error TS1107: Jump target cannot cross function boundary.
|
||||
|
||||
|
||||
==== tests/cases/compiler/continueNotInIterationStatement4.ts (1 errors) ====
|
||||
==== tests/cases/compiler/continueNotInIterationStatement4.ts (2 errors) ====
|
||||
TWO:
|
||||
~~~
|
||||
!!! error TS7028: Unused label.
|
||||
while (true){
|
||||
var x = () => {
|
||||
continue TWO;
|
||||
|
||||
11
tests/baselines/reference/continueTarget3.errors.txt
Normal file
11
tests/baselines/reference/continueTarget3.errors.txt
Normal file
@ -0,0 +1,11 @@
|
||||
tests/cases/compiler/continueTarget3.ts(2,1): error TS7028: Unused label.
|
||||
|
||||
|
||||
==== tests/cases/compiler/continueTarget3.ts (1 errors) ====
|
||||
target1:
|
||||
target2:
|
||||
~~~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
while (true) {
|
||||
continue target1;
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
=== tests/cases/compiler/continueTarget3.ts ===
|
||||
target1:
|
||||
No type information for this code.target2:
|
||||
No type information for this code.while (true) {
|
||||
No type information for this code. continue target1;
|
||||
No type information for this code.}
|
||||
No type information for this code.
|
||||
@ -1,13 +0,0 @@
|
||||
=== tests/cases/compiler/continueTarget3.ts ===
|
||||
target1:
|
||||
>target1 : any
|
||||
|
||||
target2:
|
||||
>target2 : any
|
||||
|
||||
while (true) {
|
||||
>true : boolean
|
||||
|
||||
continue target1;
|
||||
>target1 : any
|
||||
}
|
||||
11
tests/baselines/reference/continueTarget4.errors.txt
Normal file
11
tests/baselines/reference/continueTarget4.errors.txt
Normal file
@ -0,0 +1,11 @@
|
||||
tests/cases/compiler/continueTarget4.ts(1,1): error TS7028: Unused label.
|
||||
|
||||
|
||||
==== tests/cases/compiler/continueTarget4.ts (1 errors) ====
|
||||
target1:
|
||||
~~~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
target2:
|
||||
while (true) {
|
||||
continue target2;
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
=== tests/cases/compiler/continueTarget4.ts ===
|
||||
target1:
|
||||
No type information for this code.target2:
|
||||
No type information for this code.while (true) {
|
||||
No type information for this code. continue target2;
|
||||
No type information for this code.}
|
||||
No type information for this code.
|
||||
@ -1,13 +0,0 @@
|
||||
=== tests/cases/compiler/continueTarget4.ts ===
|
||||
target1:
|
||||
>target1 : any
|
||||
|
||||
target2:
|
||||
>target2 : any
|
||||
|
||||
while (true) {
|
||||
>true : boolean
|
||||
|
||||
continue target2;
|
||||
>target2 : any
|
||||
}
|
||||
@ -1,8 +1,11 @@
|
||||
tests/cases/compiler/continueTarget5.ts(1,1): error TS7028: Unused label.
|
||||
tests/cases/compiler/continueTarget5.ts(5,7): error TS1107: Jump target cannot cross function boundary.
|
||||
|
||||
|
||||
==== tests/cases/compiler/continueTarget5.ts (1 errors) ====
|
||||
==== tests/cases/compiler/continueTarget5.ts (2 errors) ====
|
||||
target:
|
||||
~~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
while (true) {
|
||||
function f() {
|
||||
while (true) {
|
||||
|
||||
50
tests/baselines/reference/doWhileBreakStatements.errors.txt
Normal file
50
tests/baselines/reference/doWhileBreakStatements.errors.txt
Normal file
@ -0,0 +1,50 @@
|
||||
tests/cases/conformance/statements/breakStatements/doWhileBreakStatements.ts(11,1): error TS7028: Unused label.
|
||||
tests/cases/conformance/statements/breakStatements/doWhileBreakStatements.ts(19,5): error TS7028: Unused label.
|
||||
tests/cases/conformance/statements/breakStatements/doWhileBreakStatements.ts(30,1): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/breakStatements/doWhileBreakStatements.ts (3 errors) ====
|
||||
do {
|
||||
break;
|
||||
} while(true)
|
||||
|
||||
ONE:
|
||||
do {
|
||||
break ONE;
|
||||
}
|
||||
while (true)
|
||||
|
||||
TWO:
|
||||
~~~
|
||||
!!! error TS7028: Unused label.
|
||||
THREE:
|
||||
do {
|
||||
break THREE;
|
||||
}while (true)
|
||||
|
||||
FOUR:
|
||||
do {
|
||||
FIVE:
|
||||
~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
do {
|
||||
break FOUR;
|
||||
}while (true)
|
||||
}while (true)
|
||||
|
||||
do {
|
||||
SIX:
|
||||
do break SIX; while(true)
|
||||
}while (true)
|
||||
|
||||
SEVEN:
|
||||
~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
do do do break SEVEN; while (true) while (true) while (true)
|
||||
|
||||
EIGHT:
|
||||
do{
|
||||
var fn = function () { }
|
||||
break EIGHT;
|
||||
}while(true)
|
||||
|
||||
@ -1,41 +0,0 @@
|
||||
=== tests/cases/conformance/statements/breakStatements/doWhileBreakStatements.ts ===
|
||||
do {
|
||||
break;
|
||||
} while(true)
|
||||
|
||||
ONE:
|
||||
do {
|
||||
break ONE;
|
||||
}
|
||||
while (true)
|
||||
|
||||
TWO:
|
||||
THREE:
|
||||
do {
|
||||
break THREE;
|
||||
}while (true)
|
||||
|
||||
FOUR:
|
||||
do {
|
||||
FIVE:
|
||||
do {
|
||||
break FOUR;
|
||||
}while (true)
|
||||
}while (true)
|
||||
|
||||
do {
|
||||
SIX:
|
||||
do break SIX; while(true)
|
||||
}while (true)
|
||||
|
||||
SEVEN:
|
||||
do do do break SEVEN; while (true) while (true) while (true)
|
||||
|
||||
EIGHT:
|
||||
do{
|
||||
var fn = function () { }
|
||||
>fn : Symbol(fn, Decl(doWhileBreakStatements.ts, 34, 7))
|
||||
|
||||
break EIGHT;
|
||||
}while(true)
|
||||
|
||||
@ -1,80 +0,0 @@
|
||||
=== tests/cases/conformance/statements/breakStatements/doWhileBreakStatements.ts ===
|
||||
do {
|
||||
break;
|
||||
} while(true)
|
||||
>true : boolean
|
||||
|
||||
ONE:
|
||||
>ONE : any
|
||||
|
||||
do {
|
||||
break ONE;
|
||||
>ONE : any
|
||||
}
|
||||
while (true)
|
||||
>true : boolean
|
||||
|
||||
TWO:
|
||||
>TWO : any
|
||||
|
||||
THREE:
|
||||
>THREE : any
|
||||
|
||||
do {
|
||||
break THREE;
|
||||
>THREE : any
|
||||
|
||||
}while (true)
|
||||
>true : boolean
|
||||
|
||||
FOUR:
|
||||
>FOUR : any
|
||||
|
||||
do {
|
||||
FIVE:
|
||||
>FIVE : any
|
||||
|
||||
do {
|
||||
break FOUR;
|
||||
>FOUR : any
|
||||
|
||||
}while (true)
|
||||
>true : boolean
|
||||
|
||||
}while (true)
|
||||
>true : boolean
|
||||
|
||||
do {
|
||||
SIX:
|
||||
>SIX : any
|
||||
|
||||
do break SIX; while(true)
|
||||
>SIX : any
|
||||
>true : boolean
|
||||
|
||||
}while (true)
|
||||
>true : boolean
|
||||
|
||||
SEVEN:
|
||||
>SEVEN : any
|
||||
|
||||
do do do break SEVEN; while (true) while (true) while (true)
|
||||
>SEVEN : any
|
||||
>true : boolean
|
||||
>true : boolean
|
||||
>true : boolean
|
||||
|
||||
EIGHT:
|
||||
>EIGHT : any
|
||||
|
||||
do{
|
||||
var fn = function () { }
|
||||
>fn : () => void
|
||||
>function () { } : () => void
|
||||
|
||||
break EIGHT;
|
||||
>EIGHT : any
|
||||
|
||||
}while(true)
|
||||
>true : boolean
|
||||
|
||||
@ -0,0 +1,44 @@
|
||||
tests/cases/conformance/statements/continueStatements/doWhileContinueStatements.ts(5,1): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/continueStatements/doWhileContinueStatements.ts (1 errors) ====
|
||||
do {
|
||||
continue;
|
||||
} while(true)
|
||||
|
||||
ONE:
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
do {
|
||||
continue ONE;
|
||||
}
|
||||
while (true)
|
||||
|
||||
TWO:
|
||||
THREE:
|
||||
do {
|
||||
continue THREE;
|
||||
}while (true)
|
||||
|
||||
FOUR:
|
||||
do {
|
||||
FIVE:
|
||||
do {
|
||||
continue FOUR;
|
||||
}while (true)
|
||||
}while (true)
|
||||
|
||||
do {
|
||||
SIX:
|
||||
do continue SIX; while(true)
|
||||
}while (true)
|
||||
|
||||
SEVEN:
|
||||
do do do continue SEVEN; while (true) while (true) while (true)
|
||||
|
||||
EIGHT:
|
||||
do{
|
||||
var fn = function () { }
|
||||
continue EIGHT;
|
||||
}while(true)
|
||||
|
||||
@ -1,41 +0,0 @@
|
||||
=== tests/cases/conformance/statements/continueStatements/doWhileContinueStatements.ts ===
|
||||
do {
|
||||
continue;
|
||||
} while(true)
|
||||
|
||||
ONE:
|
||||
do {
|
||||
continue ONE;
|
||||
}
|
||||
while (true)
|
||||
|
||||
TWO:
|
||||
THREE:
|
||||
do {
|
||||
continue THREE;
|
||||
}while (true)
|
||||
|
||||
FOUR:
|
||||
do {
|
||||
FIVE:
|
||||
do {
|
||||
continue FOUR;
|
||||
}while (true)
|
||||
}while (true)
|
||||
|
||||
do {
|
||||
SIX:
|
||||
do continue SIX; while(true)
|
||||
}while (true)
|
||||
|
||||
SEVEN:
|
||||
do do do continue SEVEN; while (true) while (true) while (true)
|
||||
|
||||
EIGHT:
|
||||
do{
|
||||
var fn = function () { }
|
||||
>fn : Symbol(fn, Decl(doWhileContinueStatements.ts, 34, 7))
|
||||
|
||||
continue EIGHT;
|
||||
}while(true)
|
||||
|
||||
@ -1,80 +0,0 @@
|
||||
=== tests/cases/conformance/statements/continueStatements/doWhileContinueStatements.ts ===
|
||||
do {
|
||||
continue;
|
||||
} while(true)
|
||||
>true : boolean
|
||||
|
||||
ONE:
|
||||
>ONE : any
|
||||
|
||||
do {
|
||||
continue ONE;
|
||||
>ONE : any
|
||||
}
|
||||
while (true)
|
||||
>true : boolean
|
||||
|
||||
TWO:
|
||||
>TWO : any
|
||||
|
||||
THREE:
|
||||
>THREE : any
|
||||
|
||||
do {
|
||||
continue THREE;
|
||||
>THREE : any
|
||||
|
||||
}while (true)
|
||||
>true : boolean
|
||||
|
||||
FOUR:
|
||||
>FOUR : any
|
||||
|
||||
do {
|
||||
FIVE:
|
||||
>FIVE : any
|
||||
|
||||
do {
|
||||
continue FOUR;
|
||||
>FOUR : any
|
||||
|
||||
}while (true)
|
||||
>true : boolean
|
||||
|
||||
}while (true)
|
||||
>true : boolean
|
||||
|
||||
do {
|
||||
SIX:
|
||||
>SIX : any
|
||||
|
||||
do continue SIX; while(true)
|
||||
>SIX : any
|
||||
>true : boolean
|
||||
|
||||
}while (true)
|
||||
>true : boolean
|
||||
|
||||
SEVEN:
|
||||
>SEVEN : any
|
||||
|
||||
do do do continue SEVEN; while (true) while (true) while (true)
|
||||
>SEVEN : any
|
||||
>true : boolean
|
||||
>true : boolean
|
||||
>true : boolean
|
||||
|
||||
EIGHT:
|
||||
>EIGHT : any
|
||||
|
||||
do{
|
||||
var fn = function () { }
|
||||
>fn : () => void
|
||||
>function () { } : () => void
|
||||
|
||||
continue EIGHT;
|
||||
>EIGHT : any
|
||||
|
||||
}while(true)
|
||||
>true : boolean
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
tests/cases/compiler/downlevelLetConst16.ts(151,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/downlevelLetConst16.ts(151,15): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/compiler/downlevelLetConst16.ts(164,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/downlevelLetConst16.ts(164,17): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/compiler/downlevelLetConst16.ts(195,14): error TS2461: Type 'undefined' is not an array type.
|
||||
tests/cases/compiler/downlevelLetConst16.ts(202,15): error TS2459: Type 'undefined' has no property 'a' and no string index signature.
|
||||
@ -6,7 +8,7 @@ tests/cases/compiler/downlevelLetConst16.ts(216,16): error TS2461: Type 'undefin
|
||||
tests/cases/compiler/downlevelLetConst16.ts(223,17): error TS2459: Type 'undefined' has no property 'a' and no string index signature.
|
||||
|
||||
|
||||
==== tests/cases/compiler/downlevelLetConst16.ts (6 errors) ====
|
||||
==== tests/cases/compiler/downlevelLetConst16.ts (8 errors) ====
|
||||
'use strict'
|
||||
|
||||
declare function use(a: any);
|
||||
@ -158,6 +160,8 @@ tests/cases/compiler/downlevelLetConst16.ts(223,17): error TS2459: Type 'undefin
|
||||
use(x);
|
||||
}
|
||||
for (let [y] = []; ;) {
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
use(y);
|
||||
@ -173,6 +177,8 @@ tests/cases/compiler/downlevelLetConst16.ts(223,17): error TS2459: Type 'undefin
|
||||
use(x);
|
||||
}
|
||||
for (const [y] = []; ;) {
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
~
|
||||
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
use(y);
|
||||
|
||||
73
tests/baselines/reference/downlevelLetConst17.errors.txt
Normal file
73
tests/baselines/reference/downlevelLetConst17.errors.txt
Normal file
@ -0,0 +1,73 @@
|
||||
tests/cases/compiler/downlevelLetConst17.ts(9,1): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/downlevelLetConst17.ts (1 errors) ====
|
||||
'use strict'
|
||||
|
||||
declare function use(a: any);
|
||||
|
||||
var x;
|
||||
for (let x = 10; ;) {
|
||||
use(x);
|
||||
}
|
||||
use(x);
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
|
||||
for (const x = 10; ;) {
|
||||
use(x);
|
||||
}
|
||||
|
||||
for (; ;) {
|
||||
let x = 10;
|
||||
use(x);
|
||||
x = 1;
|
||||
}
|
||||
|
||||
for (; ;) {
|
||||
const x = 10;
|
||||
use(x);
|
||||
}
|
||||
|
||||
for (let x; ;) {
|
||||
use(x);
|
||||
x = 1;
|
||||
}
|
||||
|
||||
for (; ;) {
|
||||
let x;
|
||||
use(x);
|
||||
x = 1;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
let x;
|
||||
use(x);
|
||||
}
|
||||
|
||||
while (true) {
|
||||
const x = true;
|
||||
use(x);
|
||||
}
|
||||
|
||||
do {
|
||||
let x;
|
||||
use(x);
|
||||
} while (true);
|
||||
|
||||
do {
|
||||
let x;
|
||||
use(x);
|
||||
} while (true);
|
||||
|
||||
for (let x in []) {
|
||||
use(x);
|
||||
}
|
||||
|
||||
for (const x in []) {
|
||||
use(x);
|
||||
}
|
||||
|
||||
for (const x of []) {
|
||||
use(x);
|
||||
}
|
||||
@ -1,134 +0,0 @@
|
||||
=== tests/cases/compiler/downlevelLetConst17.ts ===
|
||||
'use strict'
|
||||
|
||||
declare function use(a: any);
|
||||
>use : Symbol(use, Decl(downlevelLetConst17.ts, 0, 12))
|
||||
>a : Symbol(a, Decl(downlevelLetConst17.ts, 2, 21))
|
||||
|
||||
var x;
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 4, 3))
|
||||
|
||||
for (let x = 10; ;) {
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 5, 8))
|
||||
|
||||
use(x);
|
||||
>use : Symbol(use, Decl(downlevelLetConst17.ts, 0, 12))
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 5, 8))
|
||||
}
|
||||
use(x);
|
||||
>use : Symbol(use, Decl(downlevelLetConst17.ts, 0, 12))
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 4, 3))
|
||||
|
||||
for (const x = 10; ;) {
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 10, 10))
|
||||
|
||||
use(x);
|
||||
>use : Symbol(use, Decl(downlevelLetConst17.ts, 0, 12))
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 10, 10))
|
||||
}
|
||||
|
||||
for (; ;) {
|
||||
let x = 10;
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 15, 7))
|
||||
|
||||
use(x);
|
||||
>use : Symbol(use, Decl(downlevelLetConst17.ts, 0, 12))
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 15, 7))
|
||||
|
||||
x = 1;
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 15, 7))
|
||||
}
|
||||
|
||||
for (; ;) {
|
||||
const x = 10;
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 21, 9))
|
||||
|
||||
use(x);
|
||||
>use : Symbol(use, Decl(downlevelLetConst17.ts, 0, 12))
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 21, 9))
|
||||
}
|
||||
|
||||
for (let x; ;) {
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 25, 8))
|
||||
|
||||
use(x);
|
||||
>use : Symbol(use, Decl(downlevelLetConst17.ts, 0, 12))
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 25, 8))
|
||||
|
||||
x = 1;
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 25, 8))
|
||||
}
|
||||
|
||||
for (; ;) {
|
||||
let x;
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 31, 7))
|
||||
|
||||
use(x);
|
||||
>use : Symbol(use, Decl(downlevelLetConst17.ts, 0, 12))
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 31, 7))
|
||||
|
||||
x = 1;
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 31, 7))
|
||||
}
|
||||
|
||||
while (true) {
|
||||
let x;
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 37, 7))
|
||||
|
||||
use(x);
|
||||
>use : Symbol(use, Decl(downlevelLetConst17.ts, 0, 12))
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 37, 7))
|
||||
}
|
||||
|
||||
while (true) {
|
||||
const x = true;
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 42, 9))
|
||||
|
||||
use(x);
|
||||
>use : Symbol(use, Decl(downlevelLetConst17.ts, 0, 12))
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 42, 9))
|
||||
}
|
||||
|
||||
do {
|
||||
let x;
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 47, 7))
|
||||
|
||||
use(x);
|
||||
>use : Symbol(use, Decl(downlevelLetConst17.ts, 0, 12))
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 47, 7))
|
||||
|
||||
} while (true);
|
||||
|
||||
do {
|
||||
let x;
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 52, 7))
|
||||
|
||||
use(x);
|
||||
>use : Symbol(use, Decl(downlevelLetConst17.ts, 0, 12))
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 52, 7))
|
||||
|
||||
} while (true);
|
||||
|
||||
for (let x in []) {
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 56, 8))
|
||||
|
||||
use(x);
|
||||
>use : Symbol(use, Decl(downlevelLetConst17.ts, 0, 12))
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 56, 8))
|
||||
}
|
||||
|
||||
for (const x in []) {
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 60, 10))
|
||||
|
||||
use(x);
|
||||
>use : Symbol(use, Decl(downlevelLetConst17.ts, 0, 12))
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 60, 10))
|
||||
}
|
||||
|
||||
for (const x of []) {
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 64, 10))
|
||||
|
||||
use(x);
|
||||
>use : Symbol(use, Decl(downlevelLetConst17.ts, 0, 12))
|
||||
>x : Symbol(x, Decl(downlevelLetConst17.ts, 64, 10))
|
||||
}
|
||||
@ -1,169 +0,0 @@
|
||||
=== tests/cases/compiler/downlevelLetConst17.ts ===
|
||||
'use strict'
|
||||
>'use strict' : string
|
||||
|
||||
declare function use(a: any);
|
||||
>use : (a: any) => any
|
||||
>a : any
|
||||
|
||||
var x;
|
||||
>x : any
|
||||
|
||||
for (let x = 10; ;) {
|
||||
>x : number
|
||||
>10 : number
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
}
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : any
|
||||
|
||||
for (const x = 10; ;) {
|
||||
>x : number
|
||||
>10 : number
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
}
|
||||
|
||||
for (; ;) {
|
||||
let x = 10;
|
||||
>x : number
|
||||
>10 : number
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
|
||||
x = 1;
|
||||
>x = 1 : number
|
||||
>x : number
|
||||
>1 : number
|
||||
}
|
||||
|
||||
for (; ;) {
|
||||
const x = 10;
|
||||
>x : number
|
||||
>10 : number
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
}
|
||||
|
||||
for (let x; ;) {
|
||||
>x : any
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : any
|
||||
|
||||
x = 1;
|
||||
>x = 1 : number
|
||||
>x : any
|
||||
>1 : number
|
||||
}
|
||||
|
||||
for (; ;) {
|
||||
let x;
|
||||
>x : any
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : any
|
||||
|
||||
x = 1;
|
||||
>x = 1 : number
|
||||
>x : any
|
||||
>1 : number
|
||||
}
|
||||
|
||||
while (true) {
|
||||
>true : boolean
|
||||
|
||||
let x;
|
||||
>x : any
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : any
|
||||
}
|
||||
|
||||
while (true) {
|
||||
>true : boolean
|
||||
|
||||
const x = true;
|
||||
>x : boolean
|
||||
>true : boolean
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : boolean
|
||||
}
|
||||
|
||||
do {
|
||||
let x;
|
||||
>x : any
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : any
|
||||
|
||||
} while (true);
|
||||
>true : boolean
|
||||
|
||||
do {
|
||||
let x;
|
||||
>x : any
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : any
|
||||
|
||||
} while (true);
|
||||
>true : boolean
|
||||
|
||||
for (let x in []) {
|
||||
>x : any
|
||||
>[] : undefined[]
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : any
|
||||
}
|
||||
|
||||
for (const x in []) {
|
||||
>x : any
|
||||
>[] : undefined[]
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : any
|
||||
}
|
||||
|
||||
for (const x of []) {
|
||||
>x : any
|
||||
>[] : undefined[]
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : any
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
tests/cases/compiler/downlevelLetConst18.ts(3,1): error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher.
|
||||
tests/cases/compiler/downlevelLetConst18.ts(4,14): error TS2393: Duplicate function implementation.
|
||||
tests/cases/compiler/downlevelLetConst18.ts(7,1): error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher.
|
||||
tests/cases/compiler/downlevelLetConst18.ts(7,1): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/downlevelLetConst18.ts(8,14): error TS2393: Duplicate function implementation.
|
||||
tests/cases/compiler/downlevelLetConst18.ts(11,1): error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher.
|
||||
tests/cases/compiler/downlevelLetConst18.ts(15,1): error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher.
|
||||
@ -9,7 +10,7 @@ tests/cases/compiler/downlevelLetConst18.ts(23,1): error TS4091: Loop contains b
|
||||
tests/cases/compiler/downlevelLetConst18.ts(27,1): error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/compiler/downlevelLetConst18.ts (9 errors) ====
|
||||
==== tests/cases/compiler/downlevelLetConst18.ts (10 errors) ====
|
||||
'use strict'
|
||||
|
||||
for (let x; ;) {
|
||||
@ -23,6 +24,8 @@ tests/cases/compiler/downlevelLetConst18.ts(27,1): error TS4091: Loop contains b
|
||||
for (let x; ;) {
|
||||
~~~
|
||||
!!! error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher.
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
function foo() { x };
|
||||
~~~
|
||||
!!! error TS2393: Duplicate function implementation.
|
||||
|
||||
@ -1,8 +1,11 @@
|
||||
tests/cases/compiler/duplicateLabel1.ts(1,1): error TS7028: Unused label.
|
||||
tests/cases/compiler/duplicateLabel1.ts(2,1): error TS1114: Duplicate label 'target'
|
||||
|
||||
|
||||
==== tests/cases/compiler/duplicateLabel1.ts (1 errors) ====
|
||||
==== tests/cases/compiler/duplicateLabel1.ts (2 errors) ====
|
||||
target:
|
||||
~~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
target:
|
||||
~~~~~~
|
||||
!!! error TS1114: Duplicate label 'target'
|
||||
|
||||
@ -1,8 +1,11 @@
|
||||
tests/cases/compiler/duplicateLabel2.ts(1,1): error TS7028: Unused label.
|
||||
tests/cases/compiler/duplicateLabel2.ts(3,3): error TS1114: Duplicate label 'target'
|
||||
|
||||
|
||||
==== tests/cases/compiler/duplicateLabel2.ts (1 errors) ====
|
||||
==== tests/cases/compiler/duplicateLabel2.ts (2 errors) ====
|
||||
target:
|
||||
~~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
while (true) {
|
||||
target:
|
||||
~~~~~~
|
||||
|
||||
17
tests/baselines/reference/duplicateLabel3.errors.txt
Normal file
17
tests/baselines/reference/duplicateLabel3.errors.txt
Normal file
@ -0,0 +1,17 @@
|
||||
tests/cases/compiler/duplicateLabel3.ts(1,1): error TS7028: Unused label.
|
||||
tests/cases/compiler/duplicateLabel3.ts(4,5): error TS7028: Unused label.
|
||||
|
||||
|
||||
==== tests/cases/compiler/duplicateLabel3.ts (2 errors) ====
|
||||
target:
|
||||
~~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
while (true) {
|
||||
function f() {
|
||||
target:
|
||||
~~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
while (true) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
=== tests/cases/compiler/duplicateLabel3.ts ===
|
||||
target:
|
||||
while (true) {
|
||||
function f() {
|
||||
>f : Symbol(f, Decl(duplicateLabel3.ts, 1, 14))
|
||||
|
||||
target:
|
||||
while (true) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
=== tests/cases/compiler/duplicateLabel3.ts ===
|
||||
target:
|
||||
>target : any
|
||||
|
||||
while (true) {
|
||||
>true : boolean
|
||||
|
||||
function f() {
|
||||
>f : () => void
|
||||
|
||||
target:
|
||||
>target : any
|
||||
|
||||
while (true) {
|
||||
>true : boolean
|
||||
}
|
||||
}
|
||||
}
|
||||
16
tests/baselines/reference/duplicateLabel4.errors.txt
Normal file
16
tests/baselines/reference/duplicateLabel4.errors.txt
Normal file
@ -0,0 +1,16 @@
|
||||
tests/cases/compiler/duplicateLabel4.ts(1,1): error TS7028: Unused label.
|
||||
tests/cases/compiler/duplicateLabel4.ts(5,1): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/duplicateLabel4.ts (2 errors) ====
|
||||
target:
|
||||
~~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
while (true) {
|
||||
}
|
||||
|
||||
target:
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
while (true) {
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
=== tests/cases/compiler/duplicateLabel4.ts ===
|
||||
target:
|
||||
No type information for this code.while (true) {
|
||||
No type information for this code.}
|
||||
No type information for this code.
|
||||
No type information for this code.target:
|
||||
No type information for this code.while (true) {
|
||||
No type information for this code.}
|
||||
No type information for this code.
|
||||
@ -1,14 +0,0 @@
|
||||
=== tests/cases/compiler/duplicateLabel4.ts ===
|
||||
target:
|
||||
>target : any
|
||||
|
||||
while (true) {
|
||||
>true : boolean
|
||||
}
|
||||
|
||||
target:
|
||||
>target : any
|
||||
|
||||
while (true) {
|
||||
>true : boolean
|
||||
}
|
||||
@ -1,7 +1,9 @@
|
||||
tests/cases/compiler/duplicateLocalVariable1.ts(64,92): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/duplicateLocalVariable1.ts(65,122): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/duplicateLocalVariable1.ts(185,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'any', but here has type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/duplicateLocalVariable1.ts (1 errors) ====
|
||||
==== tests/cases/compiler/duplicateLocalVariable1.ts (3 errors) ====
|
||||
|
||||
//import FileManager = require('filemanager');
|
||||
//import App = require('app');
|
||||
@ -66,7 +68,11 @@ tests/cases/compiler/duplicateLocalVariable1.ts(185,22): error TS2403: Subsequen
|
||||
// First 3 are for simple harness validation
|
||||
testRunner.addTest(new TestCase("Basic test", function () { return true; }));
|
||||
testRunner.addTest(new TestCase("Test for any error", function () { throw new Error(); return false; }, ""));
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
testRunner.addTest(new TestCase("Test RegEx error message match", function () { throw new Error("Should also pass"); return false; }, "Should [also]+ pass"));
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
testRunner.addTest(new TestCase("Test array compare true", function () { return TestRunner.arrayCompare([1, 2, 3], [1, 2, 3]); }));
|
||||
testRunner.addTest(new TestCase("Test array compare false", function () { return !TestRunner.arrayCompare([3, 2, 3], [1, 2, 3]); }));
|
||||
|
||||
|
||||
@ -0,0 +1,37 @@
|
||||
tests/cases/compiler/duplicateVariablesByScope.ts(18,9): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/duplicateVariablesByScope.ts (1 errors) ====
|
||||
// duplicate local variables are only reported at global scope
|
||||
|
||||
module M {
|
||||
for (var j = 0; j < 10; j++) {
|
||||
}
|
||||
|
||||
for (var j = 0; j < 10; j++) {
|
||||
}
|
||||
}
|
||||
|
||||
function foo() {
|
||||
var x = 2;
|
||||
var x = 1;
|
||||
if (true) {
|
||||
var result = 1;
|
||||
}
|
||||
else {
|
||||
var result = 2;
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
}
|
||||
|
||||
class C {
|
||||
foo() {
|
||||
try {
|
||||
var x = 1;
|
||||
}
|
||||
catch (e) {
|
||||
var x = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,56 +0,0 @@
|
||||
=== tests/cases/compiler/duplicateVariablesByScope.ts ===
|
||||
// duplicate local variables are only reported at global scope
|
||||
|
||||
module M {
|
||||
>M : Symbol(M, Decl(duplicateVariablesByScope.ts, 0, 0))
|
||||
|
||||
for (var j = 0; j < 10; j++) {
|
||||
>j : Symbol(j, Decl(duplicateVariablesByScope.ts, 3, 12), Decl(duplicateVariablesByScope.ts, 6, 12))
|
||||
>j : Symbol(j, Decl(duplicateVariablesByScope.ts, 3, 12), Decl(duplicateVariablesByScope.ts, 6, 12))
|
||||
>j : Symbol(j, Decl(duplicateVariablesByScope.ts, 3, 12), Decl(duplicateVariablesByScope.ts, 6, 12))
|
||||
}
|
||||
|
||||
for (var j = 0; j < 10; j++) {
|
||||
>j : Symbol(j, Decl(duplicateVariablesByScope.ts, 3, 12), Decl(duplicateVariablesByScope.ts, 6, 12))
|
||||
>j : Symbol(j, Decl(duplicateVariablesByScope.ts, 3, 12), Decl(duplicateVariablesByScope.ts, 6, 12))
|
||||
>j : Symbol(j, Decl(duplicateVariablesByScope.ts, 3, 12), Decl(duplicateVariablesByScope.ts, 6, 12))
|
||||
}
|
||||
}
|
||||
|
||||
function foo() {
|
||||
>foo : Symbol(foo, Decl(duplicateVariablesByScope.ts, 8, 1))
|
||||
|
||||
var x = 2;
|
||||
>x : Symbol(x, Decl(duplicateVariablesByScope.ts, 11, 7), Decl(duplicateVariablesByScope.ts, 12, 7))
|
||||
|
||||
var x = 1;
|
||||
>x : Symbol(x, Decl(duplicateVariablesByScope.ts, 11, 7), Decl(duplicateVariablesByScope.ts, 12, 7))
|
||||
|
||||
if (true) {
|
||||
var result = 1;
|
||||
>result : Symbol(result, Decl(duplicateVariablesByScope.ts, 14, 11), Decl(duplicateVariablesByScope.ts, 17, 11))
|
||||
}
|
||||
else {
|
||||
var result = 2;
|
||||
>result : Symbol(result, Decl(duplicateVariablesByScope.ts, 14, 11), Decl(duplicateVariablesByScope.ts, 17, 11))
|
||||
}
|
||||
}
|
||||
|
||||
class C {
|
||||
>C : Symbol(C, Decl(duplicateVariablesByScope.ts, 19, 1))
|
||||
|
||||
foo() {
|
||||
>foo : Symbol(foo, Decl(duplicateVariablesByScope.ts, 21, 9))
|
||||
|
||||
try {
|
||||
var x = 1;
|
||||
>x : Symbol(x, Decl(duplicateVariablesByScope.ts, 24, 15), Decl(duplicateVariablesByScope.ts, 27, 15))
|
||||
}
|
||||
catch (e) {
|
||||
>e : Symbol(e, Decl(duplicateVariablesByScope.ts, 26, 15))
|
||||
|
||||
var x = 2;
|
||||
>x : Symbol(x, Decl(duplicateVariablesByScope.ts, 24, 15), Decl(duplicateVariablesByScope.ts, 27, 15))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,72 +0,0 @@
|
||||
=== tests/cases/compiler/duplicateVariablesByScope.ts ===
|
||||
// duplicate local variables are only reported at global scope
|
||||
|
||||
module M {
|
||||
>M : typeof M
|
||||
|
||||
for (var j = 0; j < 10; j++) {
|
||||
>j : number
|
||||
>0 : number
|
||||
>j < 10 : boolean
|
||||
>j : number
|
||||
>10 : number
|
||||
>j++ : number
|
||||
>j : number
|
||||
}
|
||||
|
||||
for (var j = 0; j < 10; j++) {
|
||||
>j : number
|
||||
>0 : number
|
||||
>j < 10 : boolean
|
||||
>j : number
|
||||
>10 : number
|
||||
>j++ : number
|
||||
>j : number
|
||||
}
|
||||
}
|
||||
|
||||
function foo() {
|
||||
>foo : () => void
|
||||
|
||||
var x = 2;
|
||||
>x : number
|
||||
>2 : number
|
||||
|
||||
var x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
|
||||
if (true) {
|
||||
>true : boolean
|
||||
|
||||
var result = 1;
|
||||
>result : number
|
||||
>1 : number
|
||||
}
|
||||
else {
|
||||
var result = 2;
|
||||
>result : number
|
||||
>2 : number
|
||||
}
|
||||
}
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
foo() {
|
||||
>foo : () => void
|
||||
|
||||
try {
|
||||
var x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
}
|
||||
catch (e) {
|
||||
>e : any
|
||||
|
||||
var x = 2;
|
||||
>x : number
|
||||
>2 : number
|
||||
}
|
||||
}
|
||||
}
|
||||
19
tests/baselines/reference/es6ClassSuperCodegenBug.errors.txt
Normal file
19
tests/baselines/reference/es6ClassSuperCodegenBug.errors.txt
Normal file
@ -0,0 +1,19 @@
|
||||
tests/cases/compiler/es6ClassSuperCodegenBug.ts(9,10): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/es6ClassSuperCodegenBug.ts (1 errors) ====
|
||||
class A {
|
||||
constructor(str1:string, str2:string) {}
|
||||
}
|
||||
class B extends A {
|
||||
constructor() {
|
||||
if (true) {
|
||||
super('a1', 'b1');
|
||||
} else {
|
||||
super('a2', 'b2');
|
||||
~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,24 +0,0 @@
|
||||
=== tests/cases/compiler/es6ClassSuperCodegenBug.ts ===
|
||||
class A {
|
||||
>A : Symbol(A, Decl(es6ClassSuperCodegenBug.ts, 0, 0))
|
||||
|
||||
constructor(str1:string, str2:string) {}
|
||||
>str1 : Symbol(str1, Decl(es6ClassSuperCodegenBug.ts, 1, 13))
|
||||
>str2 : Symbol(str2, Decl(es6ClassSuperCodegenBug.ts, 1, 25))
|
||||
}
|
||||
class B extends A {
|
||||
>B : Symbol(B, Decl(es6ClassSuperCodegenBug.ts, 2, 1))
|
||||
>A : Symbol(A, Decl(es6ClassSuperCodegenBug.ts, 0, 0))
|
||||
|
||||
constructor() {
|
||||
if (true) {
|
||||
super('a1', 'b1');
|
||||
>super : Symbol(A, Decl(es6ClassSuperCodegenBug.ts, 0, 0))
|
||||
|
||||
} else {
|
||||
super('a2', 'b2');
|
||||
>super : Symbol(A, Decl(es6ClassSuperCodegenBug.ts, 0, 0))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,32 +0,0 @@
|
||||
=== tests/cases/compiler/es6ClassSuperCodegenBug.ts ===
|
||||
class A {
|
||||
>A : A
|
||||
|
||||
constructor(str1:string, str2:string) {}
|
||||
>str1 : string
|
||||
>str2 : string
|
||||
}
|
||||
class B extends A {
|
||||
>B : B
|
||||
>A : A
|
||||
|
||||
constructor() {
|
||||
if (true) {
|
||||
>true : boolean
|
||||
|
||||
super('a1', 'b1');
|
||||
>super('a1', 'b1') : void
|
||||
>super : typeof A
|
||||
>'a1' : string
|
||||
>'b1' : string
|
||||
|
||||
} else {
|
||||
super('a2', 'b2');
|
||||
>super('a2', 'b2') : void
|
||||
>super : typeof A
|
||||
>'a2' : string
|
||||
>'b2' : string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
146
tests/baselines/reference/escapedIdentifiers.errors.txt
Normal file
146
tests/baselines/reference/escapedIdentifiers.errors.txt
Normal file
@ -0,0 +1,146 @@
|
||||
tests/cases/compiler/escapedIdentifiers.ts(93,1): error TS7028: Unused label.
|
||||
tests/cases/compiler/escapedIdentifiers.ts(96,8): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/escapedIdentifiers.ts(100,1): error TS7028: Unused label.
|
||||
tests/cases/compiler/escapedIdentifiers.ts(103,8): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/escapedIdentifiers.ts(107,1): error TS7028: Unused label.
|
||||
tests/cases/compiler/escapedIdentifiers.ts(110,8): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/escapedIdentifiers.ts(114,1): error TS7028: Unused label.
|
||||
tests/cases/compiler/escapedIdentifiers.ts(117,8): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/escapedIdentifiers.ts (8 errors) ====
|
||||
/*
|
||||
0 .. \u0030
|
||||
9 .. \u0039
|
||||
|
||||
A .. \u0041
|
||||
Z .. \u005a
|
||||
|
||||
a .. \u0061
|
||||
z .. \u00za
|
||||
*/
|
||||
|
||||
// var decl
|
||||
var \u0061 = 1;
|
||||
a ++;
|
||||
\u0061 ++;
|
||||
|
||||
var b = 1;
|
||||
b ++;
|
||||
\u0062 ++;
|
||||
|
||||
// modules
|
||||
module moduleType1 {
|
||||
export var baz1: number;
|
||||
}
|
||||
module moduleType\u0032 {
|
||||
export var baz2: number;
|
||||
}
|
||||
|
||||
moduleType1.baz1 = 3;
|
||||
moduleType\u0031.baz1 = 3;
|
||||
moduleType2.baz2 = 3;
|
||||
moduleType\u0032.baz2 = 3;
|
||||
|
||||
// classes
|
||||
|
||||
class classType1 {
|
||||
public foo1: number;
|
||||
}
|
||||
class classType\u0032 {
|
||||
public foo2: number;
|
||||
}
|
||||
|
||||
var classType1Object1 = new classType1();
|
||||
classType1Object1.foo1 = 2;
|
||||
var classType1Object2 = new classType\u0031();
|
||||
classType1Object2.foo1 = 2;
|
||||
var classType2Object1 = new classType2();
|
||||
classType2Object1.foo2 = 2;
|
||||
var classType2Object2 = new classType\u0032();
|
||||
classType2Object2.foo2 = 2;
|
||||
|
||||
// interfaces
|
||||
interface interfaceType1 {
|
||||
bar1: number;
|
||||
}
|
||||
interface interfaceType\u0032 {
|
||||
bar2: number;
|
||||
}
|
||||
|
||||
var interfaceType1Object1 = <interfaceType1>{ bar1: 0 };
|
||||
interfaceType1Object1.bar1 = 2;
|
||||
var interfaceType1Object2 = <interfaceType\u0031>{ bar1: 0 };
|
||||
interfaceType1Object2.bar1 = 2;
|
||||
var interfaceType2Object1 = <interfaceType2>{ bar2: 0 };
|
||||
interfaceType2Object1.bar2 = 2;
|
||||
var interfaceType2Object2 = <interfaceType\u0032>{ bar2: 0 };
|
||||
interfaceType2Object2.bar2 = 2;
|
||||
|
||||
|
||||
// arguments
|
||||
class testClass {
|
||||
public func(arg1: number, arg\u0032: string, arg\u0033: boolean, arg4: number) {
|
||||
arg\u0031 = 1;
|
||||
arg2 = 'string';
|
||||
arg\u0033 = true;
|
||||
arg4 = 2;
|
||||
}
|
||||
}
|
||||
|
||||
// constructors
|
||||
class constructorTestClass {
|
||||
constructor (public arg1: number,public arg\u0032: string,public arg\u0033: boolean,public arg4: number) {
|
||||
}
|
||||
}
|
||||
var constructorTestObject = new constructorTestClass(1, 'string', true, 2);
|
||||
constructorTestObject.arg\u0031 = 1;
|
||||
constructorTestObject.arg2 = 'string';
|
||||
constructorTestObject.arg\u0033 = true;
|
||||
constructorTestObject.arg4 = 2;
|
||||
|
||||
// Lables
|
||||
|
||||
l\u0061bel1:
|
||||
~~~~~~~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
while (false)
|
||||
{
|
||||
while(false)
|
||||
~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
continue label1; // it will go to next iteration of outer loop
|
||||
}
|
||||
|
||||
label2:
|
||||
~~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
while (false)
|
||||
{
|
||||
while(false)
|
||||
~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
continue l\u0061bel2; // it will go to next iteration of outer loop
|
||||
}
|
||||
|
||||
label3:
|
||||
~~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
while (false)
|
||||
{
|
||||
while(false)
|
||||
~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
continue label3; // it will go to next iteration of outer loop
|
||||
}
|
||||
|
||||
l\u0061bel4:
|
||||
~~~~~~~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
while (false)
|
||||
{
|
||||
while(false)
|
||||
~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
continue l\u0061bel4; // it will go to next iteration of outer loop
|
||||
}
|
||||
@ -1,260 +0,0 @@
|
||||
=== tests/cases/compiler/escapedIdentifiers.ts ===
|
||||
/*
|
||||
0 .. \u0030
|
||||
9 .. \u0039
|
||||
|
||||
A .. \u0041
|
||||
Z .. \u005a
|
||||
|
||||
a .. \u0061
|
||||
z .. \u00za
|
||||
*/
|
||||
|
||||
// var decl
|
||||
var \u0061 = 1;
|
||||
>\u0061 : Symbol(\u0061, Decl(escapedIdentifiers.ts, 12, 3))
|
||||
|
||||
a ++;
|
||||
>a : Symbol(\u0061, Decl(escapedIdentifiers.ts, 12, 3))
|
||||
|
||||
\u0061 ++;
|
||||
>\u0061 : Symbol(\u0061, Decl(escapedIdentifiers.ts, 12, 3))
|
||||
|
||||
var b = 1;
|
||||
>b : Symbol(b, Decl(escapedIdentifiers.ts, 16, 3))
|
||||
|
||||
b ++;
|
||||
>b : Symbol(b, Decl(escapedIdentifiers.ts, 16, 3))
|
||||
|
||||
\u0062 ++;
|
||||
>\u0062 : Symbol(b, Decl(escapedIdentifiers.ts, 16, 3))
|
||||
|
||||
// modules
|
||||
module moduleType1 {
|
||||
>moduleType1 : Symbol(moduleType1, Decl(escapedIdentifiers.ts, 18, 10))
|
||||
|
||||
export var baz1: number;
|
||||
>baz1 : Symbol(baz1, Decl(escapedIdentifiers.ts, 22, 14))
|
||||
}
|
||||
module moduleType\u0032 {
|
||||
>moduleType\u0032 : Symbol(moduleType\u0032, Decl(escapedIdentifiers.ts, 23, 1))
|
||||
|
||||
export var baz2: number;
|
||||
>baz2 : Symbol(baz2, Decl(escapedIdentifiers.ts, 25, 14))
|
||||
}
|
||||
|
||||
moduleType1.baz1 = 3;
|
||||
>moduleType1.baz1 : Symbol(moduleType1.baz1, Decl(escapedIdentifiers.ts, 22, 14))
|
||||
>moduleType1 : Symbol(moduleType1, Decl(escapedIdentifiers.ts, 18, 10))
|
||||
>baz1 : Symbol(moduleType1.baz1, Decl(escapedIdentifiers.ts, 22, 14))
|
||||
|
||||
moduleType\u0031.baz1 = 3;
|
||||
>moduleType\u0031.baz1 : Symbol(moduleType1.baz1, Decl(escapedIdentifiers.ts, 22, 14))
|
||||
>moduleType\u0031 : Symbol(moduleType1, Decl(escapedIdentifiers.ts, 18, 10))
|
||||
>baz1 : Symbol(moduleType1.baz1, Decl(escapedIdentifiers.ts, 22, 14))
|
||||
|
||||
moduleType2.baz2 = 3;
|
||||
>moduleType2.baz2 : Symbol(moduleType\u0032.baz2, Decl(escapedIdentifiers.ts, 25, 14))
|
||||
>moduleType2 : Symbol(moduleType\u0032, Decl(escapedIdentifiers.ts, 23, 1))
|
||||
>baz2 : Symbol(moduleType\u0032.baz2, Decl(escapedIdentifiers.ts, 25, 14))
|
||||
|
||||
moduleType\u0032.baz2 = 3;
|
||||
>moduleType\u0032.baz2 : Symbol(moduleType\u0032.baz2, Decl(escapedIdentifiers.ts, 25, 14))
|
||||
>moduleType\u0032 : Symbol(moduleType\u0032, Decl(escapedIdentifiers.ts, 23, 1))
|
||||
>baz2 : Symbol(moduleType\u0032.baz2, Decl(escapedIdentifiers.ts, 25, 14))
|
||||
|
||||
// classes
|
||||
|
||||
class classType1 {
|
||||
>classType1 : Symbol(classType1, Decl(escapedIdentifiers.ts, 31, 26))
|
||||
|
||||
public foo1: number;
|
||||
>foo1 : Symbol(foo1, Decl(escapedIdentifiers.ts, 35, 18))
|
||||
}
|
||||
class classType\u0032 {
|
||||
>classType\u0032 : Symbol(classType\u0032, Decl(escapedIdentifiers.ts, 37, 1))
|
||||
|
||||
public foo2: number;
|
||||
>foo2 : Symbol(foo2, Decl(escapedIdentifiers.ts, 38, 23))
|
||||
}
|
||||
|
||||
var classType1Object1 = new classType1();
|
||||
>classType1Object1 : Symbol(classType1Object1, Decl(escapedIdentifiers.ts, 42, 3))
|
||||
>classType1 : Symbol(classType1, Decl(escapedIdentifiers.ts, 31, 26))
|
||||
|
||||
classType1Object1.foo1 = 2;
|
||||
>classType1Object1.foo1 : Symbol(classType1.foo1, Decl(escapedIdentifiers.ts, 35, 18))
|
||||
>classType1Object1 : Symbol(classType1Object1, Decl(escapedIdentifiers.ts, 42, 3))
|
||||
>foo1 : Symbol(classType1.foo1, Decl(escapedIdentifiers.ts, 35, 18))
|
||||
|
||||
var classType1Object2 = new classType\u0031();
|
||||
>classType1Object2 : Symbol(classType1Object2, Decl(escapedIdentifiers.ts, 44, 3))
|
||||
>classType\u0031 : Symbol(classType1, Decl(escapedIdentifiers.ts, 31, 26))
|
||||
|
||||
classType1Object2.foo1 = 2;
|
||||
>classType1Object2.foo1 : Symbol(classType1.foo1, Decl(escapedIdentifiers.ts, 35, 18))
|
||||
>classType1Object2 : Symbol(classType1Object2, Decl(escapedIdentifiers.ts, 44, 3))
|
||||
>foo1 : Symbol(classType1.foo1, Decl(escapedIdentifiers.ts, 35, 18))
|
||||
|
||||
var classType2Object1 = new classType2();
|
||||
>classType2Object1 : Symbol(classType2Object1, Decl(escapedIdentifiers.ts, 46, 3))
|
||||
>classType2 : Symbol(classType\u0032, Decl(escapedIdentifiers.ts, 37, 1))
|
||||
|
||||
classType2Object1.foo2 = 2;
|
||||
>classType2Object1.foo2 : Symbol(classType\u0032.foo2, Decl(escapedIdentifiers.ts, 38, 23))
|
||||
>classType2Object1 : Symbol(classType2Object1, Decl(escapedIdentifiers.ts, 46, 3))
|
||||
>foo2 : Symbol(classType\u0032.foo2, Decl(escapedIdentifiers.ts, 38, 23))
|
||||
|
||||
var classType2Object2 = new classType\u0032();
|
||||
>classType2Object2 : Symbol(classType2Object2, Decl(escapedIdentifiers.ts, 48, 3))
|
||||
>classType\u0032 : Symbol(classType\u0032, Decl(escapedIdentifiers.ts, 37, 1))
|
||||
|
||||
classType2Object2.foo2 = 2;
|
||||
>classType2Object2.foo2 : Symbol(classType\u0032.foo2, Decl(escapedIdentifiers.ts, 38, 23))
|
||||
>classType2Object2 : Symbol(classType2Object2, Decl(escapedIdentifiers.ts, 48, 3))
|
||||
>foo2 : Symbol(classType\u0032.foo2, Decl(escapedIdentifiers.ts, 38, 23))
|
||||
|
||||
// interfaces
|
||||
interface interfaceType1 {
|
||||
>interfaceType1 : Symbol(interfaceType1, Decl(escapedIdentifiers.ts, 49, 27))
|
||||
|
||||
bar1: number;
|
||||
>bar1 : Symbol(bar1, Decl(escapedIdentifiers.ts, 52, 26))
|
||||
}
|
||||
interface interfaceType\u0032 {
|
||||
>interfaceType\u0032 : Symbol(interfaceType\u0032, Decl(escapedIdentifiers.ts, 54, 1))
|
||||
|
||||
bar2: number;
|
||||
>bar2 : Symbol(bar2, Decl(escapedIdentifiers.ts, 55, 31))
|
||||
}
|
||||
|
||||
var interfaceType1Object1 = <interfaceType1>{ bar1: 0 };
|
||||
>interfaceType1Object1 : Symbol(interfaceType1Object1, Decl(escapedIdentifiers.ts, 59, 3))
|
||||
>interfaceType1 : Symbol(interfaceType1, Decl(escapedIdentifiers.ts, 49, 27))
|
||||
>bar1 : Symbol(bar1, Decl(escapedIdentifiers.ts, 59, 45))
|
||||
|
||||
interfaceType1Object1.bar1 = 2;
|
||||
>interfaceType1Object1.bar1 : Symbol(interfaceType1.bar1, Decl(escapedIdentifiers.ts, 52, 26))
|
||||
>interfaceType1Object1 : Symbol(interfaceType1Object1, Decl(escapedIdentifiers.ts, 59, 3))
|
||||
>bar1 : Symbol(interfaceType1.bar1, Decl(escapedIdentifiers.ts, 52, 26))
|
||||
|
||||
var interfaceType1Object2 = <interfaceType\u0031>{ bar1: 0 };
|
||||
>interfaceType1Object2 : Symbol(interfaceType1Object2, Decl(escapedIdentifiers.ts, 61, 3))
|
||||
>interfaceType\u0031 : Symbol(interfaceType1, Decl(escapedIdentifiers.ts, 49, 27))
|
||||
>bar1 : Symbol(bar1, Decl(escapedIdentifiers.ts, 61, 50))
|
||||
|
||||
interfaceType1Object2.bar1 = 2;
|
||||
>interfaceType1Object2.bar1 : Symbol(interfaceType1.bar1, Decl(escapedIdentifiers.ts, 52, 26))
|
||||
>interfaceType1Object2 : Symbol(interfaceType1Object2, Decl(escapedIdentifiers.ts, 61, 3))
|
||||
>bar1 : Symbol(interfaceType1.bar1, Decl(escapedIdentifiers.ts, 52, 26))
|
||||
|
||||
var interfaceType2Object1 = <interfaceType2>{ bar2: 0 };
|
||||
>interfaceType2Object1 : Symbol(interfaceType2Object1, Decl(escapedIdentifiers.ts, 63, 3))
|
||||
>interfaceType2 : Symbol(interfaceType\u0032, Decl(escapedIdentifiers.ts, 54, 1))
|
||||
>bar2 : Symbol(bar2, Decl(escapedIdentifiers.ts, 63, 45))
|
||||
|
||||
interfaceType2Object1.bar2 = 2;
|
||||
>interfaceType2Object1.bar2 : Symbol(interfaceType\u0032.bar2, Decl(escapedIdentifiers.ts, 55, 31))
|
||||
>interfaceType2Object1 : Symbol(interfaceType2Object1, Decl(escapedIdentifiers.ts, 63, 3))
|
||||
>bar2 : Symbol(interfaceType\u0032.bar2, Decl(escapedIdentifiers.ts, 55, 31))
|
||||
|
||||
var interfaceType2Object2 = <interfaceType\u0032>{ bar2: 0 };
|
||||
>interfaceType2Object2 : Symbol(interfaceType2Object2, Decl(escapedIdentifiers.ts, 65, 3))
|
||||
>interfaceType\u0032 : Symbol(interfaceType\u0032, Decl(escapedIdentifiers.ts, 54, 1))
|
||||
>bar2 : Symbol(bar2, Decl(escapedIdentifiers.ts, 65, 50))
|
||||
|
||||
interfaceType2Object2.bar2 = 2;
|
||||
>interfaceType2Object2.bar2 : Symbol(interfaceType\u0032.bar2, Decl(escapedIdentifiers.ts, 55, 31))
|
||||
>interfaceType2Object2 : Symbol(interfaceType2Object2, Decl(escapedIdentifiers.ts, 65, 3))
|
||||
>bar2 : Symbol(interfaceType\u0032.bar2, Decl(escapedIdentifiers.ts, 55, 31))
|
||||
|
||||
|
||||
// arguments
|
||||
class testClass {
|
||||
>testClass : Symbol(testClass, Decl(escapedIdentifiers.ts, 66, 31))
|
||||
|
||||
public func(arg1: number, arg\u0032: string, arg\u0033: boolean, arg4: number) {
|
||||
>func : Symbol(func, Decl(escapedIdentifiers.ts, 70, 17))
|
||||
>arg1 : Symbol(arg1, Decl(escapedIdentifiers.ts, 71, 16))
|
||||
>arg\u0032 : Symbol(arg\u0032, Decl(escapedIdentifiers.ts, 71, 29))
|
||||
>arg\u0033 : Symbol(arg\u0033, Decl(escapedIdentifiers.ts, 71, 48))
|
||||
>arg4 : Symbol(arg4, Decl(escapedIdentifiers.ts, 71, 68))
|
||||
|
||||
arg\u0031 = 1;
|
||||
>arg\u0031 : Symbol(arg1, Decl(escapedIdentifiers.ts, 71, 16))
|
||||
|
||||
arg2 = 'string';
|
||||
>arg2 : Symbol(arg\u0032, Decl(escapedIdentifiers.ts, 71, 29))
|
||||
|
||||
arg\u0033 = true;
|
||||
>arg\u0033 : Symbol(arg\u0033, Decl(escapedIdentifiers.ts, 71, 48))
|
||||
|
||||
arg4 = 2;
|
||||
>arg4 : Symbol(arg4, Decl(escapedIdentifiers.ts, 71, 68))
|
||||
}
|
||||
}
|
||||
|
||||
// constructors
|
||||
class constructorTestClass {
|
||||
>constructorTestClass : Symbol(constructorTestClass, Decl(escapedIdentifiers.ts, 77, 1))
|
||||
|
||||
constructor (public arg1: number,public arg\u0032: string,public arg\u0033: boolean,public arg4: number) {
|
||||
>arg1 : Symbol(arg1, Decl(escapedIdentifiers.ts, 81, 17))
|
||||
>arg\u0032 : Symbol(arg\u0032, Decl(escapedIdentifiers.ts, 81, 37))
|
||||
>arg\u0033 : Symbol(arg\u0033, Decl(escapedIdentifiers.ts, 81, 62))
|
||||
>arg4 : Symbol(arg4, Decl(escapedIdentifiers.ts, 81, 88))
|
||||
}
|
||||
}
|
||||
var constructorTestObject = new constructorTestClass(1, 'string', true, 2);
|
||||
>constructorTestObject : Symbol(constructorTestObject, Decl(escapedIdentifiers.ts, 84, 3))
|
||||
>constructorTestClass : Symbol(constructorTestClass, Decl(escapedIdentifiers.ts, 77, 1))
|
||||
|
||||
constructorTestObject.arg\u0031 = 1;
|
||||
>constructorTestObject.arg\u0031 : Symbol(constructorTestClass.arg1, Decl(escapedIdentifiers.ts, 81, 17))
|
||||
>constructorTestObject : Symbol(constructorTestObject, Decl(escapedIdentifiers.ts, 84, 3))
|
||||
>arg\u0031 : Symbol(constructorTestClass.arg1, Decl(escapedIdentifiers.ts, 81, 17))
|
||||
|
||||
constructorTestObject.arg2 = 'string';
|
||||
>constructorTestObject.arg2 : Symbol(constructorTestClass.arg\u0032, Decl(escapedIdentifiers.ts, 81, 37))
|
||||
>constructorTestObject : Symbol(constructorTestObject, Decl(escapedIdentifiers.ts, 84, 3))
|
||||
>arg2 : Symbol(constructorTestClass.arg\u0032, Decl(escapedIdentifiers.ts, 81, 37))
|
||||
|
||||
constructorTestObject.arg\u0033 = true;
|
||||
>constructorTestObject.arg\u0033 : Symbol(constructorTestClass.arg\u0033, Decl(escapedIdentifiers.ts, 81, 62))
|
||||
>constructorTestObject : Symbol(constructorTestObject, Decl(escapedIdentifiers.ts, 84, 3))
|
||||
>arg\u0033 : Symbol(constructorTestClass.arg\u0033, Decl(escapedIdentifiers.ts, 81, 62))
|
||||
|
||||
constructorTestObject.arg4 = 2;
|
||||
>constructorTestObject.arg4 : Symbol(constructorTestClass.arg4, Decl(escapedIdentifiers.ts, 81, 88))
|
||||
>constructorTestObject : Symbol(constructorTestObject, Decl(escapedIdentifiers.ts, 84, 3))
|
||||
>arg4 : Symbol(constructorTestClass.arg4, Decl(escapedIdentifiers.ts, 81, 88))
|
||||
|
||||
// Lables
|
||||
|
||||
l\u0061bel1:
|
||||
while (false)
|
||||
{
|
||||
while(false)
|
||||
continue label1; // it will go to next iteration of outer loop
|
||||
}
|
||||
|
||||
label2:
|
||||
while (false)
|
||||
{
|
||||
while(false)
|
||||
continue l\u0061bel2; // it will go to next iteration of outer loop
|
||||
}
|
||||
|
||||
label3:
|
||||
while (false)
|
||||
{
|
||||
while(false)
|
||||
continue label3; // it will go to next iteration of outer loop
|
||||
}
|
||||
|
||||
l\u0061bel4:
|
||||
while (false)
|
||||
{
|
||||
while(false)
|
||||
continue l\u0061bel4; // it will go to next iteration of outer loop
|
||||
}
|
||||
@ -1,351 +0,0 @@
|
||||
=== tests/cases/compiler/escapedIdentifiers.ts ===
|
||||
/*
|
||||
0 .. \u0030
|
||||
9 .. \u0039
|
||||
|
||||
A .. \u0041
|
||||
Z .. \u005a
|
||||
|
||||
a .. \u0061
|
||||
z .. \u00za
|
||||
*/
|
||||
|
||||
// var decl
|
||||
var \u0061 = 1;
|
||||
>\u0061 : number
|
||||
>1 : number
|
||||
|
||||
a ++;
|
||||
>a ++ : number
|
||||
>a : number
|
||||
|
||||
\u0061 ++;
|
||||
>\u0061 ++ : number
|
||||
>\u0061 : number
|
||||
|
||||
var b = 1;
|
||||
>b : number
|
||||
>1 : number
|
||||
|
||||
b ++;
|
||||
>b ++ : number
|
||||
>b : number
|
||||
|
||||
\u0062 ++;
|
||||
>\u0062 ++ : number
|
||||
>\u0062 : number
|
||||
|
||||
// modules
|
||||
module moduleType1 {
|
||||
>moduleType1 : typeof moduleType1
|
||||
|
||||
export var baz1: number;
|
||||
>baz1 : number
|
||||
}
|
||||
module moduleType\u0032 {
|
||||
>moduleType\u0032 : typeof moduleType\u0032
|
||||
|
||||
export var baz2: number;
|
||||
>baz2 : number
|
||||
}
|
||||
|
||||
moduleType1.baz1 = 3;
|
||||
>moduleType1.baz1 = 3 : number
|
||||
>moduleType1.baz1 : number
|
||||
>moduleType1 : typeof moduleType1
|
||||
>baz1 : number
|
||||
>3 : number
|
||||
|
||||
moduleType\u0031.baz1 = 3;
|
||||
>moduleType\u0031.baz1 = 3 : number
|
||||
>moduleType\u0031.baz1 : number
|
||||
>moduleType\u0031 : typeof moduleType1
|
||||
>baz1 : number
|
||||
>3 : number
|
||||
|
||||
moduleType2.baz2 = 3;
|
||||
>moduleType2.baz2 = 3 : number
|
||||
>moduleType2.baz2 : number
|
||||
>moduleType2 : typeof moduleType\u0032
|
||||
>baz2 : number
|
||||
>3 : number
|
||||
|
||||
moduleType\u0032.baz2 = 3;
|
||||
>moduleType\u0032.baz2 = 3 : number
|
||||
>moduleType\u0032.baz2 : number
|
||||
>moduleType\u0032 : typeof moduleType\u0032
|
||||
>baz2 : number
|
||||
>3 : number
|
||||
|
||||
// classes
|
||||
|
||||
class classType1 {
|
||||
>classType1 : classType1
|
||||
|
||||
public foo1: number;
|
||||
>foo1 : number
|
||||
}
|
||||
class classType\u0032 {
|
||||
>classType\u0032 : classType\u0032
|
||||
|
||||
public foo2: number;
|
||||
>foo2 : number
|
||||
}
|
||||
|
||||
var classType1Object1 = new classType1();
|
||||
>classType1Object1 : classType1
|
||||
>new classType1() : classType1
|
||||
>classType1 : typeof classType1
|
||||
|
||||
classType1Object1.foo1 = 2;
|
||||
>classType1Object1.foo1 = 2 : number
|
||||
>classType1Object1.foo1 : number
|
||||
>classType1Object1 : classType1
|
||||
>foo1 : number
|
||||
>2 : number
|
||||
|
||||
var classType1Object2 = new classType\u0031();
|
||||
>classType1Object2 : classType1
|
||||
>new classType\u0031() : classType1
|
||||
>classType\u0031 : typeof classType1
|
||||
|
||||
classType1Object2.foo1 = 2;
|
||||
>classType1Object2.foo1 = 2 : number
|
||||
>classType1Object2.foo1 : number
|
||||
>classType1Object2 : classType1
|
||||
>foo1 : number
|
||||
>2 : number
|
||||
|
||||
var classType2Object1 = new classType2();
|
||||
>classType2Object1 : classType\u0032
|
||||
>new classType2() : classType\u0032
|
||||
>classType2 : typeof classType\u0032
|
||||
|
||||
classType2Object1.foo2 = 2;
|
||||
>classType2Object1.foo2 = 2 : number
|
||||
>classType2Object1.foo2 : number
|
||||
>classType2Object1 : classType\u0032
|
||||
>foo2 : number
|
||||
>2 : number
|
||||
|
||||
var classType2Object2 = new classType\u0032();
|
||||
>classType2Object2 : classType\u0032
|
||||
>new classType\u0032() : classType\u0032
|
||||
>classType\u0032 : typeof classType\u0032
|
||||
|
||||
classType2Object2.foo2 = 2;
|
||||
>classType2Object2.foo2 = 2 : number
|
||||
>classType2Object2.foo2 : number
|
||||
>classType2Object2 : classType\u0032
|
||||
>foo2 : number
|
||||
>2 : number
|
||||
|
||||
// interfaces
|
||||
interface interfaceType1 {
|
||||
>interfaceType1 : interfaceType1
|
||||
|
||||
bar1: number;
|
||||
>bar1 : number
|
||||
}
|
||||
interface interfaceType\u0032 {
|
||||
>interfaceType\u0032 : interfaceType\u0032
|
||||
|
||||
bar2: number;
|
||||
>bar2 : number
|
||||
}
|
||||
|
||||
var interfaceType1Object1 = <interfaceType1>{ bar1: 0 };
|
||||
>interfaceType1Object1 : interfaceType1
|
||||
><interfaceType1>{ bar1: 0 } : interfaceType1
|
||||
>interfaceType1 : interfaceType1
|
||||
>{ bar1: 0 } : { bar1: number; }
|
||||
>bar1 : number
|
||||
>0 : number
|
||||
|
||||
interfaceType1Object1.bar1 = 2;
|
||||
>interfaceType1Object1.bar1 = 2 : number
|
||||
>interfaceType1Object1.bar1 : number
|
||||
>interfaceType1Object1 : interfaceType1
|
||||
>bar1 : number
|
||||
>2 : number
|
||||
|
||||
var interfaceType1Object2 = <interfaceType\u0031>{ bar1: 0 };
|
||||
>interfaceType1Object2 : interfaceType1
|
||||
><interfaceType\u0031>{ bar1: 0 } : interfaceType1
|
||||
>interfaceType\u0031 : interfaceType1
|
||||
>{ bar1: 0 } : { bar1: number; }
|
||||
>bar1 : number
|
||||
>0 : number
|
||||
|
||||
interfaceType1Object2.bar1 = 2;
|
||||
>interfaceType1Object2.bar1 = 2 : number
|
||||
>interfaceType1Object2.bar1 : number
|
||||
>interfaceType1Object2 : interfaceType1
|
||||
>bar1 : number
|
||||
>2 : number
|
||||
|
||||
var interfaceType2Object1 = <interfaceType2>{ bar2: 0 };
|
||||
>interfaceType2Object1 : interfaceType\u0032
|
||||
><interfaceType2>{ bar2: 0 } : interfaceType\u0032
|
||||
>interfaceType2 : interfaceType\u0032
|
||||
>{ bar2: 0 } : { bar2: number; }
|
||||
>bar2 : number
|
||||
>0 : number
|
||||
|
||||
interfaceType2Object1.bar2 = 2;
|
||||
>interfaceType2Object1.bar2 = 2 : number
|
||||
>interfaceType2Object1.bar2 : number
|
||||
>interfaceType2Object1 : interfaceType\u0032
|
||||
>bar2 : number
|
||||
>2 : number
|
||||
|
||||
var interfaceType2Object2 = <interfaceType\u0032>{ bar2: 0 };
|
||||
>interfaceType2Object2 : interfaceType\u0032
|
||||
><interfaceType\u0032>{ bar2: 0 } : interfaceType\u0032
|
||||
>interfaceType\u0032 : interfaceType\u0032
|
||||
>{ bar2: 0 } : { bar2: number; }
|
||||
>bar2 : number
|
||||
>0 : number
|
||||
|
||||
interfaceType2Object2.bar2 = 2;
|
||||
>interfaceType2Object2.bar2 = 2 : number
|
||||
>interfaceType2Object2.bar2 : number
|
||||
>interfaceType2Object2 : interfaceType\u0032
|
||||
>bar2 : number
|
||||
>2 : number
|
||||
|
||||
|
||||
// arguments
|
||||
class testClass {
|
||||
>testClass : testClass
|
||||
|
||||
public func(arg1: number, arg\u0032: string, arg\u0033: boolean, arg4: number) {
|
||||
>func : (arg1: number, arg\u0032: string, arg\u0033: boolean, arg4: number) => void
|
||||
>arg1 : number
|
||||
>arg\u0032 : string
|
||||
>arg\u0033 : boolean
|
||||
>arg4 : number
|
||||
|
||||
arg\u0031 = 1;
|
||||
>arg\u0031 = 1 : number
|
||||
>arg\u0031 : number
|
||||
>1 : number
|
||||
|
||||
arg2 = 'string';
|
||||
>arg2 = 'string' : string
|
||||
>arg2 : string
|
||||
>'string' : string
|
||||
|
||||
arg\u0033 = true;
|
||||
>arg\u0033 = true : boolean
|
||||
>arg\u0033 : boolean
|
||||
>true : boolean
|
||||
|
||||
arg4 = 2;
|
||||
>arg4 = 2 : number
|
||||
>arg4 : number
|
||||
>2 : number
|
||||
}
|
||||
}
|
||||
|
||||
// constructors
|
||||
class constructorTestClass {
|
||||
>constructorTestClass : constructorTestClass
|
||||
|
||||
constructor (public arg1: number,public arg\u0032: string,public arg\u0033: boolean,public arg4: number) {
|
||||
>arg1 : number
|
||||
>arg\u0032 : string
|
||||
>arg\u0033 : boolean
|
||||
>arg4 : number
|
||||
}
|
||||
}
|
||||
var constructorTestObject = new constructorTestClass(1, 'string', true, 2);
|
||||
>constructorTestObject : constructorTestClass
|
||||
>new constructorTestClass(1, 'string', true, 2) : constructorTestClass
|
||||
>constructorTestClass : typeof constructorTestClass
|
||||
>1 : number
|
||||
>'string' : string
|
||||
>true : boolean
|
||||
>2 : number
|
||||
|
||||
constructorTestObject.arg\u0031 = 1;
|
||||
>constructorTestObject.arg\u0031 = 1 : number
|
||||
>constructorTestObject.arg\u0031 : number
|
||||
>constructorTestObject : constructorTestClass
|
||||
>arg\u0031 : number
|
||||
>1 : number
|
||||
|
||||
constructorTestObject.arg2 = 'string';
|
||||
>constructorTestObject.arg2 = 'string' : string
|
||||
>constructorTestObject.arg2 : string
|
||||
>constructorTestObject : constructorTestClass
|
||||
>arg2 : string
|
||||
>'string' : string
|
||||
|
||||
constructorTestObject.arg\u0033 = true;
|
||||
>constructorTestObject.arg\u0033 = true : boolean
|
||||
>constructorTestObject.arg\u0033 : boolean
|
||||
>constructorTestObject : constructorTestClass
|
||||
>arg\u0033 : boolean
|
||||
>true : boolean
|
||||
|
||||
constructorTestObject.arg4 = 2;
|
||||
>constructorTestObject.arg4 = 2 : number
|
||||
>constructorTestObject.arg4 : number
|
||||
>constructorTestObject : constructorTestClass
|
||||
>arg4 : number
|
||||
>2 : number
|
||||
|
||||
// Lables
|
||||
|
||||
l\u0061bel1:
|
||||
>l\u0061bel1 : any
|
||||
|
||||
while (false)
|
||||
>false : boolean
|
||||
{
|
||||
while(false)
|
||||
>false : boolean
|
||||
|
||||
continue label1; // it will go to next iteration of outer loop
|
||||
>label1 : any
|
||||
}
|
||||
|
||||
label2:
|
||||
>label2 : any
|
||||
|
||||
while (false)
|
||||
>false : boolean
|
||||
{
|
||||
while(false)
|
||||
>false : boolean
|
||||
|
||||
continue l\u0061bel2; // it will go to next iteration of outer loop
|
||||
>l\u0061bel2 : any
|
||||
}
|
||||
|
||||
label3:
|
||||
>label3 : any
|
||||
|
||||
while (false)
|
||||
>false : boolean
|
||||
{
|
||||
while(false)
|
||||
>false : boolean
|
||||
|
||||
continue label3; // it will go to next iteration of outer loop
|
||||
>label3 : any
|
||||
}
|
||||
|
||||
l\u0061bel4:
|
||||
>l\u0061bel4 : any
|
||||
|
||||
while (false)
|
||||
>false : boolean
|
||||
{
|
||||
while(false)
|
||||
>false : boolean
|
||||
|
||||
continue l\u0061bel4; // it will go to next iteration of outer loop
|
||||
>l\u0061bel4 : any
|
||||
}
|
||||
@ -1,7 +1,8 @@
|
||||
tests/cases/compiler/for.ts(29,1): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/for.ts(29,6): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/for.ts (1 errors) ====
|
||||
==== tests/cases/compiler/for.ts (2 errors) ====
|
||||
for (var i = 0; i < 10; i++) { // ok
|
||||
var x1 = i;
|
||||
}
|
||||
@ -31,6 +32,8 @@ tests/cases/compiler/for.ts(29,6): error TS1109: Expression expected.
|
||||
}
|
||||
|
||||
for () { // error
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
||||
49
tests/baselines/reference/forBreakStatements.errors.txt
Normal file
49
tests/baselines/reference/forBreakStatements.errors.txt
Normal file
@ -0,0 +1,49 @@
|
||||
tests/cases/conformance/statements/breakStatements/forBreakStatements.ts(10,1): error TS7028: Unused label.
|
||||
tests/cases/conformance/statements/breakStatements/forBreakStatements.ts(18,5): error TS7028: Unused label.
|
||||
tests/cases/conformance/statements/breakStatements/forBreakStatements.ts(29,1): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/breakStatements/forBreakStatements.ts (3 errors) ====
|
||||
for (; ;) {
|
||||
break;
|
||||
}
|
||||
|
||||
ONE:
|
||||
for (; ;) {
|
||||
break ONE;
|
||||
}
|
||||
|
||||
TWO:
|
||||
~~~
|
||||
!!! error TS7028: Unused label.
|
||||
THREE:
|
||||
for (; ;) {
|
||||
break THREE;
|
||||
}
|
||||
|
||||
FOUR:
|
||||
for (; ;) {
|
||||
FIVE:
|
||||
~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
for (; ;) {
|
||||
break FOUR;
|
||||
}
|
||||
}
|
||||
|
||||
for (; ;) {
|
||||
SIX:
|
||||
for (; ;) break SIX;
|
||||
}
|
||||
|
||||
SEVEN:
|
||||
~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
for (; ;) for (; ;) for (; ;) break SEVEN;
|
||||
|
||||
EIGHT:
|
||||
for (; ;) {
|
||||
var fn = function () { }
|
||||
break EIGHT;
|
||||
}
|
||||
|
||||
@ -1,40 +0,0 @@
|
||||
=== tests/cases/conformance/statements/breakStatements/forBreakStatements.ts ===
|
||||
for (; ;) {
|
||||
break;
|
||||
}
|
||||
|
||||
ONE:
|
||||
for (; ;) {
|
||||
break ONE;
|
||||
}
|
||||
|
||||
TWO:
|
||||
THREE:
|
||||
for (; ;) {
|
||||
break THREE;
|
||||
}
|
||||
|
||||
FOUR:
|
||||
for (; ;) {
|
||||
FIVE:
|
||||
for (; ;) {
|
||||
break FOUR;
|
||||
}
|
||||
}
|
||||
|
||||
for (; ;) {
|
||||
SIX:
|
||||
for (; ;) break SIX;
|
||||
}
|
||||
|
||||
SEVEN:
|
||||
for (; ;) for (; ;) for (; ;) break SEVEN;
|
||||
|
||||
EIGHT:
|
||||
for (; ;) {
|
||||
var fn = function () { }
|
||||
>fn : Symbol(fn, Decl(forBreakStatements.ts, 33, 7))
|
||||
|
||||
break EIGHT;
|
||||
}
|
||||
|
||||
@ -1,63 +0,0 @@
|
||||
=== tests/cases/conformance/statements/breakStatements/forBreakStatements.ts ===
|
||||
for (; ;) {
|
||||
break;
|
||||
}
|
||||
|
||||
ONE:
|
||||
>ONE : any
|
||||
|
||||
for (; ;) {
|
||||
break ONE;
|
||||
>ONE : any
|
||||
}
|
||||
|
||||
TWO:
|
||||
>TWO : any
|
||||
|
||||
THREE:
|
||||
>THREE : any
|
||||
|
||||
for (; ;) {
|
||||
break THREE;
|
||||
>THREE : any
|
||||
}
|
||||
|
||||
FOUR:
|
||||
>FOUR : any
|
||||
|
||||
for (; ;) {
|
||||
FIVE:
|
||||
>FIVE : any
|
||||
|
||||
for (; ;) {
|
||||
break FOUR;
|
||||
>FOUR : any
|
||||
}
|
||||
}
|
||||
|
||||
for (; ;) {
|
||||
SIX:
|
||||
>SIX : any
|
||||
|
||||
for (; ;) break SIX;
|
||||
>SIX : any
|
||||
}
|
||||
|
||||
SEVEN:
|
||||
>SEVEN : any
|
||||
|
||||
for (; ;) for (; ;) for (; ;) break SEVEN;
|
||||
>SEVEN : any
|
||||
|
||||
EIGHT:
|
||||
>EIGHT : any
|
||||
|
||||
for (; ;) {
|
||||
var fn = function () { }
|
||||
>fn : () => void
|
||||
>function () { } : () => void
|
||||
|
||||
break EIGHT;
|
||||
>EIGHT : any
|
||||
}
|
||||
|
||||
43
tests/baselines/reference/forContinueStatements.errors.txt
Normal file
43
tests/baselines/reference/forContinueStatements.errors.txt
Normal file
@ -0,0 +1,43 @@
|
||||
tests/cases/conformance/statements/continueStatements/forContinueStatements.ts(5,1): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/continueStatements/forContinueStatements.ts (1 errors) ====
|
||||
for (; ;) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ONE:
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
for (; ;) {
|
||||
continue ONE;
|
||||
}
|
||||
|
||||
TWO:
|
||||
THREE:
|
||||
for (; ;) {
|
||||
continue THREE;
|
||||
}
|
||||
|
||||
FOUR:
|
||||
for (; ;) {
|
||||
FIVE:
|
||||
for (; ;) {
|
||||
continue FOUR;
|
||||
}
|
||||
}
|
||||
|
||||
for (; ;) {
|
||||
SIX:
|
||||
for (; ;) continue SIX;
|
||||
}
|
||||
|
||||
SEVEN:
|
||||
for (; ;) for (; ;) for (; ;) continue SEVEN;
|
||||
|
||||
EIGHT:
|
||||
for (; ;) {
|
||||
var fn = function () { }
|
||||
continue EIGHT;
|
||||
}
|
||||
|
||||
@ -1,40 +0,0 @@
|
||||
=== tests/cases/conformance/statements/continueStatements/forContinueStatements.ts ===
|
||||
for (; ;) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ONE:
|
||||
for (; ;) {
|
||||
continue ONE;
|
||||
}
|
||||
|
||||
TWO:
|
||||
THREE:
|
||||
for (; ;) {
|
||||
continue THREE;
|
||||
}
|
||||
|
||||
FOUR:
|
||||
for (; ;) {
|
||||
FIVE:
|
||||
for (; ;) {
|
||||
continue FOUR;
|
||||
}
|
||||
}
|
||||
|
||||
for (; ;) {
|
||||
SIX:
|
||||
for (; ;) continue SIX;
|
||||
}
|
||||
|
||||
SEVEN:
|
||||
for (; ;) for (; ;) for (; ;) continue SEVEN;
|
||||
|
||||
EIGHT:
|
||||
for (; ;) {
|
||||
var fn = function () { }
|
||||
>fn : Symbol(fn, Decl(forContinueStatements.ts, 33, 7))
|
||||
|
||||
continue EIGHT;
|
||||
}
|
||||
|
||||
@ -1,63 +0,0 @@
|
||||
=== tests/cases/conformance/statements/continueStatements/forContinueStatements.ts ===
|
||||
for (; ;) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ONE:
|
||||
>ONE : any
|
||||
|
||||
for (; ;) {
|
||||
continue ONE;
|
||||
>ONE : any
|
||||
}
|
||||
|
||||
TWO:
|
||||
>TWO : any
|
||||
|
||||
THREE:
|
||||
>THREE : any
|
||||
|
||||
for (; ;) {
|
||||
continue THREE;
|
||||
>THREE : any
|
||||
}
|
||||
|
||||
FOUR:
|
||||
>FOUR : any
|
||||
|
||||
for (; ;) {
|
||||
FIVE:
|
||||
>FIVE : any
|
||||
|
||||
for (; ;) {
|
||||
continue FOUR;
|
||||
>FOUR : any
|
||||
}
|
||||
}
|
||||
|
||||
for (; ;) {
|
||||
SIX:
|
||||
>SIX : any
|
||||
|
||||
for (; ;) continue SIX;
|
||||
>SIX : any
|
||||
}
|
||||
|
||||
SEVEN:
|
||||
>SEVEN : any
|
||||
|
||||
for (; ;) for (; ;) for (; ;) continue SEVEN;
|
||||
>SEVEN : any
|
||||
|
||||
EIGHT:
|
||||
>EIGHT : any
|
||||
|
||||
for (; ;) {
|
||||
var fn = function () { }
|
||||
>fn : () => void
|
||||
>function () { } : () => void
|
||||
|
||||
continue EIGHT;
|
||||
>EIGHT : any
|
||||
}
|
||||
|
||||
46
tests/baselines/reference/forInBreakStatements.errors.txt
Normal file
46
tests/baselines/reference/forInBreakStatements.errors.txt
Normal file
@ -0,0 +1,46 @@
|
||||
tests/cases/conformance/statements/breakStatements/forInBreakStatements.ts(10,1): error TS7028: Unused label.
|
||||
tests/cases/conformance/statements/breakStatements/forInBreakStatements.ts(18,5): error TS7028: Unused label.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/breakStatements/forInBreakStatements.ts (2 errors) ====
|
||||
for(var x in {}) {
|
||||
break;
|
||||
}
|
||||
|
||||
ONE:
|
||||
for(var x in {}) {
|
||||
break ONE;
|
||||
}
|
||||
|
||||
TWO:
|
||||
~~~
|
||||
!!! error TS7028: Unused label.
|
||||
THREE:
|
||||
for(var x in {}) {
|
||||
break THREE;
|
||||
}
|
||||
|
||||
FOUR:
|
||||
for(var x in {}) {
|
||||
FIVE:
|
||||
~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
for(var x in {}) {
|
||||
break FOUR;
|
||||
}
|
||||
}
|
||||
|
||||
for(var x in {}) {
|
||||
SIX:
|
||||
for(var x in {}) break SIX;
|
||||
}
|
||||
|
||||
SEVEN:
|
||||
for (var x in {}) for (var x in {}) for (var x in {}) break SEVEN;
|
||||
|
||||
EIGHT:
|
||||
for (var x in {}){
|
||||
var fn = function () { }
|
||||
break EIGHT;
|
||||
}
|
||||
|
||||
@ -1,58 +0,0 @@
|
||||
=== tests/cases/conformance/statements/breakStatements/forInBreakStatements.ts ===
|
||||
for(var x in {}) {
|
||||
>x : Symbol(x, Decl(forInBreakStatements.ts, 0, 7), Decl(forInBreakStatements.ts, 5, 7), Decl(forInBreakStatements.ts, 11, 7), Decl(forInBreakStatements.ts, 16, 7), Decl(forInBreakStatements.ts, 18, 11), Decl(forInBreakStatements.ts, 23, 7), Decl(forInBreakStatements.ts, 25, 11), Decl(forInBreakStatements.ts, 29, 8), Decl(forInBreakStatements.ts, 29, 26), Decl(forInBreakStatements.ts, 29, 44), Decl(forInBreakStatements.ts, 32, 8))
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
ONE:
|
||||
for(var x in {}) {
|
||||
>x : Symbol(x, Decl(forInBreakStatements.ts, 0, 7), Decl(forInBreakStatements.ts, 5, 7), Decl(forInBreakStatements.ts, 11, 7), Decl(forInBreakStatements.ts, 16, 7), Decl(forInBreakStatements.ts, 18, 11), Decl(forInBreakStatements.ts, 23, 7), Decl(forInBreakStatements.ts, 25, 11), Decl(forInBreakStatements.ts, 29, 8), Decl(forInBreakStatements.ts, 29, 26), Decl(forInBreakStatements.ts, 29, 44), Decl(forInBreakStatements.ts, 32, 8))
|
||||
|
||||
break ONE;
|
||||
}
|
||||
|
||||
TWO:
|
||||
THREE:
|
||||
for(var x in {}) {
|
||||
>x : Symbol(x, Decl(forInBreakStatements.ts, 0, 7), Decl(forInBreakStatements.ts, 5, 7), Decl(forInBreakStatements.ts, 11, 7), Decl(forInBreakStatements.ts, 16, 7), Decl(forInBreakStatements.ts, 18, 11), Decl(forInBreakStatements.ts, 23, 7), Decl(forInBreakStatements.ts, 25, 11), Decl(forInBreakStatements.ts, 29, 8), Decl(forInBreakStatements.ts, 29, 26), Decl(forInBreakStatements.ts, 29, 44), Decl(forInBreakStatements.ts, 32, 8))
|
||||
|
||||
break THREE;
|
||||
}
|
||||
|
||||
FOUR:
|
||||
for(var x in {}) {
|
||||
>x : Symbol(x, Decl(forInBreakStatements.ts, 0, 7), Decl(forInBreakStatements.ts, 5, 7), Decl(forInBreakStatements.ts, 11, 7), Decl(forInBreakStatements.ts, 16, 7), Decl(forInBreakStatements.ts, 18, 11), Decl(forInBreakStatements.ts, 23, 7), Decl(forInBreakStatements.ts, 25, 11), Decl(forInBreakStatements.ts, 29, 8), Decl(forInBreakStatements.ts, 29, 26), Decl(forInBreakStatements.ts, 29, 44), Decl(forInBreakStatements.ts, 32, 8))
|
||||
|
||||
FIVE:
|
||||
for(var x in {}) {
|
||||
>x : Symbol(x, Decl(forInBreakStatements.ts, 0, 7), Decl(forInBreakStatements.ts, 5, 7), Decl(forInBreakStatements.ts, 11, 7), Decl(forInBreakStatements.ts, 16, 7), Decl(forInBreakStatements.ts, 18, 11), Decl(forInBreakStatements.ts, 23, 7), Decl(forInBreakStatements.ts, 25, 11), Decl(forInBreakStatements.ts, 29, 8), Decl(forInBreakStatements.ts, 29, 26), Decl(forInBreakStatements.ts, 29, 44), Decl(forInBreakStatements.ts, 32, 8))
|
||||
|
||||
break FOUR;
|
||||
}
|
||||
}
|
||||
|
||||
for(var x in {}) {
|
||||
>x : Symbol(x, Decl(forInBreakStatements.ts, 0, 7), Decl(forInBreakStatements.ts, 5, 7), Decl(forInBreakStatements.ts, 11, 7), Decl(forInBreakStatements.ts, 16, 7), Decl(forInBreakStatements.ts, 18, 11), Decl(forInBreakStatements.ts, 23, 7), Decl(forInBreakStatements.ts, 25, 11), Decl(forInBreakStatements.ts, 29, 8), Decl(forInBreakStatements.ts, 29, 26), Decl(forInBreakStatements.ts, 29, 44), Decl(forInBreakStatements.ts, 32, 8))
|
||||
|
||||
SIX:
|
||||
for(var x in {}) break SIX;
|
||||
>x : Symbol(x, Decl(forInBreakStatements.ts, 0, 7), Decl(forInBreakStatements.ts, 5, 7), Decl(forInBreakStatements.ts, 11, 7), Decl(forInBreakStatements.ts, 16, 7), Decl(forInBreakStatements.ts, 18, 11), Decl(forInBreakStatements.ts, 23, 7), Decl(forInBreakStatements.ts, 25, 11), Decl(forInBreakStatements.ts, 29, 8), Decl(forInBreakStatements.ts, 29, 26), Decl(forInBreakStatements.ts, 29, 44), Decl(forInBreakStatements.ts, 32, 8))
|
||||
}
|
||||
|
||||
SEVEN:
|
||||
for (var x in {}) for (var x in {}) for (var x in {}) break SEVEN;
|
||||
>x : Symbol(x, Decl(forInBreakStatements.ts, 0, 7), Decl(forInBreakStatements.ts, 5, 7), Decl(forInBreakStatements.ts, 11, 7), Decl(forInBreakStatements.ts, 16, 7), Decl(forInBreakStatements.ts, 18, 11), Decl(forInBreakStatements.ts, 23, 7), Decl(forInBreakStatements.ts, 25, 11), Decl(forInBreakStatements.ts, 29, 8), Decl(forInBreakStatements.ts, 29, 26), Decl(forInBreakStatements.ts, 29, 44), Decl(forInBreakStatements.ts, 32, 8))
|
||||
>x : Symbol(x, Decl(forInBreakStatements.ts, 0, 7), Decl(forInBreakStatements.ts, 5, 7), Decl(forInBreakStatements.ts, 11, 7), Decl(forInBreakStatements.ts, 16, 7), Decl(forInBreakStatements.ts, 18, 11), Decl(forInBreakStatements.ts, 23, 7), Decl(forInBreakStatements.ts, 25, 11), Decl(forInBreakStatements.ts, 29, 8), Decl(forInBreakStatements.ts, 29, 26), Decl(forInBreakStatements.ts, 29, 44), Decl(forInBreakStatements.ts, 32, 8))
|
||||
>x : Symbol(x, Decl(forInBreakStatements.ts, 0, 7), Decl(forInBreakStatements.ts, 5, 7), Decl(forInBreakStatements.ts, 11, 7), Decl(forInBreakStatements.ts, 16, 7), Decl(forInBreakStatements.ts, 18, 11), Decl(forInBreakStatements.ts, 23, 7), Decl(forInBreakStatements.ts, 25, 11), Decl(forInBreakStatements.ts, 29, 8), Decl(forInBreakStatements.ts, 29, 26), Decl(forInBreakStatements.ts, 29, 44), Decl(forInBreakStatements.ts, 32, 8))
|
||||
|
||||
EIGHT:
|
||||
for (var x in {}){
|
||||
>x : Symbol(x, Decl(forInBreakStatements.ts, 0, 7), Decl(forInBreakStatements.ts, 5, 7), Decl(forInBreakStatements.ts, 11, 7), Decl(forInBreakStatements.ts, 16, 7), Decl(forInBreakStatements.ts, 18, 11), Decl(forInBreakStatements.ts, 23, 7), Decl(forInBreakStatements.ts, 25, 11), Decl(forInBreakStatements.ts, 29, 8), Decl(forInBreakStatements.ts, 29, 26), Decl(forInBreakStatements.ts, 29, 44), Decl(forInBreakStatements.ts, 32, 8))
|
||||
|
||||
var fn = function () { }
|
||||
>fn : Symbol(fn, Decl(forInBreakStatements.ts, 33, 7))
|
||||
|
||||
break EIGHT;
|
||||
}
|
||||
|
||||
@ -1,92 +0,0 @@
|
||||
=== tests/cases/conformance/statements/breakStatements/forInBreakStatements.ts ===
|
||||
for(var x in {}) {
|
||||
>x : any
|
||||
>{} : {}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
ONE:
|
||||
>ONE : any
|
||||
|
||||
for(var x in {}) {
|
||||
>x : any
|
||||
>{} : {}
|
||||
|
||||
break ONE;
|
||||
>ONE : any
|
||||
}
|
||||
|
||||
TWO:
|
||||
>TWO : any
|
||||
|
||||
THREE:
|
||||
>THREE : any
|
||||
|
||||
for(var x in {}) {
|
||||
>x : any
|
||||
>{} : {}
|
||||
|
||||
break THREE;
|
||||
>THREE : any
|
||||
}
|
||||
|
||||
FOUR:
|
||||
>FOUR : any
|
||||
|
||||
for(var x in {}) {
|
||||
>x : any
|
||||
>{} : {}
|
||||
|
||||
FIVE:
|
||||
>FIVE : any
|
||||
|
||||
for(var x in {}) {
|
||||
>x : any
|
||||
>{} : {}
|
||||
|
||||
break FOUR;
|
||||
>FOUR : any
|
||||
}
|
||||
}
|
||||
|
||||
for(var x in {}) {
|
||||
>x : any
|
||||
>{} : {}
|
||||
|
||||
SIX:
|
||||
>SIX : any
|
||||
|
||||
for(var x in {}) break SIX;
|
||||
>x : any
|
||||
>{} : {}
|
||||
>SIX : any
|
||||
}
|
||||
|
||||
SEVEN:
|
||||
>SEVEN : any
|
||||
|
||||
for (var x in {}) for (var x in {}) for (var x in {}) break SEVEN;
|
||||
>x : any
|
||||
>{} : {}
|
||||
>x : any
|
||||
>{} : {}
|
||||
>x : any
|
||||
>{} : {}
|
||||
>SEVEN : any
|
||||
|
||||
EIGHT:
|
||||
>EIGHT : any
|
||||
|
||||
for (var x in {}){
|
||||
>x : any
|
||||
>{} : {}
|
||||
|
||||
var fn = function () { }
|
||||
>fn : () => void
|
||||
>function () { } : () => void
|
||||
|
||||
break EIGHT;
|
||||
>EIGHT : any
|
||||
}
|
||||
|
||||
46
tests/baselines/reference/forInContinueStatements.errors.txt
Normal file
46
tests/baselines/reference/forInContinueStatements.errors.txt
Normal file
@ -0,0 +1,46 @@
|
||||
tests/cases/conformance/statements/continueStatements/forInContinueStatements.ts(10,1): error TS7028: Unused label.
|
||||
tests/cases/conformance/statements/continueStatements/forInContinueStatements.ts(18,5): error TS7028: Unused label.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/continueStatements/forInContinueStatements.ts (2 errors) ====
|
||||
for(var x in {}) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ONE:
|
||||
for(var x in {}) {
|
||||
continue ONE;
|
||||
}
|
||||
|
||||
TWO:
|
||||
~~~
|
||||
!!! error TS7028: Unused label.
|
||||
THREE:
|
||||
for(var x in {}) {
|
||||
continue THREE;
|
||||
}
|
||||
|
||||
FOUR:
|
||||
for(var x in {}) {
|
||||
FIVE:
|
||||
~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
for(var x in {}) {
|
||||
continue FOUR;
|
||||
}
|
||||
}
|
||||
|
||||
for(var x in {}) {
|
||||
SIX:
|
||||
for(var x in {}) continue SIX;
|
||||
}
|
||||
|
||||
SEVEN:
|
||||
for (var x in {}) for (var x in {}) for (var x in {}) continue SEVEN;
|
||||
|
||||
EIGHT:
|
||||
for (var x in {}){
|
||||
var fn = function () { }
|
||||
continue EIGHT;
|
||||
}
|
||||
|
||||
@ -1,58 +0,0 @@
|
||||
=== tests/cases/conformance/statements/continueStatements/forInContinueStatements.ts ===
|
||||
for(var x in {}) {
|
||||
>x : Symbol(x, Decl(forInContinueStatements.ts, 0, 7), Decl(forInContinueStatements.ts, 5, 7), Decl(forInContinueStatements.ts, 11, 7), Decl(forInContinueStatements.ts, 16, 7), Decl(forInContinueStatements.ts, 18, 11), Decl(forInContinueStatements.ts, 23, 7), Decl(forInContinueStatements.ts, 25, 11), Decl(forInContinueStatements.ts, 29, 8), Decl(forInContinueStatements.ts, 29, 26), Decl(forInContinueStatements.ts, 29, 44), Decl(forInContinueStatements.ts, 32, 8))
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
ONE:
|
||||
for(var x in {}) {
|
||||
>x : Symbol(x, Decl(forInContinueStatements.ts, 0, 7), Decl(forInContinueStatements.ts, 5, 7), Decl(forInContinueStatements.ts, 11, 7), Decl(forInContinueStatements.ts, 16, 7), Decl(forInContinueStatements.ts, 18, 11), Decl(forInContinueStatements.ts, 23, 7), Decl(forInContinueStatements.ts, 25, 11), Decl(forInContinueStatements.ts, 29, 8), Decl(forInContinueStatements.ts, 29, 26), Decl(forInContinueStatements.ts, 29, 44), Decl(forInContinueStatements.ts, 32, 8))
|
||||
|
||||
continue ONE;
|
||||
}
|
||||
|
||||
TWO:
|
||||
THREE:
|
||||
for(var x in {}) {
|
||||
>x : Symbol(x, Decl(forInContinueStatements.ts, 0, 7), Decl(forInContinueStatements.ts, 5, 7), Decl(forInContinueStatements.ts, 11, 7), Decl(forInContinueStatements.ts, 16, 7), Decl(forInContinueStatements.ts, 18, 11), Decl(forInContinueStatements.ts, 23, 7), Decl(forInContinueStatements.ts, 25, 11), Decl(forInContinueStatements.ts, 29, 8), Decl(forInContinueStatements.ts, 29, 26), Decl(forInContinueStatements.ts, 29, 44), Decl(forInContinueStatements.ts, 32, 8))
|
||||
|
||||
continue THREE;
|
||||
}
|
||||
|
||||
FOUR:
|
||||
for(var x in {}) {
|
||||
>x : Symbol(x, Decl(forInContinueStatements.ts, 0, 7), Decl(forInContinueStatements.ts, 5, 7), Decl(forInContinueStatements.ts, 11, 7), Decl(forInContinueStatements.ts, 16, 7), Decl(forInContinueStatements.ts, 18, 11), Decl(forInContinueStatements.ts, 23, 7), Decl(forInContinueStatements.ts, 25, 11), Decl(forInContinueStatements.ts, 29, 8), Decl(forInContinueStatements.ts, 29, 26), Decl(forInContinueStatements.ts, 29, 44), Decl(forInContinueStatements.ts, 32, 8))
|
||||
|
||||
FIVE:
|
||||
for(var x in {}) {
|
||||
>x : Symbol(x, Decl(forInContinueStatements.ts, 0, 7), Decl(forInContinueStatements.ts, 5, 7), Decl(forInContinueStatements.ts, 11, 7), Decl(forInContinueStatements.ts, 16, 7), Decl(forInContinueStatements.ts, 18, 11), Decl(forInContinueStatements.ts, 23, 7), Decl(forInContinueStatements.ts, 25, 11), Decl(forInContinueStatements.ts, 29, 8), Decl(forInContinueStatements.ts, 29, 26), Decl(forInContinueStatements.ts, 29, 44), Decl(forInContinueStatements.ts, 32, 8))
|
||||
|
||||
continue FOUR;
|
||||
}
|
||||
}
|
||||
|
||||
for(var x in {}) {
|
||||
>x : Symbol(x, Decl(forInContinueStatements.ts, 0, 7), Decl(forInContinueStatements.ts, 5, 7), Decl(forInContinueStatements.ts, 11, 7), Decl(forInContinueStatements.ts, 16, 7), Decl(forInContinueStatements.ts, 18, 11), Decl(forInContinueStatements.ts, 23, 7), Decl(forInContinueStatements.ts, 25, 11), Decl(forInContinueStatements.ts, 29, 8), Decl(forInContinueStatements.ts, 29, 26), Decl(forInContinueStatements.ts, 29, 44), Decl(forInContinueStatements.ts, 32, 8))
|
||||
|
||||
SIX:
|
||||
for(var x in {}) continue SIX;
|
||||
>x : Symbol(x, Decl(forInContinueStatements.ts, 0, 7), Decl(forInContinueStatements.ts, 5, 7), Decl(forInContinueStatements.ts, 11, 7), Decl(forInContinueStatements.ts, 16, 7), Decl(forInContinueStatements.ts, 18, 11), Decl(forInContinueStatements.ts, 23, 7), Decl(forInContinueStatements.ts, 25, 11), Decl(forInContinueStatements.ts, 29, 8), Decl(forInContinueStatements.ts, 29, 26), Decl(forInContinueStatements.ts, 29, 44), Decl(forInContinueStatements.ts, 32, 8))
|
||||
}
|
||||
|
||||
SEVEN:
|
||||
for (var x in {}) for (var x in {}) for (var x in {}) continue SEVEN;
|
||||
>x : Symbol(x, Decl(forInContinueStatements.ts, 0, 7), Decl(forInContinueStatements.ts, 5, 7), Decl(forInContinueStatements.ts, 11, 7), Decl(forInContinueStatements.ts, 16, 7), Decl(forInContinueStatements.ts, 18, 11), Decl(forInContinueStatements.ts, 23, 7), Decl(forInContinueStatements.ts, 25, 11), Decl(forInContinueStatements.ts, 29, 8), Decl(forInContinueStatements.ts, 29, 26), Decl(forInContinueStatements.ts, 29, 44), Decl(forInContinueStatements.ts, 32, 8))
|
||||
>x : Symbol(x, Decl(forInContinueStatements.ts, 0, 7), Decl(forInContinueStatements.ts, 5, 7), Decl(forInContinueStatements.ts, 11, 7), Decl(forInContinueStatements.ts, 16, 7), Decl(forInContinueStatements.ts, 18, 11), Decl(forInContinueStatements.ts, 23, 7), Decl(forInContinueStatements.ts, 25, 11), Decl(forInContinueStatements.ts, 29, 8), Decl(forInContinueStatements.ts, 29, 26), Decl(forInContinueStatements.ts, 29, 44), Decl(forInContinueStatements.ts, 32, 8))
|
||||
>x : Symbol(x, Decl(forInContinueStatements.ts, 0, 7), Decl(forInContinueStatements.ts, 5, 7), Decl(forInContinueStatements.ts, 11, 7), Decl(forInContinueStatements.ts, 16, 7), Decl(forInContinueStatements.ts, 18, 11), Decl(forInContinueStatements.ts, 23, 7), Decl(forInContinueStatements.ts, 25, 11), Decl(forInContinueStatements.ts, 29, 8), Decl(forInContinueStatements.ts, 29, 26), Decl(forInContinueStatements.ts, 29, 44), Decl(forInContinueStatements.ts, 32, 8))
|
||||
|
||||
EIGHT:
|
||||
for (var x in {}){
|
||||
>x : Symbol(x, Decl(forInContinueStatements.ts, 0, 7), Decl(forInContinueStatements.ts, 5, 7), Decl(forInContinueStatements.ts, 11, 7), Decl(forInContinueStatements.ts, 16, 7), Decl(forInContinueStatements.ts, 18, 11), Decl(forInContinueStatements.ts, 23, 7), Decl(forInContinueStatements.ts, 25, 11), Decl(forInContinueStatements.ts, 29, 8), Decl(forInContinueStatements.ts, 29, 26), Decl(forInContinueStatements.ts, 29, 44), Decl(forInContinueStatements.ts, 32, 8))
|
||||
|
||||
var fn = function () { }
|
||||
>fn : Symbol(fn, Decl(forInContinueStatements.ts, 33, 7))
|
||||
|
||||
continue EIGHT;
|
||||
}
|
||||
|
||||
@ -1,92 +0,0 @@
|
||||
=== tests/cases/conformance/statements/continueStatements/forInContinueStatements.ts ===
|
||||
for(var x in {}) {
|
||||
>x : any
|
||||
>{} : {}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
ONE:
|
||||
>ONE : any
|
||||
|
||||
for(var x in {}) {
|
||||
>x : any
|
||||
>{} : {}
|
||||
|
||||
continue ONE;
|
||||
>ONE : any
|
||||
}
|
||||
|
||||
TWO:
|
||||
>TWO : any
|
||||
|
||||
THREE:
|
||||
>THREE : any
|
||||
|
||||
for(var x in {}) {
|
||||
>x : any
|
||||
>{} : {}
|
||||
|
||||
continue THREE;
|
||||
>THREE : any
|
||||
}
|
||||
|
||||
FOUR:
|
||||
>FOUR : any
|
||||
|
||||
for(var x in {}) {
|
||||
>x : any
|
||||
>{} : {}
|
||||
|
||||
FIVE:
|
||||
>FIVE : any
|
||||
|
||||
for(var x in {}) {
|
||||
>x : any
|
||||
>{} : {}
|
||||
|
||||
continue FOUR;
|
||||
>FOUR : any
|
||||
}
|
||||
}
|
||||
|
||||
for(var x in {}) {
|
||||
>x : any
|
||||
>{} : {}
|
||||
|
||||
SIX:
|
||||
>SIX : any
|
||||
|
||||
for(var x in {}) continue SIX;
|
||||
>x : any
|
||||
>{} : {}
|
||||
>SIX : any
|
||||
}
|
||||
|
||||
SEVEN:
|
||||
>SEVEN : any
|
||||
|
||||
for (var x in {}) for (var x in {}) for (var x in {}) continue SEVEN;
|
||||
>x : any
|
||||
>{} : {}
|
||||
>x : any
|
||||
>{} : {}
|
||||
>x : any
|
||||
>{} : {}
|
||||
>SEVEN : any
|
||||
|
||||
EIGHT:
|
||||
>EIGHT : any
|
||||
|
||||
for (var x in {}){
|
||||
>x : any
|
||||
>{} : {}
|
||||
|
||||
var fn = function () { }
|
||||
>fn : () => void
|
||||
>function () { } : () => void
|
||||
|
||||
continue EIGHT;
|
||||
>EIGHT : any
|
||||
}
|
||||
|
||||
52
tests/baselines/reference/forStatements.errors.txt
Normal file
52
tests/baselines/reference/forStatements.errors.txt
Normal file
@ -0,0 +1,52 @@
|
||||
tests/cases/conformance/statements/forStatements/forStatements.ts(26,1): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/forStatements/forStatements.ts (1 errors) ====
|
||||
interface I {
|
||||
id: number;
|
||||
}
|
||||
|
||||
class C implements I {
|
||||
id: number;
|
||||
}
|
||||
|
||||
class D<T>{
|
||||
source: T;
|
||||
recurse: D<T>;
|
||||
wrapped: D<D<T>>
|
||||
}
|
||||
|
||||
function F(x: string): number { return 42; }
|
||||
|
||||
module M {
|
||||
export class A {
|
||||
name: string;
|
||||
}
|
||||
|
||||
export function F2(x: number): string { return x.toString(); }
|
||||
}
|
||||
|
||||
for(var aNumber: number = 9.9;;){}
|
||||
for(var aString: string = 'this is a string';;){}
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
for(var aDate: Date = new Date(12);;){}
|
||||
for(var anObject: Object = new Object();;){}
|
||||
|
||||
for(var anAny: any = null;;){}
|
||||
for(var aSecondAny: any = undefined;;){}
|
||||
for(var aVoid: void = undefined;;){}
|
||||
|
||||
for(var anInterface: I = new C();;){}
|
||||
for(var aClass: C = new C();;){}
|
||||
for(var aGenericClass: D<string> = new D<string>();;){}
|
||||
for(var anObjectLiteral: I = { id: 12 };;){}
|
||||
for(var anOtherObjectLiteral: { id: number } = new C();;){}
|
||||
|
||||
for(var aFunction: typeof F = F;;){}
|
||||
for(var anOtherFunction: (x: string) => number = F;;){}
|
||||
for(var aLambda: typeof F = (x) => 2;;){}
|
||||
|
||||
for(var aModule: typeof M = M;;){}
|
||||
for(var aClassInModule: M.A = new M.A();;){}
|
||||
for(var aFunctionInModule: typeof M.F2 = (x) => 'this is a string';;){}
|
||||
@ -1,145 +0,0 @@
|
||||
=== tests/cases/conformance/statements/forStatements/forStatements.ts ===
|
||||
interface I {
|
||||
>I : Symbol(I, Decl(forStatements.ts, 0, 0))
|
||||
|
||||
id: number;
|
||||
>id : Symbol(id, Decl(forStatements.ts, 0, 13))
|
||||
}
|
||||
|
||||
class C implements I {
|
||||
>C : Symbol(C, Decl(forStatements.ts, 2, 1))
|
||||
>I : Symbol(I, Decl(forStatements.ts, 0, 0))
|
||||
|
||||
id: number;
|
||||
>id : Symbol(id, Decl(forStatements.ts, 4, 22))
|
||||
}
|
||||
|
||||
class D<T>{
|
||||
>D : Symbol(D, Decl(forStatements.ts, 6, 1))
|
||||
>T : Symbol(T, Decl(forStatements.ts, 8, 8))
|
||||
|
||||
source: T;
|
||||
>source : Symbol(source, Decl(forStatements.ts, 8, 11))
|
||||
>T : Symbol(T, Decl(forStatements.ts, 8, 8))
|
||||
|
||||
recurse: D<T>;
|
||||
>recurse : Symbol(recurse, Decl(forStatements.ts, 9, 14))
|
||||
>D : Symbol(D, Decl(forStatements.ts, 6, 1))
|
||||
>T : Symbol(T, Decl(forStatements.ts, 8, 8))
|
||||
|
||||
wrapped: D<D<T>>
|
||||
>wrapped : Symbol(wrapped, Decl(forStatements.ts, 10, 18))
|
||||
>D : Symbol(D, Decl(forStatements.ts, 6, 1))
|
||||
>D : Symbol(D, Decl(forStatements.ts, 6, 1))
|
||||
>T : Symbol(T, Decl(forStatements.ts, 8, 8))
|
||||
}
|
||||
|
||||
function F(x: string): number { return 42; }
|
||||
>F : Symbol(F, Decl(forStatements.ts, 12, 1))
|
||||
>x : Symbol(x, Decl(forStatements.ts, 14, 11))
|
||||
|
||||
module M {
|
||||
>M : Symbol(M, Decl(forStatements.ts, 14, 44))
|
||||
|
||||
export class A {
|
||||
>A : Symbol(A, Decl(forStatements.ts, 16, 10))
|
||||
|
||||
name: string;
|
||||
>name : Symbol(name, Decl(forStatements.ts, 17, 20))
|
||||
}
|
||||
|
||||
export function F2(x: number): string { return x.toString(); }
|
||||
>F2 : Symbol(F2, Decl(forStatements.ts, 19, 5))
|
||||
>x : Symbol(x, Decl(forStatements.ts, 21, 23))
|
||||
>x.toString : Symbol(Number.toString, Decl(lib.d.ts, 458, 18))
|
||||
>x : Symbol(x, Decl(forStatements.ts, 21, 23))
|
||||
>toString : Symbol(Number.toString, Decl(lib.d.ts, 458, 18))
|
||||
}
|
||||
|
||||
for(var aNumber: number = 9.9;;){}
|
||||
>aNumber : Symbol(aNumber, Decl(forStatements.ts, 24, 7))
|
||||
|
||||
for(var aString: string = 'this is a string';;){}
|
||||
>aString : Symbol(aString, Decl(forStatements.ts, 25, 7))
|
||||
|
||||
for(var aDate: Date = new Date(12);;){}
|
||||
>aDate : Symbol(aDate, Decl(forStatements.ts, 26, 7))
|
||||
>Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11))
|
||||
>Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11))
|
||||
|
||||
for(var anObject: Object = new Object();;){}
|
||||
>anObject : Symbol(anObject, Decl(forStatements.ts, 27, 7))
|
||||
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
|
||||
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
|
||||
|
||||
for(var anAny: any = null;;){}
|
||||
>anAny : Symbol(anAny, Decl(forStatements.ts, 29, 7))
|
||||
|
||||
for(var aSecondAny: any = undefined;;){}
|
||||
>aSecondAny : Symbol(aSecondAny, Decl(forStatements.ts, 30, 7))
|
||||
>undefined : Symbol(undefined)
|
||||
|
||||
for(var aVoid: void = undefined;;){}
|
||||
>aVoid : Symbol(aVoid, Decl(forStatements.ts, 31, 7))
|
||||
>undefined : Symbol(undefined)
|
||||
|
||||
for(var anInterface: I = new C();;){}
|
||||
>anInterface : Symbol(anInterface, Decl(forStatements.ts, 33, 7))
|
||||
>I : Symbol(I, Decl(forStatements.ts, 0, 0))
|
||||
>C : Symbol(C, Decl(forStatements.ts, 2, 1))
|
||||
|
||||
for(var aClass: C = new C();;){}
|
||||
>aClass : Symbol(aClass, Decl(forStatements.ts, 34, 7))
|
||||
>C : Symbol(C, Decl(forStatements.ts, 2, 1))
|
||||
>C : Symbol(C, Decl(forStatements.ts, 2, 1))
|
||||
|
||||
for(var aGenericClass: D<string> = new D<string>();;){}
|
||||
>aGenericClass : Symbol(aGenericClass, Decl(forStatements.ts, 35, 7))
|
||||
>D : Symbol(D, Decl(forStatements.ts, 6, 1))
|
||||
>D : Symbol(D, Decl(forStatements.ts, 6, 1))
|
||||
|
||||
for(var anObjectLiteral: I = { id: 12 };;){}
|
||||
>anObjectLiteral : Symbol(anObjectLiteral, Decl(forStatements.ts, 36, 7))
|
||||
>I : Symbol(I, Decl(forStatements.ts, 0, 0))
|
||||
>id : Symbol(id, Decl(forStatements.ts, 36, 30))
|
||||
|
||||
for(var anOtherObjectLiteral: { id: number } = new C();;){}
|
||||
>anOtherObjectLiteral : Symbol(anOtherObjectLiteral, Decl(forStatements.ts, 37, 7))
|
||||
>id : Symbol(id, Decl(forStatements.ts, 37, 31))
|
||||
>C : Symbol(C, Decl(forStatements.ts, 2, 1))
|
||||
|
||||
for(var aFunction: typeof F = F;;){}
|
||||
>aFunction : Symbol(aFunction, Decl(forStatements.ts, 39, 7))
|
||||
>F : Symbol(F, Decl(forStatements.ts, 12, 1))
|
||||
>F : Symbol(F, Decl(forStatements.ts, 12, 1))
|
||||
|
||||
for(var anOtherFunction: (x: string) => number = F;;){}
|
||||
>anOtherFunction : Symbol(anOtherFunction, Decl(forStatements.ts, 40, 7))
|
||||
>x : Symbol(x, Decl(forStatements.ts, 40, 26))
|
||||
>F : Symbol(F, Decl(forStatements.ts, 12, 1))
|
||||
|
||||
for(var aLambda: typeof F = (x) => 2;;){}
|
||||
>aLambda : Symbol(aLambda, Decl(forStatements.ts, 41, 7))
|
||||
>F : Symbol(F, Decl(forStatements.ts, 12, 1))
|
||||
>x : Symbol(x, Decl(forStatements.ts, 41, 29))
|
||||
|
||||
for(var aModule: typeof M = M;;){}
|
||||
>aModule : Symbol(aModule, Decl(forStatements.ts, 43, 7))
|
||||
>M : Symbol(M, Decl(forStatements.ts, 14, 44))
|
||||
>M : Symbol(M, Decl(forStatements.ts, 14, 44))
|
||||
|
||||
for(var aClassInModule: M.A = new M.A();;){}
|
||||
>aClassInModule : Symbol(aClassInModule, Decl(forStatements.ts, 44, 7))
|
||||
>M : Symbol(M, Decl(forStatements.ts, 14, 44))
|
||||
>A : Symbol(M.A, Decl(forStatements.ts, 16, 10))
|
||||
>M.A : Symbol(M.A, Decl(forStatements.ts, 16, 10))
|
||||
>M : Symbol(M, Decl(forStatements.ts, 14, 44))
|
||||
>A : Symbol(M.A, Decl(forStatements.ts, 16, 10))
|
||||
|
||||
for(var aFunctionInModule: typeof M.F2 = (x) => 'this is a string';;){}
|
||||
>aFunctionInModule : Symbol(aFunctionInModule, Decl(forStatements.ts, 45, 7))
|
||||
>M.F2 : Symbol(M.F2, Decl(forStatements.ts, 19, 5))
|
||||
>M : Symbol(M, Decl(forStatements.ts, 14, 44))
|
||||
>F2 : Symbol(M.F2, Decl(forStatements.ts, 19, 5))
|
||||
>x : Symbol(x, Decl(forStatements.ts, 45, 42))
|
||||
|
||||
@ -1,164 +0,0 @@
|
||||
=== tests/cases/conformance/statements/forStatements/forStatements.ts ===
|
||||
interface I {
|
||||
>I : I
|
||||
|
||||
id: number;
|
||||
>id : number
|
||||
}
|
||||
|
||||
class C implements I {
|
||||
>C : C
|
||||
>I : I
|
||||
|
||||
id: number;
|
||||
>id : number
|
||||
}
|
||||
|
||||
class D<T>{
|
||||
>D : D<T>
|
||||
>T : T
|
||||
|
||||
source: T;
|
||||
>source : T
|
||||
>T : T
|
||||
|
||||
recurse: D<T>;
|
||||
>recurse : D<T>
|
||||
>D : D<T>
|
||||
>T : T
|
||||
|
||||
wrapped: D<D<T>>
|
||||
>wrapped : D<D<T>>
|
||||
>D : D<T>
|
||||
>D : D<T>
|
||||
>T : T
|
||||
}
|
||||
|
||||
function F(x: string): number { return 42; }
|
||||
>F : (x: string) => number
|
||||
>x : string
|
||||
>42 : number
|
||||
|
||||
module M {
|
||||
>M : typeof M
|
||||
|
||||
export class A {
|
||||
>A : A
|
||||
|
||||
name: string;
|
||||
>name : string
|
||||
}
|
||||
|
||||
export function F2(x: number): string { return x.toString(); }
|
||||
>F2 : (x: number) => string
|
||||
>x : number
|
||||
>x.toString() : string
|
||||
>x.toString : (radix?: number) => string
|
||||
>x : number
|
||||
>toString : (radix?: number) => string
|
||||
}
|
||||
|
||||
for(var aNumber: number = 9.9;;){}
|
||||
>aNumber : number
|
||||
>9.9 : number
|
||||
|
||||
for(var aString: string = 'this is a string';;){}
|
||||
>aString : string
|
||||
>'this is a string' : string
|
||||
|
||||
for(var aDate: Date = new Date(12);;){}
|
||||
>aDate : Date
|
||||
>Date : Date
|
||||
>new Date(12) : Date
|
||||
>Date : DateConstructor
|
||||
>12 : number
|
||||
|
||||
for(var anObject: Object = new Object();;){}
|
||||
>anObject : Object
|
||||
>Object : Object
|
||||
>new Object() : Object
|
||||
>Object : ObjectConstructor
|
||||
|
||||
for(var anAny: any = null;;){}
|
||||
>anAny : any
|
||||
>null : null
|
||||
|
||||
for(var aSecondAny: any = undefined;;){}
|
||||
>aSecondAny : any
|
||||
>undefined : undefined
|
||||
|
||||
for(var aVoid: void = undefined;;){}
|
||||
>aVoid : void
|
||||
>undefined : undefined
|
||||
|
||||
for(var anInterface: I = new C();;){}
|
||||
>anInterface : I
|
||||
>I : I
|
||||
>new C() : C
|
||||
>C : typeof C
|
||||
|
||||
for(var aClass: C = new C();;){}
|
||||
>aClass : C
|
||||
>C : C
|
||||
>new C() : C
|
||||
>C : typeof C
|
||||
|
||||
for(var aGenericClass: D<string> = new D<string>();;){}
|
||||
>aGenericClass : D<string>
|
||||
>D : D<T>
|
||||
>new D<string>() : D<string>
|
||||
>D : typeof D
|
||||
|
||||
for(var anObjectLiteral: I = { id: 12 };;){}
|
||||
>anObjectLiteral : I
|
||||
>I : I
|
||||
>{ id: 12 } : { id: number; }
|
||||
>id : number
|
||||
>12 : number
|
||||
|
||||
for(var anOtherObjectLiteral: { id: number } = new C();;){}
|
||||
>anOtherObjectLiteral : { id: number; }
|
||||
>id : number
|
||||
>new C() : C
|
||||
>C : typeof C
|
||||
|
||||
for(var aFunction: typeof F = F;;){}
|
||||
>aFunction : (x: string) => number
|
||||
>F : (x: string) => number
|
||||
>F : (x: string) => number
|
||||
|
||||
for(var anOtherFunction: (x: string) => number = F;;){}
|
||||
>anOtherFunction : (x: string) => number
|
||||
>x : string
|
||||
>F : (x: string) => number
|
||||
|
||||
for(var aLambda: typeof F = (x) => 2;;){}
|
||||
>aLambda : (x: string) => number
|
||||
>F : (x: string) => number
|
||||
>(x) => 2 : (x: string) => number
|
||||
>x : string
|
||||
>2 : number
|
||||
|
||||
for(var aModule: typeof M = M;;){}
|
||||
>aModule : typeof M
|
||||
>M : typeof M
|
||||
>M : typeof M
|
||||
|
||||
for(var aClassInModule: M.A = new M.A();;){}
|
||||
>aClassInModule : M.A
|
||||
>M : any
|
||||
>A : M.A
|
||||
>new M.A() : M.A
|
||||
>M.A : typeof M.A
|
||||
>M : typeof M
|
||||
>A : typeof M.A
|
||||
|
||||
for(var aFunctionInModule: typeof M.F2 = (x) => 'this is a string';;){}
|
||||
>aFunctionInModule : (x: number) => string
|
||||
>M.F2 : (x: number) => string
|
||||
>M : typeof M
|
||||
>F2 : (x: number) => string
|
||||
>(x) => 'this is a string' : (x: number) => string
|
||||
>x : number
|
||||
>'this is a string' : string
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(32,1): error TS7027: Unreachable code detected.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(32,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'number'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(33,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'string'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(34,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'C'.
|
||||
@ -12,7 +13,7 @@ tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDec
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(53,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'm' must be of type 'typeof M', but here has type 'typeof A'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts (12 errors) ====
|
||||
==== tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts (13 errors) ====
|
||||
interface I {
|
||||
id: number;
|
||||
}
|
||||
@ -45,6 +46,8 @@ tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDec
|
||||
// all of these are errors
|
||||
for( var a: any;;){}
|
||||
for( var a = 1;;){}
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'number'.
|
||||
for( var a = 'a string';;){}
|
||||
|
||||
@ -0,0 +1,39 @@
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleValidDecl.ts(4,1): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/forStatements/forStatementsMultipleValidDecl.ts (1 errors) ====
|
||||
// all expected to be valid
|
||||
|
||||
for (var x: number; ;) { }
|
||||
for (var x = 2; ;) { }
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
|
||||
for (var x = <number>undefined; ;) { }
|
||||
// new declaration space, making redeclaring x as a string valid
|
||||
function declSpace() {
|
||||
for (var x = 'this is a string'; ;) { }
|
||||
}
|
||||
interface Point { x: number; y: number; }
|
||||
|
||||
for (var p: Point; ;) { }
|
||||
for (var p = { x: 1, y: 2 }; ;) { }
|
||||
for (var p: Point = { x: 0, y: undefined }; ;) { }
|
||||
for (var p = { x: 1, y: <number>undefined }; ;) { }
|
||||
for (var p: { x: number; y: number; } = { x: 1, y: 2 }; ;) { }
|
||||
for (var p = <{ x: number; y: number; }>{ x: 0, y: undefined }; ;) { }
|
||||
for (var p: typeof p; ;) { }
|
||||
|
||||
for (var fn = function (s: string) { return 42; }; ;) { }
|
||||
for (var fn = (s: string) => 3; ;) { }
|
||||
for (var fn: (s: string) => number; ;) { }
|
||||
for (var fn: { (s: string): number }; ;) { }
|
||||
for (var fn = <(s: string) => number> null; ;) { }
|
||||
for (var fn: typeof fn; ;) { }
|
||||
|
||||
for (var a: string[]; ;) { }
|
||||
for (var a = ['a', 'b']; ;) { }
|
||||
for (var a = <string[]>[]; ;) { }
|
||||
for (var a: string[] = []; ;) { }
|
||||
for (var a = new Array<string>(); ;) { }
|
||||
for (var a: typeof a; ;) { }
|
||||
@ -1,110 +0,0 @@
|
||||
=== tests/cases/conformance/statements/forStatements/forStatementsMultipleValidDecl.ts ===
|
||||
// all expected to be valid
|
||||
|
||||
for (var x: number; ;) { }
|
||||
>x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 2, 8), Decl(forStatementsMultipleValidDecl.ts, 3, 8), Decl(forStatementsMultipleValidDecl.ts, 5, 8))
|
||||
|
||||
for (var x = 2; ;) { }
|
||||
>x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 2, 8), Decl(forStatementsMultipleValidDecl.ts, 3, 8), Decl(forStatementsMultipleValidDecl.ts, 5, 8))
|
||||
|
||||
for (var x = <number>undefined; ;) { }
|
||||
>x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 2, 8), Decl(forStatementsMultipleValidDecl.ts, 3, 8), Decl(forStatementsMultipleValidDecl.ts, 5, 8))
|
||||
>undefined : Symbol(undefined)
|
||||
|
||||
// new declaration space, making redeclaring x as a string valid
|
||||
function declSpace() {
|
||||
>declSpace : Symbol(declSpace, Decl(forStatementsMultipleValidDecl.ts, 5, 38))
|
||||
|
||||
for (var x = 'this is a string'; ;) { }
|
||||
>x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 8, 12))
|
||||
}
|
||||
interface Point { x: number; y: number; }
|
||||
>Point : Symbol(Point, Decl(forStatementsMultipleValidDecl.ts, 9, 1))
|
||||
>x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 10, 17))
|
||||
>y : Symbol(y, Decl(forStatementsMultipleValidDecl.ts, 10, 28))
|
||||
|
||||
for (var p: Point; ;) { }
|
||||
>p : Symbol(p, Decl(forStatementsMultipleValidDecl.ts, 12, 8), Decl(forStatementsMultipleValidDecl.ts, 13, 8), Decl(forStatementsMultipleValidDecl.ts, 14, 8), Decl(forStatementsMultipleValidDecl.ts, 15, 8), Decl(forStatementsMultipleValidDecl.ts, 16, 8), Decl(forStatementsMultipleValidDecl.ts, 17, 8), Decl(forStatementsMultipleValidDecl.ts, 18, 8))
|
||||
>Point : Symbol(Point, Decl(forStatementsMultipleValidDecl.ts, 9, 1))
|
||||
|
||||
for (var p = { x: 1, y: 2 }; ;) { }
|
||||
>p : Symbol(p, Decl(forStatementsMultipleValidDecl.ts, 12, 8), Decl(forStatementsMultipleValidDecl.ts, 13, 8), Decl(forStatementsMultipleValidDecl.ts, 14, 8), Decl(forStatementsMultipleValidDecl.ts, 15, 8), Decl(forStatementsMultipleValidDecl.ts, 16, 8), Decl(forStatementsMultipleValidDecl.ts, 17, 8), Decl(forStatementsMultipleValidDecl.ts, 18, 8))
|
||||
>x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 13, 14))
|
||||
>y : Symbol(y, Decl(forStatementsMultipleValidDecl.ts, 13, 20))
|
||||
|
||||
for (var p: Point = { x: 0, y: undefined }; ;) { }
|
||||
>p : Symbol(p, Decl(forStatementsMultipleValidDecl.ts, 12, 8), Decl(forStatementsMultipleValidDecl.ts, 13, 8), Decl(forStatementsMultipleValidDecl.ts, 14, 8), Decl(forStatementsMultipleValidDecl.ts, 15, 8), Decl(forStatementsMultipleValidDecl.ts, 16, 8), Decl(forStatementsMultipleValidDecl.ts, 17, 8), Decl(forStatementsMultipleValidDecl.ts, 18, 8))
|
||||
>Point : Symbol(Point, Decl(forStatementsMultipleValidDecl.ts, 9, 1))
|
||||
>x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 14, 21))
|
||||
>y : Symbol(y, Decl(forStatementsMultipleValidDecl.ts, 14, 27))
|
||||
>undefined : Symbol(undefined)
|
||||
|
||||
for (var p = { x: 1, y: <number>undefined }; ;) { }
|
||||
>p : Symbol(p, Decl(forStatementsMultipleValidDecl.ts, 12, 8), Decl(forStatementsMultipleValidDecl.ts, 13, 8), Decl(forStatementsMultipleValidDecl.ts, 14, 8), Decl(forStatementsMultipleValidDecl.ts, 15, 8), Decl(forStatementsMultipleValidDecl.ts, 16, 8), Decl(forStatementsMultipleValidDecl.ts, 17, 8), Decl(forStatementsMultipleValidDecl.ts, 18, 8))
|
||||
>x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 15, 14))
|
||||
>y : Symbol(y, Decl(forStatementsMultipleValidDecl.ts, 15, 20))
|
||||
>undefined : Symbol(undefined)
|
||||
|
||||
for (var p: { x: number; y: number; } = { x: 1, y: 2 }; ;) { }
|
||||
>p : Symbol(p, Decl(forStatementsMultipleValidDecl.ts, 12, 8), Decl(forStatementsMultipleValidDecl.ts, 13, 8), Decl(forStatementsMultipleValidDecl.ts, 14, 8), Decl(forStatementsMultipleValidDecl.ts, 15, 8), Decl(forStatementsMultipleValidDecl.ts, 16, 8), Decl(forStatementsMultipleValidDecl.ts, 17, 8), Decl(forStatementsMultipleValidDecl.ts, 18, 8))
|
||||
>x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 16, 13))
|
||||
>y : Symbol(y, Decl(forStatementsMultipleValidDecl.ts, 16, 24))
|
||||
>x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 16, 41))
|
||||
>y : Symbol(y, Decl(forStatementsMultipleValidDecl.ts, 16, 47))
|
||||
|
||||
for (var p = <{ x: number; y: number; }>{ x: 0, y: undefined }; ;) { }
|
||||
>p : Symbol(p, Decl(forStatementsMultipleValidDecl.ts, 12, 8), Decl(forStatementsMultipleValidDecl.ts, 13, 8), Decl(forStatementsMultipleValidDecl.ts, 14, 8), Decl(forStatementsMultipleValidDecl.ts, 15, 8), Decl(forStatementsMultipleValidDecl.ts, 16, 8), Decl(forStatementsMultipleValidDecl.ts, 17, 8), Decl(forStatementsMultipleValidDecl.ts, 18, 8))
|
||||
>x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 17, 15))
|
||||
>y : Symbol(y, Decl(forStatementsMultipleValidDecl.ts, 17, 26))
|
||||
>x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 17, 41))
|
||||
>y : Symbol(y, Decl(forStatementsMultipleValidDecl.ts, 17, 47))
|
||||
>undefined : Symbol(undefined)
|
||||
|
||||
for (var p: typeof p; ;) { }
|
||||
>p : Symbol(p, Decl(forStatementsMultipleValidDecl.ts, 12, 8), Decl(forStatementsMultipleValidDecl.ts, 13, 8), Decl(forStatementsMultipleValidDecl.ts, 14, 8), Decl(forStatementsMultipleValidDecl.ts, 15, 8), Decl(forStatementsMultipleValidDecl.ts, 16, 8), Decl(forStatementsMultipleValidDecl.ts, 17, 8), Decl(forStatementsMultipleValidDecl.ts, 18, 8))
|
||||
>p : Symbol(p, Decl(forStatementsMultipleValidDecl.ts, 12, 8), Decl(forStatementsMultipleValidDecl.ts, 13, 8), Decl(forStatementsMultipleValidDecl.ts, 14, 8), Decl(forStatementsMultipleValidDecl.ts, 15, 8), Decl(forStatementsMultipleValidDecl.ts, 16, 8), Decl(forStatementsMultipleValidDecl.ts, 17, 8), Decl(forStatementsMultipleValidDecl.ts, 18, 8))
|
||||
|
||||
for (var fn = function (s: string) { return 42; }; ;) { }
|
||||
>fn : Symbol(fn, Decl(forStatementsMultipleValidDecl.ts, 20, 8), Decl(forStatementsMultipleValidDecl.ts, 21, 8), Decl(forStatementsMultipleValidDecl.ts, 22, 8), Decl(forStatementsMultipleValidDecl.ts, 23, 8), Decl(forStatementsMultipleValidDecl.ts, 24, 8), Decl(forStatementsMultipleValidDecl.ts, 25, 8))
|
||||
>s : Symbol(s, Decl(forStatementsMultipleValidDecl.ts, 20, 24))
|
||||
|
||||
for (var fn = (s: string) => 3; ;) { }
|
||||
>fn : Symbol(fn, Decl(forStatementsMultipleValidDecl.ts, 20, 8), Decl(forStatementsMultipleValidDecl.ts, 21, 8), Decl(forStatementsMultipleValidDecl.ts, 22, 8), Decl(forStatementsMultipleValidDecl.ts, 23, 8), Decl(forStatementsMultipleValidDecl.ts, 24, 8), Decl(forStatementsMultipleValidDecl.ts, 25, 8))
|
||||
>s : Symbol(s, Decl(forStatementsMultipleValidDecl.ts, 21, 15))
|
||||
|
||||
for (var fn: (s: string) => number; ;) { }
|
||||
>fn : Symbol(fn, Decl(forStatementsMultipleValidDecl.ts, 20, 8), Decl(forStatementsMultipleValidDecl.ts, 21, 8), Decl(forStatementsMultipleValidDecl.ts, 22, 8), Decl(forStatementsMultipleValidDecl.ts, 23, 8), Decl(forStatementsMultipleValidDecl.ts, 24, 8), Decl(forStatementsMultipleValidDecl.ts, 25, 8))
|
||||
>s : Symbol(s, Decl(forStatementsMultipleValidDecl.ts, 22, 14))
|
||||
|
||||
for (var fn: { (s: string): number }; ;) { }
|
||||
>fn : Symbol(fn, Decl(forStatementsMultipleValidDecl.ts, 20, 8), Decl(forStatementsMultipleValidDecl.ts, 21, 8), Decl(forStatementsMultipleValidDecl.ts, 22, 8), Decl(forStatementsMultipleValidDecl.ts, 23, 8), Decl(forStatementsMultipleValidDecl.ts, 24, 8), Decl(forStatementsMultipleValidDecl.ts, 25, 8))
|
||||
>s : Symbol(s, Decl(forStatementsMultipleValidDecl.ts, 23, 16))
|
||||
|
||||
for (var fn = <(s: string) => number> null; ;) { }
|
||||
>fn : Symbol(fn, Decl(forStatementsMultipleValidDecl.ts, 20, 8), Decl(forStatementsMultipleValidDecl.ts, 21, 8), Decl(forStatementsMultipleValidDecl.ts, 22, 8), Decl(forStatementsMultipleValidDecl.ts, 23, 8), Decl(forStatementsMultipleValidDecl.ts, 24, 8), Decl(forStatementsMultipleValidDecl.ts, 25, 8))
|
||||
>s : Symbol(s, Decl(forStatementsMultipleValidDecl.ts, 24, 16))
|
||||
|
||||
for (var fn: typeof fn; ;) { }
|
||||
>fn : Symbol(fn, Decl(forStatementsMultipleValidDecl.ts, 20, 8), Decl(forStatementsMultipleValidDecl.ts, 21, 8), Decl(forStatementsMultipleValidDecl.ts, 22, 8), Decl(forStatementsMultipleValidDecl.ts, 23, 8), Decl(forStatementsMultipleValidDecl.ts, 24, 8), Decl(forStatementsMultipleValidDecl.ts, 25, 8))
|
||||
>fn : Symbol(fn, Decl(forStatementsMultipleValidDecl.ts, 20, 8), Decl(forStatementsMultipleValidDecl.ts, 21, 8), Decl(forStatementsMultipleValidDecl.ts, 22, 8), Decl(forStatementsMultipleValidDecl.ts, 23, 8), Decl(forStatementsMultipleValidDecl.ts, 24, 8), Decl(forStatementsMultipleValidDecl.ts, 25, 8))
|
||||
|
||||
for (var a: string[]; ;) { }
|
||||
>a : Symbol(a, Decl(forStatementsMultipleValidDecl.ts, 27, 8), Decl(forStatementsMultipleValidDecl.ts, 28, 8), Decl(forStatementsMultipleValidDecl.ts, 29, 8), Decl(forStatementsMultipleValidDecl.ts, 30, 8), Decl(forStatementsMultipleValidDecl.ts, 31, 8), Decl(forStatementsMultipleValidDecl.ts, 32, 8))
|
||||
|
||||
for (var a = ['a', 'b']; ;) { }
|
||||
>a : Symbol(a, Decl(forStatementsMultipleValidDecl.ts, 27, 8), Decl(forStatementsMultipleValidDecl.ts, 28, 8), Decl(forStatementsMultipleValidDecl.ts, 29, 8), Decl(forStatementsMultipleValidDecl.ts, 30, 8), Decl(forStatementsMultipleValidDecl.ts, 31, 8), Decl(forStatementsMultipleValidDecl.ts, 32, 8))
|
||||
|
||||
for (var a = <string[]>[]; ;) { }
|
||||
>a : Symbol(a, Decl(forStatementsMultipleValidDecl.ts, 27, 8), Decl(forStatementsMultipleValidDecl.ts, 28, 8), Decl(forStatementsMultipleValidDecl.ts, 29, 8), Decl(forStatementsMultipleValidDecl.ts, 30, 8), Decl(forStatementsMultipleValidDecl.ts, 31, 8), Decl(forStatementsMultipleValidDecl.ts, 32, 8))
|
||||
|
||||
for (var a: string[] = []; ;) { }
|
||||
>a : Symbol(a, Decl(forStatementsMultipleValidDecl.ts, 27, 8), Decl(forStatementsMultipleValidDecl.ts, 28, 8), Decl(forStatementsMultipleValidDecl.ts, 29, 8), Decl(forStatementsMultipleValidDecl.ts, 30, 8), Decl(forStatementsMultipleValidDecl.ts, 31, 8), Decl(forStatementsMultipleValidDecl.ts, 32, 8))
|
||||
|
||||
for (var a = new Array<string>(); ;) { }
|
||||
>a : Symbol(a, Decl(forStatementsMultipleValidDecl.ts, 27, 8), Decl(forStatementsMultipleValidDecl.ts, 28, 8), Decl(forStatementsMultipleValidDecl.ts, 29, 8), Decl(forStatementsMultipleValidDecl.ts, 30, 8), Decl(forStatementsMultipleValidDecl.ts, 31, 8), Decl(forStatementsMultipleValidDecl.ts, 32, 8))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
|
||||
|
||||
for (var a: typeof a; ;) { }
|
||||
>a : Symbol(a, Decl(forStatementsMultipleValidDecl.ts, 27, 8), Decl(forStatementsMultipleValidDecl.ts, 28, 8), Decl(forStatementsMultipleValidDecl.ts, 29, 8), Decl(forStatementsMultipleValidDecl.ts, 30, 8), Decl(forStatementsMultipleValidDecl.ts, 31, 8), Decl(forStatementsMultipleValidDecl.ts, 32, 8))
|
||||
>a : Symbol(a, Decl(forStatementsMultipleValidDecl.ts, 27, 8), Decl(forStatementsMultipleValidDecl.ts, 28, 8), Decl(forStatementsMultipleValidDecl.ts, 29, 8), Decl(forStatementsMultipleValidDecl.ts, 30, 8), Decl(forStatementsMultipleValidDecl.ts, 31, 8), Decl(forStatementsMultipleValidDecl.ts, 32, 8))
|
||||
|
||||
@ -1,140 +0,0 @@
|
||||
=== tests/cases/conformance/statements/forStatements/forStatementsMultipleValidDecl.ts ===
|
||||
// all expected to be valid
|
||||
|
||||
for (var x: number; ;) { }
|
||||
>x : number
|
||||
|
||||
for (var x = 2; ;) { }
|
||||
>x : number
|
||||
>2 : number
|
||||
|
||||
for (var x = <number>undefined; ;) { }
|
||||
>x : number
|
||||
><number>undefined : number
|
||||
>undefined : undefined
|
||||
|
||||
// new declaration space, making redeclaring x as a string valid
|
||||
function declSpace() {
|
||||
>declSpace : () => void
|
||||
|
||||
for (var x = 'this is a string'; ;) { }
|
||||
>x : string
|
||||
>'this is a string' : string
|
||||
}
|
||||
interface Point { x: number; y: number; }
|
||||
>Point : Point
|
||||
>x : number
|
||||
>y : number
|
||||
|
||||
for (var p: Point; ;) { }
|
||||
>p : Point
|
||||
>Point : Point
|
||||
|
||||
for (var p = { x: 1, y: 2 }; ;) { }
|
||||
>p : Point
|
||||
>{ x: 1, y: 2 } : { x: number; y: number; }
|
||||
>x : number
|
||||
>1 : number
|
||||
>y : number
|
||||
>2 : number
|
||||
|
||||
for (var p: Point = { x: 0, y: undefined }; ;) { }
|
||||
>p : Point
|
||||
>Point : Point
|
||||
>{ x: 0, y: undefined } : { x: number; y: undefined; }
|
||||
>x : number
|
||||
>0 : number
|
||||
>y : undefined
|
||||
>undefined : undefined
|
||||
|
||||
for (var p = { x: 1, y: <number>undefined }; ;) { }
|
||||
>p : Point
|
||||
>{ x: 1, y: <number>undefined } : { x: number; y: number; }
|
||||
>x : number
|
||||
>1 : number
|
||||
>y : number
|
||||
><number>undefined : number
|
||||
>undefined : undefined
|
||||
|
||||
for (var p: { x: number; y: number; } = { x: 1, y: 2 }; ;) { }
|
||||
>p : Point
|
||||
>x : number
|
||||
>y : number
|
||||
>{ x: 1, y: 2 } : { x: number; y: number; }
|
||||
>x : number
|
||||
>1 : number
|
||||
>y : number
|
||||
>2 : number
|
||||
|
||||
for (var p = <{ x: number; y: number; }>{ x: 0, y: undefined }; ;) { }
|
||||
>p : Point
|
||||
><{ x: number; y: number; }>{ x: 0, y: undefined } : { x: number; y: number; }
|
||||
>x : number
|
||||
>y : number
|
||||
>{ x: 0, y: undefined } : { x: number; y: undefined; }
|
||||
>x : number
|
||||
>0 : number
|
||||
>y : undefined
|
||||
>undefined : undefined
|
||||
|
||||
for (var p: typeof p; ;) { }
|
||||
>p : Point
|
||||
>p : Point
|
||||
|
||||
for (var fn = function (s: string) { return 42; }; ;) { }
|
||||
>fn : (s: string) => number
|
||||
>function (s: string) { return 42; } : (s: string) => number
|
||||
>s : string
|
||||
>42 : number
|
||||
|
||||
for (var fn = (s: string) => 3; ;) { }
|
||||
>fn : (s: string) => number
|
||||
>(s: string) => 3 : (s: string) => number
|
||||
>s : string
|
||||
>3 : number
|
||||
|
||||
for (var fn: (s: string) => number; ;) { }
|
||||
>fn : (s: string) => number
|
||||
>s : string
|
||||
|
||||
for (var fn: { (s: string): number }; ;) { }
|
||||
>fn : (s: string) => number
|
||||
>s : string
|
||||
|
||||
for (var fn = <(s: string) => number> null; ;) { }
|
||||
>fn : (s: string) => number
|
||||
><(s: string) => number> null : (s: string) => number
|
||||
>s : string
|
||||
>null : null
|
||||
|
||||
for (var fn: typeof fn; ;) { }
|
||||
>fn : (s: string) => number
|
||||
>fn : (s: string) => number
|
||||
|
||||
for (var a: string[]; ;) { }
|
||||
>a : string[]
|
||||
|
||||
for (var a = ['a', 'b']; ;) { }
|
||||
>a : string[]
|
||||
>['a', 'b'] : string[]
|
||||
>'a' : string
|
||||
>'b' : string
|
||||
|
||||
for (var a = <string[]>[]; ;) { }
|
||||
>a : string[]
|
||||
><string[]>[] : string[]
|
||||
>[] : undefined[]
|
||||
|
||||
for (var a: string[] = []; ;) { }
|
||||
>a : string[]
|
||||
>[] : undefined[]
|
||||
|
||||
for (var a = new Array<string>(); ;) { }
|
||||
>a : string[]
|
||||
>new Array<string>() : string[]
|
||||
>Array : ArrayConstructor
|
||||
|
||||
for (var a: typeof a; ;) { }
|
||||
>a : string[]
|
||||
>a : string[]
|
||||
|
||||
@ -1,31 +1,46 @@
|
||||
tests/cases/conformance/functions/functionImplementationErrors.ts(2,10): error TS2354: No best common type exists among return expressions.
|
||||
tests/cases/conformance/functions/functionImplementationErrors.ts(4,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/conformance/functions/functionImplementationErrors.ts(6,19): error TS2354: No best common type exists among return expressions.
|
||||
tests/cases/conformance/functions/functionImplementationErrors.ts(8,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/conformance/functions/functionImplementationErrors.ts(10,10): error TS2354: No best common type exists among return expressions.
|
||||
tests/cases/conformance/functions/functionImplementationErrors.ts(12,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/conformance/functions/functionImplementationErrors.ts(16,10): error TS2354: No best common type exists among return expressions.
|
||||
tests/cases/conformance/functions/functionImplementationErrors.ts(20,9): error TS7027: Unreachable code detected.
|
||||
tests/cases/conformance/functions/functionImplementationErrors.ts(25,16): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.
|
||||
tests/cases/conformance/functions/functionImplementationErrors.ts(30,17): error TS2373: Initializer of parameter 'n' cannot reference identifier 'm' declared after it.
|
||||
tests/cases/conformance/functions/functionImplementationErrors.ts(35,17): error TS2373: Initializer of parameter 'n' cannot reference identifier 'm' declared after it.
|
||||
tests/cases/conformance/functions/functionImplementationErrors.ts(42,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/conformance/functions/functionImplementationErrors.ts(49,10): error TS2354: No best common type exists among return expressions.
|
||||
tests/cases/conformance/functions/functionImplementationErrors.ts(51,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/conformance/functions/functionImplementationErrors.ts(53,10): error TS2354: No best common type exists among return expressions.
|
||||
tests/cases/conformance/functions/functionImplementationErrors.ts(55,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/conformance/functions/functionImplementationErrors.ts(57,11): error TS2354: No best common type exists among return expressions.
|
||||
tests/cases/conformance/functions/functionImplementationErrors.ts(59,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/conformance/functions/functionImplementationErrors.ts(61,10): error TS2354: No best common type exists among return expressions.
|
||||
tests/cases/conformance/functions/functionImplementationErrors.ts(63,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/conformance/functions/functionImplementationErrors.ts(65,11): error TS2354: No best common type exists among return expressions.
|
||||
tests/cases/conformance/functions/functionImplementationErrors.ts(67,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/conformance/functions/functionImplementationErrors.ts(69,11): error TS2354: No best common type exists among return expressions.
|
||||
tests/cases/conformance/functions/functionImplementationErrors.ts(71,5): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/functions/functionImplementationErrors.ts (13 errors) ====
|
||||
==== tests/cases/conformance/functions/functionImplementationErrors.ts (24 errors) ====
|
||||
// FunctionExpression with no return type annotation with multiple return statements with unrelated types
|
||||
var f1 = function () {
|
||||
~~~~~~~~
|
||||
!!! error TS2354: No best common type exists among return expressions.
|
||||
return '';
|
||||
return 3;
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
};
|
||||
var f2 = function x() {
|
||||
~
|
||||
!!! error TS2354: No best common type exists among return expressions.
|
||||
return '';
|
||||
return 3;
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
};
|
||||
var f3 = () => {
|
||||
~~~~~~~
|
||||
@ -33,6 +48,8 @@ tests/cases/conformance/functions/functionImplementationErrors.ts(69,11): error
|
||||
~~~~~~~~~~~~~~
|
||||
return 3;
|
||||
~~~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
};
|
||||
~
|
||||
!!! error TS2354: No best common type exists among return expressions.
|
||||
@ -45,6 +62,8 @@ tests/cases/conformance/functions/functionImplementationErrors.ts(69,11): error
|
||||
return [''];
|
||||
} else {
|
||||
return [1];
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,6 +92,8 @@ tests/cases/conformance/functions/functionImplementationErrors.ts(69,11): error
|
||||
undefined === function (): number {
|
||||
throw undefined;
|
||||
var x = 4;
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
};
|
||||
|
||||
class Base { private x; }
|
||||
@ -84,12 +105,16 @@ tests/cases/conformance/functions/functionImplementationErrors.ts(69,11): error
|
||||
!!! error TS2354: No best common type exists among return expressions.
|
||||
return new Derived1();
|
||||
return new Derived2();
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
var f9 = function () {
|
||||
~~~~~~~~
|
||||
!!! error TS2354: No best common type exists among return expressions.
|
||||
return new Derived1();
|
||||
return new Derived2();
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
};
|
||||
var f10 = () => {
|
||||
~~~~~~~
|
||||
@ -97,6 +122,8 @@ tests/cases/conformance/functions/functionImplementationErrors.ts(69,11): error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
return new Derived2();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
};
|
||||
~
|
||||
!!! error TS2354: No best common type exists among return expressions.
|
||||
@ -105,12 +132,16 @@ tests/cases/conformance/functions/functionImplementationErrors.ts(69,11): error
|
||||
!!! error TS2354: No best common type exists among return expressions.
|
||||
return new Base();
|
||||
return new AnotherClass();
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
var f12 = function () {
|
||||
~~~~~~~~
|
||||
!!! error TS2354: No best common type exists among return expressions.
|
||||
return new Base();
|
||||
return new AnotherClass();
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
};
|
||||
var f13 = () => {
|
||||
~~~~~~~
|
||||
@ -118,6 +149,8 @@ tests/cases/conformance/functions/functionImplementationErrors.ts(69,11): error
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
return new AnotherClass();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
};
|
||||
~
|
||||
!!! error TS2354: No best common type exists among return expressions.
|
||||
|
||||
183
tests/baselines/reference/functionImplementations.errors.txt
Normal file
183
tests/baselines/reference/functionImplementations.errors.txt
Normal file
@ -0,0 +1,183 @@
|
||||
tests/cases/conformance/functions/functionImplementations.ts(69,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/conformance/functions/functionImplementations.ts(81,24): error TS7027: Unreachable code detected.
|
||||
tests/cases/conformance/functions/functionImplementations.ts(86,24): error TS7027: Unreachable code detected.
|
||||
tests/cases/conformance/functions/functionImplementations.ts(137,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/conformance/functions/functionImplementations.ts(141,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/conformance/functions/functionImplementations.ts(146,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/conformance/functions/functionImplementations.ts(150,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/conformance/functions/functionImplementations.ts(154,5): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/functions/functionImplementations.ts (8 errors) ====
|
||||
// FunctionExpression with no return type annotation and no return statement returns void
|
||||
var v: void = function () { } ();
|
||||
|
||||
// FunctionExpression f with no return type annotation and directly references f in its body returns any
|
||||
var a: any = function f() {
|
||||
return f;
|
||||
};
|
||||
var a: any = function f() {
|
||||
return f();
|
||||
};
|
||||
|
||||
// FunctionExpression f with no return type annotation and indirectly references f in its body returns any
|
||||
var a: any = function f() {
|
||||
var x = f;
|
||||
return x;
|
||||
};
|
||||
|
||||
// Two mutually recursive function implementations with no return type annotations
|
||||
function rec1() {
|
||||
return rec2();
|
||||
}
|
||||
function rec2() {
|
||||
return rec1();
|
||||
}
|
||||
var a = rec1();
|
||||
var a = rec2();
|
||||
|
||||
// Two mutually recursive function implementations with return type annotation in one
|
||||
function rec3(): number {
|
||||
return rec4();
|
||||
}
|
||||
function rec4() {
|
||||
return rec3();
|
||||
}
|
||||
var n: number;
|
||||
var n = rec3();
|
||||
var n = rec4();
|
||||
|
||||
// FunctionExpression with no return type annotation and returns a number
|
||||
var n = function () {
|
||||
return 3;
|
||||
} ();
|
||||
|
||||
// FunctionExpression with no return type annotation and returns null
|
||||
var nu = null;
|
||||
var nu = function () {
|
||||
return null;
|
||||
} ();
|
||||
|
||||
// FunctionExpression with no return type annotation and returns undefined
|
||||
var un = undefined;
|
||||
var un = function () {
|
||||
return undefined;
|
||||
} ();
|
||||
|
||||
// FunctionExpression with no return type annotation and returns a type parameter type
|
||||
var n = function <T>(x: T) {
|
||||
return x;
|
||||
} (4);
|
||||
|
||||
// FunctionExpression with no return type annotation and returns a constrained type parameter type
|
||||
var n = function <T extends {}>(x: T) {
|
||||
return x;
|
||||
} (4);
|
||||
|
||||
// FunctionExpression with no return type annotation with multiple return statements with identical types
|
||||
var n = function () {
|
||||
return 3;
|
||||
return 5;
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}();
|
||||
|
||||
// Otherwise, the inferred return type is the first of the types of the return statement expressions
|
||||
// in the function body that is a supertype of each of the others,
|
||||
// ignoring return statements with no expressions.
|
||||
// A compile - time error occurs if no return statement expression has a type that is a supertype of each of the others.
|
||||
// FunctionExpression with no return type annotation with multiple return statements with subtype relation between returns
|
||||
class Base { private m; }
|
||||
class Derived extends Base { private q; }
|
||||
var b: Base;
|
||||
var b = function () {
|
||||
return new Base(); return new Derived();
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
} ();
|
||||
|
||||
// FunctionExpression with no return type annotation with multiple return statements with one a recursive call
|
||||
var a = function f() {
|
||||
return new Base(); return new Derived(); return f(); // ?
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
} ();
|
||||
|
||||
// FunctionExpression with non -void return type annotation with a single throw statement
|
||||
undefined === function (): number {
|
||||
throw undefined;
|
||||
};
|
||||
|
||||
// Type of 'this' in function implementation is 'any'
|
||||
function thisFunc() {
|
||||
var x = this;
|
||||
var x: any;
|
||||
}
|
||||
|
||||
// Function signature with optional parameter, no type annotation and initializer has initializer's type
|
||||
function opt1(n = 4) {
|
||||
var m = n;
|
||||
var m: number;
|
||||
}
|
||||
|
||||
// Function signature with optional parameter, no type annotation and initializer has initializer's widened type
|
||||
function opt2(n = { x: null, y: undefined }) {
|
||||
var m = n;
|
||||
var m: { x: any; y: any };
|
||||
}
|
||||
|
||||
// Function signature with initializer referencing other parameter to the left
|
||||
function opt3(n: number, m = n) {
|
||||
var y = m;
|
||||
var y: number;
|
||||
}
|
||||
|
||||
// Function signature with optional parameter has correct codegen
|
||||
// (tested above)
|
||||
|
||||
// FunctionExpression with non -void return type annotation return with no expression
|
||||
function f6(): number {
|
||||
return;
|
||||
}
|
||||
|
||||
class Derived2 extends Base { private r: string; }
|
||||
class AnotherClass { private x }
|
||||
// if f is a contextually typed function expression, the inferred return type is the union type
|
||||
// of the types of the return statement expressions in the function body,
|
||||
// ignoring return statements with no expressions.
|
||||
var f7: (x: number) => string | number = x => { // should be (x: number) => number | string
|
||||
if (x < 0) { return x; }
|
||||
return x.toString();
|
||||
}
|
||||
var f8: (x: number) => any = x => { // should be (x: number) => Base
|
||||
return new Base();
|
||||
return new Derived2();
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
var f9: (x: number) => any = x => { // should be (x: number) => Base
|
||||
return new Base();
|
||||
return new Derived();
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
return new Derived2();
|
||||
}
|
||||
var f10: (x: number) => any = x => { // should be (x: number) => Derived | Derived1
|
||||
return new Derived();
|
||||
return new Derived2();
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
var f11: (x: number) => any = x => { // should be (x: number) => Base | AnotherClass
|
||||
return new Base();
|
||||
return new AnotherClass();
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
var f12: (x: number) => any = x => { // should be (x: number) => Base | AnotherClass
|
||||
return new Base();
|
||||
return; // should be ignored
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
return new AnotherClass();
|
||||
}
|
||||
@ -1,344 +0,0 @@
|
||||
=== tests/cases/conformance/functions/functionImplementations.ts ===
|
||||
// FunctionExpression with no return type annotation and no return statement returns void
|
||||
var v: void = function () { } ();
|
||||
>v : Symbol(v, Decl(functionImplementations.ts, 1, 3))
|
||||
|
||||
// FunctionExpression f with no return type annotation and directly references f in its body returns any
|
||||
var a: any = function f() {
|
||||
>a : Symbol(a, Decl(functionImplementations.ts, 4, 3), Decl(functionImplementations.ts, 7, 3), Decl(functionImplementations.ts, 12, 3), Decl(functionImplementations.ts, 24, 3), Decl(functionImplementations.ts, 25, 3), Decl(functionImplementations.ts, 84, 3))
|
||||
>f : Symbol(f, Decl(functionImplementations.ts, 4, 12))
|
||||
|
||||
return f;
|
||||
>f : Symbol(f, Decl(functionImplementations.ts, 4, 12))
|
||||
|
||||
};
|
||||
var a: any = function f() {
|
||||
>a : Symbol(a, Decl(functionImplementations.ts, 4, 3), Decl(functionImplementations.ts, 7, 3), Decl(functionImplementations.ts, 12, 3), Decl(functionImplementations.ts, 24, 3), Decl(functionImplementations.ts, 25, 3), Decl(functionImplementations.ts, 84, 3))
|
||||
>f : Symbol(f, Decl(functionImplementations.ts, 7, 12))
|
||||
|
||||
return f();
|
||||
>f : Symbol(f, Decl(functionImplementations.ts, 7, 12))
|
||||
|
||||
};
|
||||
|
||||
// FunctionExpression f with no return type annotation and indirectly references f in its body returns any
|
||||
var a: any = function f() {
|
||||
>a : Symbol(a, Decl(functionImplementations.ts, 4, 3), Decl(functionImplementations.ts, 7, 3), Decl(functionImplementations.ts, 12, 3), Decl(functionImplementations.ts, 24, 3), Decl(functionImplementations.ts, 25, 3), Decl(functionImplementations.ts, 84, 3))
|
||||
>f : Symbol(f, Decl(functionImplementations.ts, 12, 12))
|
||||
|
||||
var x = f;
|
||||
>x : Symbol(x, Decl(functionImplementations.ts, 13, 7))
|
||||
>f : Symbol(f, Decl(functionImplementations.ts, 12, 12))
|
||||
|
||||
return x;
|
||||
>x : Symbol(x, Decl(functionImplementations.ts, 13, 7))
|
||||
|
||||
};
|
||||
|
||||
// Two mutually recursive function implementations with no return type annotations
|
||||
function rec1() {
|
||||
>rec1 : Symbol(rec1, Decl(functionImplementations.ts, 15, 2))
|
||||
|
||||
return rec2();
|
||||
>rec2 : Symbol(rec2, Decl(functionImplementations.ts, 20, 1))
|
||||
}
|
||||
function rec2() {
|
||||
>rec2 : Symbol(rec2, Decl(functionImplementations.ts, 20, 1))
|
||||
|
||||
return rec1();
|
||||
>rec1 : Symbol(rec1, Decl(functionImplementations.ts, 15, 2))
|
||||
}
|
||||
var a = rec1();
|
||||
>a : Symbol(a, Decl(functionImplementations.ts, 4, 3), Decl(functionImplementations.ts, 7, 3), Decl(functionImplementations.ts, 12, 3), Decl(functionImplementations.ts, 24, 3), Decl(functionImplementations.ts, 25, 3), Decl(functionImplementations.ts, 84, 3))
|
||||
>rec1 : Symbol(rec1, Decl(functionImplementations.ts, 15, 2))
|
||||
|
||||
var a = rec2();
|
||||
>a : Symbol(a, Decl(functionImplementations.ts, 4, 3), Decl(functionImplementations.ts, 7, 3), Decl(functionImplementations.ts, 12, 3), Decl(functionImplementations.ts, 24, 3), Decl(functionImplementations.ts, 25, 3), Decl(functionImplementations.ts, 84, 3))
|
||||
>rec2 : Symbol(rec2, Decl(functionImplementations.ts, 20, 1))
|
||||
|
||||
// Two mutually recursive function implementations with return type annotation in one
|
||||
function rec3(): number {
|
||||
>rec3 : Symbol(rec3, Decl(functionImplementations.ts, 25, 15))
|
||||
|
||||
return rec4();
|
||||
>rec4 : Symbol(rec4, Decl(functionImplementations.ts, 30, 1))
|
||||
}
|
||||
function rec4() {
|
||||
>rec4 : Symbol(rec4, Decl(functionImplementations.ts, 30, 1))
|
||||
|
||||
return rec3();
|
||||
>rec3 : Symbol(rec3, Decl(functionImplementations.ts, 25, 15))
|
||||
}
|
||||
var n: number;
|
||||
>n : Symbol(n, Decl(functionImplementations.ts, 34, 3), Decl(functionImplementations.ts, 35, 3), Decl(functionImplementations.ts, 36, 3), Decl(functionImplementations.ts, 39, 3), Decl(functionImplementations.ts, 56, 3), Decl(functionImplementations.ts, 61, 3), Decl(functionImplementations.ts, 66, 3))
|
||||
|
||||
var n = rec3();
|
||||
>n : Symbol(n, Decl(functionImplementations.ts, 34, 3), Decl(functionImplementations.ts, 35, 3), Decl(functionImplementations.ts, 36, 3), Decl(functionImplementations.ts, 39, 3), Decl(functionImplementations.ts, 56, 3), Decl(functionImplementations.ts, 61, 3), Decl(functionImplementations.ts, 66, 3))
|
||||
>rec3 : Symbol(rec3, Decl(functionImplementations.ts, 25, 15))
|
||||
|
||||
var n = rec4();
|
||||
>n : Symbol(n, Decl(functionImplementations.ts, 34, 3), Decl(functionImplementations.ts, 35, 3), Decl(functionImplementations.ts, 36, 3), Decl(functionImplementations.ts, 39, 3), Decl(functionImplementations.ts, 56, 3), Decl(functionImplementations.ts, 61, 3), Decl(functionImplementations.ts, 66, 3))
|
||||
>rec4 : Symbol(rec4, Decl(functionImplementations.ts, 30, 1))
|
||||
|
||||
// FunctionExpression with no return type annotation and returns a number
|
||||
var n = function () {
|
||||
>n : Symbol(n, Decl(functionImplementations.ts, 34, 3), Decl(functionImplementations.ts, 35, 3), Decl(functionImplementations.ts, 36, 3), Decl(functionImplementations.ts, 39, 3), Decl(functionImplementations.ts, 56, 3), Decl(functionImplementations.ts, 61, 3), Decl(functionImplementations.ts, 66, 3))
|
||||
|
||||
return 3;
|
||||
} ();
|
||||
|
||||
// FunctionExpression with no return type annotation and returns null
|
||||
var nu = null;
|
||||
>nu : Symbol(nu, Decl(functionImplementations.ts, 44, 3), Decl(functionImplementations.ts, 45, 3))
|
||||
|
||||
var nu = function () {
|
||||
>nu : Symbol(nu, Decl(functionImplementations.ts, 44, 3), Decl(functionImplementations.ts, 45, 3))
|
||||
|
||||
return null;
|
||||
} ();
|
||||
|
||||
// FunctionExpression with no return type annotation and returns undefined
|
||||
var un = undefined;
|
||||
>un : Symbol(un, Decl(functionImplementations.ts, 50, 3), Decl(functionImplementations.ts, 51, 3))
|
||||
>undefined : Symbol(undefined)
|
||||
|
||||
var un = function () {
|
||||
>un : Symbol(un, Decl(functionImplementations.ts, 50, 3), Decl(functionImplementations.ts, 51, 3))
|
||||
|
||||
return undefined;
|
||||
>undefined : Symbol(undefined)
|
||||
|
||||
} ();
|
||||
|
||||
// FunctionExpression with no return type annotation and returns a type parameter type
|
||||
var n = function <T>(x: T) {
|
||||
>n : Symbol(n, Decl(functionImplementations.ts, 34, 3), Decl(functionImplementations.ts, 35, 3), Decl(functionImplementations.ts, 36, 3), Decl(functionImplementations.ts, 39, 3), Decl(functionImplementations.ts, 56, 3), Decl(functionImplementations.ts, 61, 3), Decl(functionImplementations.ts, 66, 3))
|
||||
>T : Symbol(T, Decl(functionImplementations.ts, 56, 18))
|
||||
>x : Symbol(x, Decl(functionImplementations.ts, 56, 21))
|
||||
>T : Symbol(T, Decl(functionImplementations.ts, 56, 18))
|
||||
|
||||
return x;
|
||||
>x : Symbol(x, Decl(functionImplementations.ts, 56, 21))
|
||||
|
||||
} (4);
|
||||
|
||||
// FunctionExpression with no return type annotation and returns a constrained type parameter type
|
||||
var n = function <T extends {}>(x: T) {
|
||||
>n : Symbol(n, Decl(functionImplementations.ts, 34, 3), Decl(functionImplementations.ts, 35, 3), Decl(functionImplementations.ts, 36, 3), Decl(functionImplementations.ts, 39, 3), Decl(functionImplementations.ts, 56, 3), Decl(functionImplementations.ts, 61, 3), Decl(functionImplementations.ts, 66, 3))
|
||||
>T : Symbol(T, Decl(functionImplementations.ts, 61, 18))
|
||||
>x : Symbol(x, Decl(functionImplementations.ts, 61, 32))
|
||||
>T : Symbol(T, Decl(functionImplementations.ts, 61, 18))
|
||||
|
||||
return x;
|
||||
>x : Symbol(x, Decl(functionImplementations.ts, 61, 32))
|
||||
|
||||
} (4);
|
||||
|
||||
// FunctionExpression with no return type annotation with multiple return statements with identical types
|
||||
var n = function () {
|
||||
>n : Symbol(n, Decl(functionImplementations.ts, 34, 3), Decl(functionImplementations.ts, 35, 3), Decl(functionImplementations.ts, 36, 3), Decl(functionImplementations.ts, 39, 3), Decl(functionImplementations.ts, 56, 3), Decl(functionImplementations.ts, 61, 3), Decl(functionImplementations.ts, 66, 3))
|
||||
|
||||
return 3;
|
||||
return 5;
|
||||
}();
|
||||
|
||||
// Otherwise, the inferred return type is the first of the types of the return statement expressions
|
||||
// in the function body that is a supertype of each of the others,
|
||||
// ignoring return statements with no expressions.
|
||||
// A compile - time error occurs if no return statement expression has a type that is a supertype of each of the others.
|
||||
// FunctionExpression with no return type annotation with multiple return statements with subtype relation between returns
|
||||
class Base { private m; }
|
||||
>Base : Symbol(Base, Decl(functionImplementations.ts, 69, 4))
|
||||
>m : Symbol(m, Decl(functionImplementations.ts, 76, 12))
|
||||
|
||||
class Derived extends Base { private q; }
|
||||
>Derived : Symbol(Derived, Decl(functionImplementations.ts, 76, 25))
|
||||
>Base : Symbol(Base, Decl(functionImplementations.ts, 69, 4))
|
||||
>q : Symbol(q, Decl(functionImplementations.ts, 77, 28))
|
||||
|
||||
var b: Base;
|
||||
>b : Symbol(b, Decl(functionImplementations.ts, 78, 3), Decl(functionImplementations.ts, 79, 3))
|
||||
>Base : Symbol(Base, Decl(functionImplementations.ts, 69, 4))
|
||||
|
||||
var b = function () {
|
||||
>b : Symbol(b, Decl(functionImplementations.ts, 78, 3), Decl(functionImplementations.ts, 79, 3))
|
||||
|
||||
return new Base(); return new Derived();
|
||||
>Base : Symbol(Base, Decl(functionImplementations.ts, 69, 4))
|
||||
>Derived : Symbol(Derived, Decl(functionImplementations.ts, 76, 25))
|
||||
|
||||
} ();
|
||||
|
||||
// FunctionExpression with no return type annotation with multiple return statements with one a recursive call
|
||||
var a = function f() {
|
||||
>a : Symbol(a, Decl(functionImplementations.ts, 4, 3), Decl(functionImplementations.ts, 7, 3), Decl(functionImplementations.ts, 12, 3), Decl(functionImplementations.ts, 24, 3), Decl(functionImplementations.ts, 25, 3), Decl(functionImplementations.ts, 84, 3))
|
||||
>f : Symbol(f, Decl(functionImplementations.ts, 84, 7))
|
||||
|
||||
return new Base(); return new Derived(); return f(); // ?
|
||||
>Base : Symbol(Base, Decl(functionImplementations.ts, 69, 4))
|
||||
>Derived : Symbol(Derived, Decl(functionImplementations.ts, 76, 25))
|
||||
>f : Symbol(f, Decl(functionImplementations.ts, 84, 7))
|
||||
|
||||
} ();
|
||||
|
||||
// FunctionExpression with non -void return type annotation with a single throw statement
|
||||
undefined === function (): number {
|
||||
>undefined : Symbol(undefined)
|
||||
|
||||
throw undefined;
|
||||
>undefined : Symbol(undefined)
|
||||
|
||||
};
|
||||
|
||||
// Type of 'this' in function implementation is 'any'
|
||||
function thisFunc() {
|
||||
>thisFunc : Symbol(thisFunc, Decl(functionImplementations.ts, 91, 2))
|
||||
|
||||
var x = this;
|
||||
>x : Symbol(x, Decl(functionImplementations.ts, 95, 7), Decl(functionImplementations.ts, 96, 7))
|
||||
|
||||
var x: any;
|
||||
>x : Symbol(x, Decl(functionImplementations.ts, 95, 7), Decl(functionImplementations.ts, 96, 7))
|
||||
}
|
||||
|
||||
// Function signature with optional parameter, no type annotation and initializer has initializer's type
|
||||
function opt1(n = 4) {
|
||||
>opt1 : Symbol(opt1, Decl(functionImplementations.ts, 97, 1))
|
||||
>n : Symbol(n, Decl(functionImplementations.ts, 100, 14))
|
||||
|
||||
var m = n;
|
||||
>m : Symbol(m, Decl(functionImplementations.ts, 101, 7), Decl(functionImplementations.ts, 102, 7))
|
||||
>n : Symbol(n, Decl(functionImplementations.ts, 100, 14))
|
||||
|
||||
var m: number;
|
||||
>m : Symbol(m, Decl(functionImplementations.ts, 101, 7), Decl(functionImplementations.ts, 102, 7))
|
||||
}
|
||||
|
||||
// Function signature with optional parameter, no type annotation and initializer has initializer's widened type
|
||||
function opt2(n = { x: null, y: undefined }) {
|
||||
>opt2 : Symbol(opt2, Decl(functionImplementations.ts, 103, 1))
|
||||
>n : Symbol(n, Decl(functionImplementations.ts, 106, 14))
|
||||
>x : Symbol(x, Decl(functionImplementations.ts, 106, 19))
|
||||
>y : Symbol(y, Decl(functionImplementations.ts, 106, 28))
|
||||
>undefined : Symbol(undefined)
|
||||
|
||||
var m = n;
|
||||
>m : Symbol(m, Decl(functionImplementations.ts, 107, 7), Decl(functionImplementations.ts, 108, 7))
|
||||
>n : Symbol(n, Decl(functionImplementations.ts, 106, 14))
|
||||
|
||||
var m: { x: any; y: any };
|
||||
>m : Symbol(m, Decl(functionImplementations.ts, 107, 7), Decl(functionImplementations.ts, 108, 7))
|
||||
>x : Symbol(x, Decl(functionImplementations.ts, 108, 12))
|
||||
>y : Symbol(y, Decl(functionImplementations.ts, 108, 20))
|
||||
}
|
||||
|
||||
// Function signature with initializer referencing other parameter to the left
|
||||
function opt3(n: number, m = n) {
|
||||
>opt3 : Symbol(opt3, Decl(functionImplementations.ts, 109, 1))
|
||||
>n : Symbol(n, Decl(functionImplementations.ts, 112, 14))
|
||||
>m : Symbol(m, Decl(functionImplementations.ts, 112, 24))
|
||||
>n : Symbol(n, Decl(functionImplementations.ts, 112, 14))
|
||||
|
||||
var y = m;
|
||||
>y : Symbol(y, Decl(functionImplementations.ts, 113, 7), Decl(functionImplementations.ts, 114, 7))
|
||||
>m : Symbol(m, Decl(functionImplementations.ts, 112, 24))
|
||||
|
||||
var y: number;
|
||||
>y : Symbol(y, Decl(functionImplementations.ts, 113, 7), Decl(functionImplementations.ts, 114, 7))
|
||||
}
|
||||
|
||||
// Function signature with optional parameter has correct codegen
|
||||
// (tested above)
|
||||
|
||||
// FunctionExpression with non -void return type annotation return with no expression
|
||||
function f6(): number {
|
||||
>f6 : Symbol(f6, Decl(functionImplementations.ts, 115, 1))
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
class Derived2 extends Base { private r: string; }
|
||||
>Derived2 : Symbol(Derived2, Decl(functionImplementations.ts, 123, 1))
|
||||
>Base : Symbol(Base, Decl(functionImplementations.ts, 69, 4))
|
||||
>r : Symbol(r, Decl(functionImplementations.ts, 125, 29))
|
||||
|
||||
class AnotherClass { private x }
|
||||
>AnotherClass : Symbol(AnotherClass, Decl(functionImplementations.ts, 125, 50))
|
||||
>x : Symbol(x, Decl(functionImplementations.ts, 126, 20))
|
||||
|
||||
// if f is a contextually typed function expression, the inferred return type is the union type
|
||||
// of the types of the return statement expressions in the function body,
|
||||
// ignoring return statements with no expressions.
|
||||
var f7: (x: number) => string | number = x => { // should be (x: number) => number | string
|
||||
>f7 : Symbol(f7, Decl(functionImplementations.ts, 130, 3))
|
||||
>x : Symbol(x, Decl(functionImplementations.ts, 130, 9))
|
||||
>x : Symbol(x, Decl(functionImplementations.ts, 130, 40))
|
||||
|
||||
if (x < 0) { return x; }
|
||||
>x : Symbol(x, Decl(functionImplementations.ts, 130, 40))
|
||||
>x : Symbol(x, Decl(functionImplementations.ts, 130, 40))
|
||||
|
||||
return x.toString();
|
||||
>x.toString : Symbol(Number.toString, Decl(lib.d.ts, 458, 18))
|
||||
>x : Symbol(x, Decl(functionImplementations.ts, 130, 40))
|
||||
>toString : Symbol(Number.toString, Decl(lib.d.ts, 458, 18))
|
||||
}
|
||||
var f8: (x: number) => any = x => { // should be (x: number) => Base
|
||||
>f8 : Symbol(f8, Decl(functionImplementations.ts, 134, 3))
|
||||
>x : Symbol(x, Decl(functionImplementations.ts, 134, 9))
|
||||
>x : Symbol(x, Decl(functionImplementations.ts, 134, 28))
|
||||
|
||||
return new Base();
|
||||
>Base : Symbol(Base, Decl(functionImplementations.ts, 69, 4))
|
||||
|
||||
return new Derived2();
|
||||
>Derived2 : Symbol(Derived2, Decl(functionImplementations.ts, 123, 1))
|
||||
}
|
||||
var f9: (x: number) => any = x => { // should be (x: number) => Base
|
||||
>f9 : Symbol(f9, Decl(functionImplementations.ts, 138, 3))
|
||||
>x : Symbol(x, Decl(functionImplementations.ts, 138, 9))
|
||||
>x : Symbol(x, Decl(functionImplementations.ts, 138, 28))
|
||||
|
||||
return new Base();
|
||||
>Base : Symbol(Base, Decl(functionImplementations.ts, 69, 4))
|
||||
|
||||
return new Derived();
|
||||
>Derived : Symbol(Derived, Decl(functionImplementations.ts, 76, 25))
|
||||
|
||||
return new Derived2();
|
||||
>Derived2 : Symbol(Derived2, Decl(functionImplementations.ts, 123, 1))
|
||||
}
|
||||
var f10: (x: number) => any = x => { // should be (x: number) => Derived | Derived1
|
||||
>f10 : Symbol(f10, Decl(functionImplementations.ts, 143, 3))
|
||||
>x : Symbol(x, Decl(functionImplementations.ts, 143, 10))
|
||||
>x : Symbol(x, Decl(functionImplementations.ts, 143, 29))
|
||||
|
||||
return new Derived();
|
||||
>Derived : Symbol(Derived, Decl(functionImplementations.ts, 76, 25))
|
||||
|
||||
return new Derived2();
|
||||
>Derived2 : Symbol(Derived2, Decl(functionImplementations.ts, 123, 1))
|
||||
}
|
||||
var f11: (x: number) => any = x => { // should be (x: number) => Base | AnotherClass
|
||||
>f11 : Symbol(f11, Decl(functionImplementations.ts, 147, 3))
|
||||
>x : Symbol(x, Decl(functionImplementations.ts, 147, 10))
|
||||
>x : Symbol(x, Decl(functionImplementations.ts, 147, 29))
|
||||
|
||||
return new Base();
|
||||
>Base : Symbol(Base, Decl(functionImplementations.ts, 69, 4))
|
||||
|
||||
return new AnotherClass();
|
||||
>AnotherClass : Symbol(AnotherClass, Decl(functionImplementations.ts, 125, 50))
|
||||
}
|
||||
var f12: (x: number) => any = x => { // should be (x: number) => Base | AnotherClass
|
||||
>f12 : Symbol(f12, Decl(functionImplementations.ts, 151, 3))
|
||||
>x : Symbol(x, Decl(functionImplementations.ts, 151, 10))
|
||||
>x : Symbol(x, Decl(functionImplementations.ts, 151, 29))
|
||||
|
||||
return new Base();
|
||||
>Base : Symbol(Base, Decl(functionImplementations.ts, 69, 4))
|
||||
|
||||
return; // should be ignored
|
||||
return new AnotherClass();
|
||||
>AnotherClass : Symbol(AnotherClass, Decl(functionImplementations.ts, 125, 50))
|
||||
}
|
||||
@ -1,416 +0,0 @@
|
||||
=== tests/cases/conformance/functions/functionImplementations.ts ===
|
||||
// FunctionExpression with no return type annotation and no return statement returns void
|
||||
var v: void = function () { } ();
|
||||
>v : void
|
||||
>function () { } () : void
|
||||
>function () { } : () => void
|
||||
|
||||
// FunctionExpression f with no return type annotation and directly references f in its body returns any
|
||||
var a: any = function f() {
|
||||
>a : any
|
||||
>function f() { return f;} : () => any
|
||||
>f : () => any
|
||||
|
||||
return f;
|
||||
>f : () => any
|
||||
|
||||
};
|
||||
var a: any = function f() {
|
||||
>a : any
|
||||
>function f() { return f();} : () => any
|
||||
>f : () => any
|
||||
|
||||
return f();
|
||||
>f() : any
|
||||
>f : () => any
|
||||
|
||||
};
|
||||
|
||||
// FunctionExpression f with no return type annotation and indirectly references f in its body returns any
|
||||
var a: any = function f() {
|
||||
>a : any
|
||||
>function f() { var x = f; return x;} : () => any
|
||||
>f : () => any
|
||||
|
||||
var x = f;
|
||||
>x : () => any
|
||||
>f : () => any
|
||||
|
||||
return x;
|
||||
>x : () => any
|
||||
|
||||
};
|
||||
|
||||
// Two mutually recursive function implementations with no return type annotations
|
||||
function rec1() {
|
||||
>rec1 : () => any
|
||||
|
||||
return rec2();
|
||||
>rec2() : any
|
||||
>rec2 : () => any
|
||||
}
|
||||
function rec2() {
|
||||
>rec2 : () => any
|
||||
|
||||
return rec1();
|
||||
>rec1() : any
|
||||
>rec1 : () => any
|
||||
}
|
||||
var a = rec1();
|
||||
>a : any
|
||||
>rec1() : any
|
||||
>rec1 : () => any
|
||||
|
||||
var a = rec2();
|
||||
>a : any
|
||||
>rec2() : any
|
||||
>rec2 : () => any
|
||||
|
||||
// Two mutually recursive function implementations with return type annotation in one
|
||||
function rec3(): number {
|
||||
>rec3 : () => number
|
||||
|
||||
return rec4();
|
||||
>rec4() : number
|
||||
>rec4 : () => number
|
||||
}
|
||||
function rec4() {
|
||||
>rec4 : () => number
|
||||
|
||||
return rec3();
|
||||
>rec3() : number
|
||||
>rec3 : () => number
|
||||
}
|
||||
var n: number;
|
||||
>n : number
|
||||
|
||||
var n = rec3();
|
||||
>n : number
|
||||
>rec3() : number
|
||||
>rec3 : () => number
|
||||
|
||||
var n = rec4();
|
||||
>n : number
|
||||
>rec4() : number
|
||||
>rec4 : () => number
|
||||
|
||||
// FunctionExpression with no return type annotation and returns a number
|
||||
var n = function () {
|
||||
>n : number
|
||||
>function () { return 3;} () : number
|
||||
>function () { return 3;} : () => number
|
||||
|
||||
return 3;
|
||||
>3 : number
|
||||
|
||||
} ();
|
||||
|
||||
// FunctionExpression with no return type annotation and returns null
|
||||
var nu = null;
|
||||
>nu : any
|
||||
>null : null
|
||||
|
||||
var nu = function () {
|
||||
>nu : any
|
||||
>function () { return null;} () : any
|
||||
>function () { return null;} : () => any
|
||||
|
||||
return null;
|
||||
>null : null
|
||||
|
||||
} ();
|
||||
|
||||
// FunctionExpression with no return type annotation and returns undefined
|
||||
var un = undefined;
|
||||
>un : any
|
||||
>undefined : undefined
|
||||
|
||||
var un = function () {
|
||||
>un : any
|
||||
>function () { return undefined;} () : any
|
||||
>function () { return undefined;} : () => any
|
||||
|
||||
return undefined;
|
||||
>undefined : undefined
|
||||
|
||||
} ();
|
||||
|
||||
// FunctionExpression with no return type annotation and returns a type parameter type
|
||||
var n = function <T>(x: T) {
|
||||
>n : number
|
||||
>function <T>(x: T) { return x;} (4) : number
|
||||
>function <T>(x: T) { return x;} : <T>(x: T) => T
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
|
||||
return x;
|
||||
>x : T
|
||||
|
||||
} (4);
|
||||
>4 : number
|
||||
|
||||
// FunctionExpression with no return type annotation and returns a constrained type parameter type
|
||||
var n = function <T extends {}>(x: T) {
|
||||
>n : number
|
||||
>function <T extends {}>(x: T) { return x;} (4) : number
|
||||
>function <T extends {}>(x: T) { return x;} : <T extends {}>(x: T) => T
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
|
||||
return x;
|
||||
>x : T
|
||||
|
||||
} (4);
|
||||
>4 : number
|
||||
|
||||
// FunctionExpression with no return type annotation with multiple return statements with identical types
|
||||
var n = function () {
|
||||
>n : number
|
||||
>function () { return 3; return 5;}() : number
|
||||
>function () { return 3; return 5;} : () => number
|
||||
|
||||
return 3;
|
||||
>3 : number
|
||||
|
||||
return 5;
|
||||
>5 : number
|
||||
|
||||
}();
|
||||
|
||||
// Otherwise, the inferred return type is the first of the types of the return statement expressions
|
||||
// in the function body that is a supertype of each of the others,
|
||||
// ignoring return statements with no expressions.
|
||||
// A compile - time error occurs if no return statement expression has a type that is a supertype of each of the others.
|
||||
// FunctionExpression with no return type annotation with multiple return statements with subtype relation between returns
|
||||
class Base { private m; }
|
||||
>Base : Base
|
||||
>m : any
|
||||
|
||||
class Derived extends Base { private q; }
|
||||
>Derived : Derived
|
||||
>Base : Base
|
||||
>q : any
|
||||
|
||||
var b: Base;
|
||||
>b : Base
|
||||
>Base : Base
|
||||
|
||||
var b = function () {
|
||||
>b : Base
|
||||
>function () { return new Base(); return new Derived();} () : Base
|
||||
>function () { return new Base(); return new Derived();} : () => Base
|
||||
|
||||
return new Base(); return new Derived();
|
||||
>new Base() : Base
|
||||
>Base : typeof Base
|
||||
>new Derived() : Derived
|
||||
>Derived : typeof Derived
|
||||
|
||||
} ();
|
||||
|
||||
// FunctionExpression with no return type annotation with multiple return statements with one a recursive call
|
||||
var a = function f() {
|
||||
>a : any
|
||||
>function f() { return new Base(); return new Derived(); return f(); // ?} () : any
|
||||
>function f() { return new Base(); return new Derived(); return f(); // ?} : () => any
|
||||
>f : () => any
|
||||
|
||||
return new Base(); return new Derived(); return f(); // ?
|
||||
>new Base() : Base
|
||||
>Base : typeof Base
|
||||
>new Derived() : Derived
|
||||
>Derived : typeof Derived
|
||||
>f() : any
|
||||
>f : () => any
|
||||
|
||||
} ();
|
||||
|
||||
// FunctionExpression with non -void return type annotation with a single throw statement
|
||||
undefined === function (): number {
|
||||
>undefined === function (): number { throw undefined;} : boolean
|
||||
>undefined : undefined
|
||||
>function (): number { throw undefined;} : () => number
|
||||
|
||||
throw undefined;
|
||||
>undefined : undefined
|
||||
|
||||
};
|
||||
|
||||
// Type of 'this' in function implementation is 'any'
|
||||
function thisFunc() {
|
||||
>thisFunc : () => void
|
||||
|
||||
var x = this;
|
||||
>x : any
|
||||
>this : any
|
||||
|
||||
var x: any;
|
||||
>x : any
|
||||
}
|
||||
|
||||
// Function signature with optional parameter, no type annotation and initializer has initializer's type
|
||||
function opt1(n = 4) {
|
||||
>opt1 : (n?: number) => void
|
||||
>n : number
|
||||
>4 : number
|
||||
|
||||
var m = n;
|
||||
>m : number
|
||||
>n : number
|
||||
|
||||
var m: number;
|
||||
>m : number
|
||||
}
|
||||
|
||||
// Function signature with optional parameter, no type annotation and initializer has initializer's widened type
|
||||
function opt2(n = { x: null, y: undefined }) {
|
||||
>opt2 : (n?: { x: any; y: any; }) => void
|
||||
>n : { x: any; y: any; }
|
||||
>{ x: null, y: undefined } : { x: null; y: undefined; }
|
||||
>x : null
|
||||
>null : null
|
||||
>y : undefined
|
||||
>undefined : undefined
|
||||
|
||||
var m = n;
|
||||
>m : { x: any; y: any; }
|
||||
>n : { x: any; y: any; }
|
||||
|
||||
var m: { x: any; y: any };
|
||||
>m : { x: any; y: any; }
|
||||
>x : any
|
||||
>y : any
|
||||
}
|
||||
|
||||
// Function signature with initializer referencing other parameter to the left
|
||||
function opt3(n: number, m = n) {
|
||||
>opt3 : (n: number, m?: number) => void
|
||||
>n : number
|
||||
>m : number
|
||||
>n : number
|
||||
|
||||
var y = m;
|
||||
>y : number
|
||||
>m : number
|
||||
|
||||
var y: number;
|
||||
>y : number
|
||||
}
|
||||
|
||||
// Function signature with optional parameter has correct codegen
|
||||
// (tested above)
|
||||
|
||||
// FunctionExpression with non -void return type annotation return with no expression
|
||||
function f6(): number {
|
||||
>f6 : () => number
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
class Derived2 extends Base { private r: string; }
|
||||
>Derived2 : Derived2
|
||||
>Base : Base
|
||||
>r : string
|
||||
|
||||
class AnotherClass { private x }
|
||||
>AnotherClass : AnotherClass
|
||||
>x : any
|
||||
|
||||
// if f is a contextually typed function expression, the inferred return type is the union type
|
||||
// of the types of the return statement expressions in the function body,
|
||||
// ignoring return statements with no expressions.
|
||||
var f7: (x: number) => string | number = x => { // should be (x: number) => number | string
|
||||
>f7 : (x: number) => string | number
|
||||
>x : number
|
||||
>x => { // should be (x: number) => number | string if (x < 0) { return x; } return x.toString();} : (x: number) => number | string
|
||||
>x : number
|
||||
|
||||
if (x < 0) { return x; }
|
||||
>x < 0 : boolean
|
||||
>x : number
|
||||
>0 : number
|
||||
>x : number
|
||||
|
||||
return x.toString();
|
||||
>x.toString() : string
|
||||
>x.toString : (radix?: number) => string
|
||||
>x : number
|
||||
>toString : (radix?: number) => string
|
||||
}
|
||||
var f8: (x: number) => any = x => { // should be (x: number) => Base
|
||||
>f8 : (x: number) => any
|
||||
>x : number
|
||||
>x => { // should be (x: number) => Base return new Base(); return new Derived2();} : (x: number) => Base
|
||||
>x : number
|
||||
|
||||
return new Base();
|
||||
>new Base() : Base
|
||||
>Base : typeof Base
|
||||
|
||||
return new Derived2();
|
||||
>new Derived2() : Derived2
|
||||
>Derived2 : typeof Derived2
|
||||
}
|
||||
var f9: (x: number) => any = x => { // should be (x: number) => Base
|
||||
>f9 : (x: number) => any
|
||||
>x : number
|
||||
>x => { // should be (x: number) => Base return new Base(); return new Derived(); return new Derived2();} : (x: number) => Base
|
||||
>x : number
|
||||
|
||||
return new Base();
|
||||
>new Base() : Base
|
||||
>Base : typeof Base
|
||||
|
||||
return new Derived();
|
||||
>new Derived() : Derived
|
||||
>Derived : typeof Derived
|
||||
|
||||
return new Derived2();
|
||||
>new Derived2() : Derived2
|
||||
>Derived2 : typeof Derived2
|
||||
}
|
||||
var f10: (x: number) => any = x => { // should be (x: number) => Derived | Derived1
|
||||
>f10 : (x: number) => any
|
||||
>x : number
|
||||
>x => { // should be (x: number) => Derived | Derived1 return new Derived(); return new Derived2();} : (x: number) => Derived | Derived2
|
||||
>x : number
|
||||
|
||||
return new Derived();
|
||||
>new Derived() : Derived
|
||||
>Derived : typeof Derived
|
||||
|
||||
return new Derived2();
|
||||
>new Derived2() : Derived2
|
||||
>Derived2 : typeof Derived2
|
||||
}
|
||||
var f11: (x: number) => any = x => { // should be (x: number) => Base | AnotherClass
|
||||
>f11 : (x: number) => any
|
||||
>x : number
|
||||
>x => { // should be (x: number) => Base | AnotherClass return new Base(); return new AnotherClass();} : (x: number) => Base | AnotherClass
|
||||
>x : number
|
||||
|
||||
return new Base();
|
||||
>new Base() : Base
|
||||
>Base : typeof Base
|
||||
|
||||
return new AnotherClass();
|
||||
>new AnotherClass() : AnotherClass
|
||||
>AnotherClass : typeof AnotherClass
|
||||
}
|
||||
var f12: (x: number) => any = x => { // should be (x: number) => Base | AnotherClass
|
||||
>f12 : (x: number) => any
|
||||
>x : number
|
||||
>x => { // should be (x: number) => Base | AnotherClass return new Base(); return; // should be ignored return new AnotherClass();} : (x: number) => Base | AnotherClass
|
||||
>x : number
|
||||
|
||||
return new Base();
|
||||
>new Base() : Base
|
||||
>Base : typeof Base
|
||||
|
||||
return; // should be ignored
|
||||
return new AnotherClass();
|
||||
>new AnotherClass() : AnotherClass
|
||||
>AnotherClass : typeof AnotherClass
|
||||
}
|
||||
10
tests/baselines/reference/functionOverloads12.errors.txt
Normal file
10
tests/baselines/reference/functionOverloads12.errors.txt
Normal file
@ -0,0 +1,10 @@
|
||||
tests/cases/compiler/functionOverloads12.ts(3,48): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/functionOverloads12.ts (1 errors) ====
|
||||
function foo():string;
|
||||
function foo():number;
|
||||
function foo():any { if (true) return ""; else return 0;}
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
=== tests/cases/compiler/functionOverloads12.ts ===
|
||||
function foo():string;
|
||||
>foo : Symbol(foo, Decl(functionOverloads12.ts, 0, 0), Decl(functionOverloads12.ts, 0, 22), Decl(functionOverloads12.ts, 1, 22))
|
||||
|
||||
function foo():number;
|
||||
>foo : Symbol(foo, Decl(functionOverloads12.ts, 0, 0), Decl(functionOverloads12.ts, 0, 22), Decl(functionOverloads12.ts, 1, 22))
|
||||
|
||||
function foo():any { if (true) return ""; else return 0;}
|
||||
>foo : Symbol(foo, Decl(functionOverloads12.ts, 0, 0), Decl(functionOverloads12.ts, 0, 22), Decl(functionOverloads12.ts, 1, 22))
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
=== tests/cases/compiler/functionOverloads12.ts ===
|
||||
function foo():string;
|
||||
>foo : { (): string; (): number; }
|
||||
|
||||
function foo():number;
|
||||
>foo : { (): string; (): number; }
|
||||
|
||||
function foo():any { if (true) return ""; else return 0;}
|
||||
>foo : { (): string; (): number; }
|
||||
>true : boolean
|
||||
>"" : string
|
||||
>0 : number
|
||||
|
||||
23
tests/baselines/reference/functionReturn.errors.txt
Normal file
23
tests/baselines/reference/functionReturn.errors.txt
Normal file
@ -0,0 +1,23 @@
|
||||
tests/cases/compiler/functionReturn.ts(9,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/functionReturn.ts(13,5): error TS7027: Unreachable code detected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/functionReturn.ts (2 errors) ====
|
||||
function f0(): void { }
|
||||
function f1() {
|
||||
var n: any = f0();
|
||||
}
|
||||
function f2(): any { }
|
||||
function f3(): string { return; }
|
||||
function f4(): string {
|
||||
return '';
|
||||
return;
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
function f5(): string {
|
||||
return '';
|
||||
return undefined;
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
@ -1,30 +0,0 @@
|
||||
=== tests/cases/compiler/functionReturn.ts ===
|
||||
function f0(): void { }
|
||||
>f0 : Symbol(f0, Decl(functionReturn.ts, 0, 0))
|
||||
|
||||
function f1() {
|
||||
>f1 : Symbol(f1, Decl(functionReturn.ts, 0, 23))
|
||||
|
||||
var n: any = f0();
|
||||
>n : Symbol(n, Decl(functionReturn.ts, 2, 7))
|
||||
>f0 : Symbol(f0, Decl(functionReturn.ts, 0, 0))
|
||||
}
|
||||
function f2(): any { }
|
||||
>f2 : Symbol(f2, Decl(functionReturn.ts, 3, 1))
|
||||
|
||||
function f3(): string { return; }
|
||||
>f3 : Symbol(f3, Decl(functionReturn.ts, 4, 22))
|
||||
|
||||
function f4(): string {
|
||||
>f4 : Symbol(f4, Decl(functionReturn.ts, 5, 33))
|
||||
|
||||
return '';
|
||||
return;
|
||||
}
|
||||
function f5(): string {
|
||||
>f5 : Symbol(f5, Decl(functionReturn.ts, 9, 1))
|
||||
|
||||
return '';
|
||||
return undefined;
|
||||
>undefined : Symbol(undefined)
|
||||
}
|
||||
@ -1,35 +0,0 @@
|
||||
=== tests/cases/compiler/functionReturn.ts ===
|
||||
function f0(): void { }
|
||||
>f0 : () => void
|
||||
|
||||
function f1() {
|
||||
>f1 : () => void
|
||||
|
||||
var n: any = f0();
|
||||
>n : any
|
||||
>f0() : void
|
||||
>f0 : () => void
|
||||
}
|
||||
function f2(): any { }
|
||||
>f2 : () => any
|
||||
|
||||
function f3(): string { return; }
|
||||
>f3 : () => string
|
||||
|
||||
function f4(): string {
|
||||
>f4 : () => string
|
||||
|
||||
return '';
|
||||
>'' : string
|
||||
|
||||
return;
|
||||
}
|
||||
function f5(): string {
|
||||
>f5 : () => string
|
||||
|
||||
return '';
|
||||
>'' : string
|
||||
|
||||
return undefined;
|
||||
>undefined : undefined
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user