From e301cfe58c62454c06d3e6b173295296f2cd6857 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Thu, 10 Nov 2016 14:29:48 -0800 Subject: [PATCH 1/2] Raise literal type to its base in a comparison Similar to ===, except that it always applies, even when comparing two literals. --- src/compiler/checker.ts | 2 + .../relationalOperatorComparable.errors.txt | 40 +++++++++++++++++++ .../reference/relationalOperatorComparable.js | 34 ++++++++++++++++ .../compiler/relationalOperatorComparable.ts | 15 +++++++ 4 files changed, 91 insertions(+) create mode 100644 tests/baselines/reference/relationalOperatorComparable.errors.txt create mode 100644 tests/baselines/reference/relationalOperatorComparable.js create mode 100644 tests/cases/compiler/relationalOperatorComparable.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 1510979305b..e119c965f0f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -14241,6 +14241,8 @@ namespace ts { case SyntaxKind.LessThanEqualsToken: case SyntaxKind.GreaterThanEqualsToken: if (checkForDisallowedESSymbolOperand(operator)) { + leftType = getBaseTypeOfLiteralType(leftType); + rightType = getBaseTypeOfLiteralType(rightType); if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) { reportOperatorError(); } diff --git a/tests/baselines/reference/relationalOperatorComparable.errors.txt b/tests/baselines/reference/relationalOperatorComparable.errors.txt new file mode 100644 index 00000000000..bc48eaf92c0 --- /dev/null +++ b/tests/baselines/reference/relationalOperatorComparable.errors.txt @@ -0,0 +1,40 @@ +tests/cases/compiler/relationalOperatorComparable.ts(5,14): error TS2365: Operator '<' cannot be applied to types 'number' and 'boolean'. +tests/cases/compiler/relationalOperatorComparable.ts(6,14): error TS2365: Operator '<=' cannot be applied to types 'number' and 'boolean'. +tests/cases/compiler/relationalOperatorComparable.ts(7,14): error TS2365: Operator '>=' cannot be applied to types 'number' and 'boolean'. +tests/cases/compiler/relationalOperatorComparable.ts(8,14): error TS2365: Operator '>' cannot be applied to types 'number' and 'boolean'. +tests/cases/compiler/relationalOperatorComparable.ts(9,14): error TS2365: Operator '<' cannot be applied to types 'boolean' and 'number'. +tests/cases/compiler/relationalOperatorComparable.ts(10,14): error TS2365: Operator '<' cannot be applied to types 'boolean' and 'number'. +tests/cases/compiler/relationalOperatorComparable.ts(11,14): error TS2365: Operator '<' cannot be applied to types 'string' and 'number'. + + +==== tests/cases/compiler/relationalOperatorComparable.ts (7 errors) ==== + function f(onethree: 1 | 3, two: 2) { + const t = true; + const f = false; + let a1 = onethree < two; // ok + let a2 = onethree < true; // error, number and boolean + ~~~~~~~~~~~~~~~ +!!! error TS2365: Operator '<' cannot be applied to types 'number' and 'boolean'. + let a3 = onethree <= false; // error, number and boolean + ~~~~~~~~~~~~~~~~~ +!!! error TS2365: Operator '<=' cannot be applied to types 'number' and 'boolean'. + let a4 = onethree >= t; // error, number and boolean + ~~~~~~~~~~~~~ +!!! error TS2365: Operator '>=' cannot be applied to types 'number' and 'boolean'. + let a5 = onethree > f; // error, number and boolean + ~~~~~~~~~~~~ +!!! error TS2365: Operator '>' cannot be applied to types 'number' and 'boolean'. + let a6 = true < onethree; // error, boolean and number + ~~~~~~~~~~~~~~~ +!!! error TS2365: Operator '<' cannot be applied to types 'boolean' and 'number'. + let a7 = false < two; // error, boolean and number + ~~~~~~~~~~~ +!!! error TS2365: Operator '<' cannot be applied to types 'boolean' and 'number'. + let a8 = 'foo' < onethree; // error, string and number + ~~~~~~~~~~~~~~~~ +!!! error TS2365: Operator '<' cannot be applied to types 'string' and 'number'. + let a9 = onethree < 1; // ok + let a10 = 1 < two; // ok + let a11 = 2 < 1; // ok + } + \ No newline at end of file diff --git a/tests/baselines/reference/relationalOperatorComparable.js b/tests/baselines/reference/relationalOperatorComparable.js new file mode 100644 index 00000000000..019c257fe7d --- /dev/null +++ b/tests/baselines/reference/relationalOperatorComparable.js @@ -0,0 +1,34 @@ +//// [relationalOperatorComparable.ts] +function f(onethree: 1 | 3, two: 2) { + const t = true; + const f = false; + let a1 = onethree < two; // ok + let a2 = onethree < true; // error, number and boolean + let a3 = onethree <= false; // error, number and boolean + let a4 = onethree >= t; // error, number and boolean + let a5 = onethree > f; // error, number and boolean + let a6 = true < onethree; // error, boolean and number + let a7 = false < two; // error, boolean and number + let a8 = 'foo' < onethree; // error, string and number + let a9 = onethree < 1; // ok + let a10 = 1 < two; // ok + let a11 = 2 < 1; // ok +} + + +//// [relationalOperatorComparable.js] +function f(onethree, two) { + var t = true; + var f = false; + var a1 = onethree < two; // ok + var a2 = onethree < true; // error, number and boolean + var a3 = onethree <= false; // error, number and boolean + var a4 = onethree >= t; // error, number and boolean + var a5 = onethree > f; // error, number and boolean + var a6 = true < onethree; // error, boolean and number + var a7 = false < two; // error, boolean and number + var a8 = 'foo' < onethree; // error, string and number + var a9 = onethree < 1; // ok + var a10 = 1 < two; // ok + var a11 = 2 < 1; // ok +} diff --git a/tests/cases/compiler/relationalOperatorComparable.ts b/tests/cases/compiler/relationalOperatorComparable.ts new file mode 100644 index 00000000000..e95bb6e71cc --- /dev/null +++ b/tests/cases/compiler/relationalOperatorComparable.ts @@ -0,0 +1,15 @@ +function f(onethree: 1 | 3, two: 2) { + const t = true; + const f = false; + let a1 = onethree < two; // ok + let a2 = onethree < true; // error, number and boolean + let a3 = onethree <= false; // error, number and boolean + let a4 = onethree >= t; // error, number and boolean + let a5 = onethree > f; // error, number and boolean + let a6 = true < onethree; // error, boolean and number + let a7 = false < two; // error, boolean and number + let a8 = 'foo' < onethree; // error, string and number + let a9 = onethree < 1; // ok + let a10 = 1 < two; // ok + let a11 = 2 < 1; // ok +} From 07c47fea04d37209135ca542ac50d175f5c57e9c Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Thu, 10 Nov 2016 14:32:48 -0800 Subject: [PATCH 2/2] Update baselines Literal types caused a bunch of errors that masked some changes in baselines. Getting rid of these errors causes the baselines to update again. --- .../capturedLetConstInLoop1.errors.txt | 128 ---------- .../reference/capturedLetConstInLoop1.types | 138 +++++------ .../capturedLetConstInLoop1_ES6.errors.txt | 128 ---------- .../capturedLetConstInLoop1_ES6.types | 138 +++++------ .../capturedLetConstInLoop2.errors.txt | 191 -------------- .../reference/capturedLetConstInLoop2.types | 130 +++++----- .../capturedLetConstInLoop2_ES6.errors.txt | 190 -------------- .../capturedLetConstInLoop2_ES6.types | 130 +++++----- .../capturedLetConstInLoop3.errors.txt | 232 ----------------- .../reference/capturedLetConstInLoop3.types | 178 ++++++------- .../capturedLetConstInLoop3_ES6.errors.txt | 233 ------------------ .../capturedLetConstInLoop3_ES6.types | 178 ++++++------- .../capturedLetConstInLoop4.errors.txt | 158 ------------ .../reference/capturedLetConstInLoop4.types | 186 +++++++------- .../capturedLetConstInLoop4_ES6.errors.txt | 158 ------------ .../capturedLetConstInLoop4_ES6.types | 186 +++++++------- .../capturedLetConstInLoop5.errors.txt | 14 +- .../capturedLetConstInLoop5_ES6.errors.txt | 14 +- .../capturedLetConstInLoop6.errors.txt | 14 +- .../capturedLetConstInLoop6_ES6.errors.txt | 14 +- .../capturedLetConstInLoop7.errors.txt | 14 +- .../capturedLetConstInLoop7_ES6.errors.txt | 14 +- .../capturedLetConstInLoop8.errors.txt | 11 +- .../capturedLetConstInLoop8_ES6.errors.txt | 11 +- ...risonOperatorWithNumericLiteral.errors.txt | 58 ----- ...mparisonOperatorWithNumericLiteral.symbols | 97 ++++++++ ...comparisonOperatorWithNumericLiteral.types | 161 ++++++++++++ ...lOperatorConditionIsBooleanType.errors.txt | 71 ------ ...tionalOperatorConditionIsBooleanType.types | 48 ++-- .../constDeclarations-errors.errors.txt | 10 +- .../constDeclarations-scopes2.errors.txt | 21 -- .../reference/constDeclarations-scopes2.types | 24 +- .../reference/constDeclarations.errors.txt | 17 -- .../reference/constDeclarations.types | 32 +-- .../duplicateLocalVariable1.errors.txt | 4 +- .../duplicateLocalVariable2.errors.txt | 4 +- .../reference/grammarAmbiguities1.errors.txt | 4 +- ...arserGreaterThanTokenAmbiguity2.errors.txt | 4 +- ...arserGreaterThanTokenAmbiguity3.errors.txt | 4 +- ...arserGreaterThanTokenAmbiguity4.errors.txt | 4 +- ...eralTypesWithVariousOperators02.errors.txt | 5 +- 41 files changed, 965 insertions(+), 2391 deletions(-) delete mode 100644 tests/baselines/reference/capturedLetConstInLoop1.errors.txt delete mode 100644 tests/baselines/reference/capturedLetConstInLoop1_ES6.errors.txt delete mode 100644 tests/baselines/reference/capturedLetConstInLoop2.errors.txt delete mode 100644 tests/baselines/reference/capturedLetConstInLoop2_ES6.errors.txt delete mode 100644 tests/baselines/reference/capturedLetConstInLoop3.errors.txt delete mode 100644 tests/baselines/reference/capturedLetConstInLoop3_ES6.errors.txt delete mode 100644 tests/baselines/reference/capturedLetConstInLoop4.errors.txt delete mode 100644 tests/baselines/reference/capturedLetConstInLoop4_ES6.errors.txt delete mode 100644 tests/baselines/reference/comparisonOperatorWithNumericLiteral.errors.txt create mode 100644 tests/baselines/reference/comparisonOperatorWithNumericLiteral.symbols create mode 100644 tests/baselines/reference/comparisonOperatorWithNumericLiteral.types delete mode 100644 tests/baselines/reference/conditionalOperatorConditionIsBooleanType.errors.txt delete mode 100644 tests/baselines/reference/constDeclarations-scopes2.errors.txt delete mode 100644 tests/baselines/reference/constDeclarations.errors.txt diff --git a/tests/baselines/reference/capturedLetConstInLoop1.errors.txt b/tests/baselines/reference/capturedLetConstInLoop1.errors.txt deleted file mode 100644 index a10b380bcf9..00000000000 --- a/tests/baselines/reference/capturedLetConstInLoop1.errors.txt +++ /dev/null @@ -1,128 +0,0 @@ -tests/cases/compiler/capturedLetConstInLoop1.ts(69,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop1.ts(86,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop1.ts(92,26): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop1.ts(109,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'. - - -==== tests/cases/compiler/capturedLetConstInLoop1.ts (4 errors) ==== - //==== let - for (let x in {}) { - (function() { return x}); - (() => x); - } - - for (let x of []) { - (function() { return x}); - (() => x); - } - - for (let x = 0; x < 1; ++x) { - (function() { return x}); - (() => x); - } - - while (1 === 1) { - let x; - (function() { return x}); - (() => x); - } - - do { - let x; - (function() { return x}); - (() => x); - } while (1 === 1) - - for (let y = 0; y < 1; ++y) { - let x = 1; - (function() { return x}); - (() => x); - } - - for (let x = 0, y = 1; x < 1; ++x) { - (function() { return x + y}); - (() => x + y); - } - - while (1 === 1) { - let x, y; - (function() { return x + y}); - (() => x + y); - } - - do { - let x, y; - (function() { return x + y}); - (() => x + y); - } while (1 === 1) - - for (let y = 0; y < 1; ++y) { - let x = 1; - (function() { return x + y}); - (() => x + y); - } - - //=========const - for (const x in {}) { - (function() { return x}); - (() => x); - } - - for (const x of []) { - (function() { return x}); - (() => x); - } - - for (const x = 0; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - (function() { return x}); - (() => x); - } - - while (1 === 1) { - const x = 1; - (function() { return x}); - (() => x); - } - - do { - const x = 1; - (function() { return x}); - (() => x); - } while (1 === 1) - - for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - const x = 1; - (function() { return x}); - (() => x); - } - - for (const x = 0, y = 1; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - (function() { return x + y}); - (() => x + y); - } - - while (1 === 1) { - const x = 1, y = 1; - (function() { return x + y}); - (() => x + y); - } - - do { - const x = 1, y = 1; - (function() { return x + y}); - (() => x + y); - } while (1 === 1) - - for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - const x = 1; - (function() { return x + y}); - (() => x + y); - } \ No newline at end of file diff --git a/tests/baselines/reference/capturedLetConstInLoop1.types b/tests/baselines/reference/capturedLetConstInLoop1.types index c60ac25ce1f..45d4a1c9368 100644 --- a/tests/baselines/reference/capturedLetConstInLoop1.types +++ b/tests/baselines/reference/capturedLetConstInLoop1.types @@ -32,10 +32,10 @@ for (let x of []) { for (let x = 0; x < 1; ++x) { >x : number ->0 : number +>0 : 0 >x < 1 : boolean >x : number ->1 : number +>1 : 1 >++x : number >x : number @@ -90,16 +90,16 @@ do { for (let y = 0; y < 1; ++y) { >y : number ->0 : number +>0 : 0 >y < 1 : boolean >y : number ->1 : number +>1 : 1 >++y : number >y : number let x = 1; >x : number ->1 : number +>1 : 1 (function() { return x}); >(function() { return x}) : () => number @@ -114,12 +114,12 @@ for (let y = 0; y < 1; ++y) { for (let x = 0, y = 1; x < 1; ++x) { >x : number ->0 : number +>0 : 0 >y : number ->1 : number +>1 : 1 >x < 1 : boolean >x : number ->1 : number +>1 : 1 >++x : number >x : number @@ -188,16 +188,16 @@ do { for (let y = 0; y < 1; ++y) { >y : number ->0 : number +>0 : 0 >y < 1 : boolean >y : number ->1 : number +>1 : 1 >++y : number >y : number let x = 1; >x : number ->1 : number +>1 : 1 (function() { return x + y}); >(function() { return x + y}) : () => number @@ -246,21 +246,21 @@ for (const x of []) { } for (const x = 0; x < 1;) { ->x : number ->0 : number +>x : 0 +>0 : 0 >x < 1 : boolean ->x : number ->1 : number +>x : 0 +>1 : 1 (function() { return x}); >(function() { return x}) : () => number >function() { return x} : () => number ->x : number +>x : 0 (() => x); >(() => x) : () => number >() => x : () => number ->x : number +>x : 0 } while (1 === 1) { @@ -269,34 +269,34 @@ while (1 === 1) { >1 : 1 const x = 1; ->x : number ->1 : number +>x : 1 +>1 : 1 (function() { return x}); >(function() { return x}) : () => number >function() { return x} : () => number ->x : number +>x : 1 (() => x); >(() => x) : () => number >() => x : () => number ->x : number +>x : 1 } do { const x = 1; ->x : number ->1 : number +>x : 1 +>1 : 1 (function() { return x}); >(function() { return x}) : () => number >function() { return x} : () => number ->x : number +>x : 1 (() => x); >(() => x) : () => number >() => x : () => number ->x : number +>x : 1 } while (1 === 1) >1 === 1 : boolean @@ -304,49 +304,49 @@ do { >1 : 1 for (const y = 0; y < 1;) { ->y : number ->0 : number +>y : 0 +>0 : 0 >y < 1 : boolean ->y : number ->1 : number +>y : 0 +>1 : 1 const x = 1; ->x : number ->1 : number +>x : 1 +>1 : 1 (function() { return x}); >(function() { return x}) : () => number >function() { return x} : () => number ->x : number +>x : 1 (() => x); >(() => x) : () => number >() => x : () => number ->x : number +>x : 1 } for (const x = 0, y = 1; x < 1;) { ->x : number ->0 : number ->y : number ->1 : number +>x : 0 +>0 : 0 +>y : 1 +>1 : 1 >x < 1 : boolean ->x : number ->1 : number +>x : 0 +>1 : 1 (function() { return x + y}); >(function() { return x + y}) : () => number >function() { return x + y} : () => number >x + y : number ->x : number ->y : number +>x : 0 +>y : 1 (() => x + y); >(() => x + y) : () => number >() => x + y : () => number >x + y : number ->x : number ->y : number +>x : 0 +>y : 1 } while (1 === 1) { @@ -355,46 +355,46 @@ while (1 === 1) { >1 : 1 const x = 1, y = 1; ->x : number ->1 : number ->y : number ->1 : number +>x : 1 +>1 : 1 +>y : 1 +>1 : 1 (function() { return x + y}); >(function() { return x + y}) : () => number >function() { return x + y} : () => number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 (() => x + y); >(() => x + y) : () => number >() => x + y : () => number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 } do { const x = 1, y = 1; ->x : number ->1 : number ->y : number ->1 : number +>x : 1 +>1 : 1 +>y : 1 +>1 : 1 (function() { return x + y}); >(function() { return x + y}) : () => number >function() { return x + y} : () => number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 (() => x + y); >(() => x + y) : () => number >() => x + y : () => number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 } while (1 === 1) >1 === 1 : boolean @@ -402,27 +402,27 @@ do { >1 : 1 for (const y = 0; y < 1;) { ->y : number ->0 : number +>y : 0 +>0 : 0 >y < 1 : boolean ->y : number ->1 : number +>y : 0 +>1 : 1 const x = 1; ->x : number ->1 : number +>x : 1 +>1 : 1 (function() { return x + y}); >(function() { return x + y}) : () => number >function() { return x + y} : () => number >x + y : number ->x : number ->y : number +>x : 1 +>y : 0 (() => x + y); >(() => x + y) : () => number >() => x + y : () => number >x + y : number ->x : number ->y : number +>x : 1 +>y : 0 } diff --git a/tests/baselines/reference/capturedLetConstInLoop1_ES6.errors.txt b/tests/baselines/reference/capturedLetConstInLoop1_ES6.errors.txt deleted file mode 100644 index 24c5ddf17b6..00000000000 --- a/tests/baselines/reference/capturedLetConstInLoop1_ES6.errors.txt +++ /dev/null @@ -1,128 +0,0 @@ -tests/cases/compiler/capturedLetConstInLoop1_ES6.ts(69,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop1_ES6.ts(86,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop1_ES6.ts(92,26): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop1_ES6.ts(109,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'. - - -==== tests/cases/compiler/capturedLetConstInLoop1_ES6.ts (4 errors) ==== - //==== let - for (let x in {}) { - (function() { return x}); - (() => x); - } - - for (let x of []) { - (function() { return x}); - (() => x); - } - - for (let x = 0; x < 1; ++x) { - (function() { return x}); - (() => x); - } - - while (1 === 1) { - let x; - (function() { return x}); - (() => x); - } - - do { - let x; - (function() { return x}); - (() => x); - } while (1 === 1) - - for (let y = 0; y < 1; ++y) { - let x = 1; - (function() { return x}); - (() => x); - } - - for (let x = 0, y = 1; x < 1; ++x) { - (function() { return x + y}); - (() => x + y); - } - - while (1 === 1) { - let x, y; - (function() { return x + y}); - (() => x + y); - } - - do { - let x, y; - (function() { return x + y}); - (() => x + y); - } while (1 === 1) - - for (let y = 0; y < 1; ++y) { - let x = 1; - (function() { return x + y}); - (() => x + y); - } - - //=========const - for (const x in {}) { - (function() { return x}); - (() => x); - } - - for (const x of []) { - (function() { return x}); - (() => x); - } - - for (const x = 0; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - (function() { return x}); - (() => x); - } - - while (1 === 1) { - const x = 1; - (function() { return x}); - (() => x); - } - - do { - const x = 1; - (function() { return x}); - (() => x); - } while (1 === 1) - - for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - const x = 1; - (function() { return x}); - (() => x); - } - - for (const x = 0, y = 1; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - (function() { return x + y}); - (() => x + y); - } - - while (1 === 1) { - const x = 1, y = 1; - (function() { return x + y}); - (() => x + y); - } - - do { - const x = 1, y = 1; - (function() { return x + y}); - (() => x + y); - } while (1 === 1) - - for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - const x = 1; - (function() { return x + y}); - (() => x + y); - } \ No newline at end of file diff --git a/tests/baselines/reference/capturedLetConstInLoop1_ES6.types b/tests/baselines/reference/capturedLetConstInLoop1_ES6.types index cee71c0d5cd..5e803b35863 100644 --- a/tests/baselines/reference/capturedLetConstInLoop1_ES6.types +++ b/tests/baselines/reference/capturedLetConstInLoop1_ES6.types @@ -32,10 +32,10 @@ for (let x of []) { for (let x = 0; x < 1; ++x) { >x : number ->0 : number +>0 : 0 >x < 1 : boolean >x : number ->1 : number +>1 : 1 >++x : number >x : number @@ -90,16 +90,16 @@ do { for (let y = 0; y < 1; ++y) { >y : number ->0 : number +>0 : 0 >y < 1 : boolean >y : number ->1 : number +>1 : 1 >++y : number >y : number let x = 1; >x : number ->1 : number +>1 : 1 (function() { return x}); >(function() { return x}) : () => number @@ -114,12 +114,12 @@ for (let y = 0; y < 1; ++y) { for (let x = 0, y = 1; x < 1; ++x) { >x : number ->0 : number +>0 : 0 >y : number ->1 : number +>1 : 1 >x < 1 : boolean >x : number ->1 : number +>1 : 1 >++x : number >x : number @@ -188,16 +188,16 @@ do { for (let y = 0; y < 1; ++y) { >y : number ->0 : number +>0 : 0 >y < 1 : boolean >y : number ->1 : number +>1 : 1 >++y : number >y : number let x = 1; >x : number ->1 : number +>1 : 1 (function() { return x + y}); >(function() { return x + y}) : () => number @@ -246,21 +246,21 @@ for (const x of []) { } for (const x = 0; x < 1;) { ->x : number ->0 : number +>x : 0 +>0 : 0 >x < 1 : boolean ->x : number ->1 : number +>x : 0 +>1 : 1 (function() { return x}); >(function() { return x}) : () => number >function() { return x} : () => number ->x : number +>x : 0 (() => x); >(() => x) : () => number >() => x : () => number ->x : number +>x : 0 } while (1 === 1) { @@ -269,34 +269,34 @@ while (1 === 1) { >1 : 1 const x = 1; ->x : number ->1 : number +>x : 1 +>1 : 1 (function() { return x}); >(function() { return x}) : () => number >function() { return x} : () => number ->x : number +>x : 1 (() => x); >(() => x) : () => number >() => x : () => number ->x : number +>x : 1 } do { const x = 1; ->x : number ->1 : number +>x : 1 +>1 : 1 (function() { return x}); >(function() { return x}) : () => number >function() { return x} : () => number ->x : number +>x : 1 (() => x); >(() => x) : () => number >() => x : () => number ->x : number +>x : 1 } while (1 === 1) >1 === 1 : boolean @@ -304,49 +304,49 @@ do { >1 : 1 for (const y = 0; y < 1;) { ->y : number ->0 : number +>y : 0 +>0 : 0 >y < 1 : boolean ->y : number ->1 : number +>y : 0 +>1 : 1 const x = 1; ->x : number ->1 : number +>x : 1 +>1 : 1 (function() { return x}); >(function() { return x}) : () => number >function() { return x} : () => number ->x : number +>x : 1 (() => x); >(() => x) : () => number >() => x : () => number ->x : number +>x : 1 } for (const x = 0, y = 1; x < 1;) { ->x : number ->0 : number ->y : number ->1 : number +>x : 0 +>0 : 0 +>y : 1 +>1 : 1 >x < 1 : boolean ->x : number ->1 : number +>x : 0 +>1 : 1 (function() { return x + y}); >(function() { return x + y}) : () => number >function() { return x + y} : () => number >x + y : number ->x : number ->y : number +>x : 0 +>y : 1 (() => x + y); >(() => x + y) : () => number >() => x + y : () => number >x + y : number ->x : number ->y : number +>x : 0 +>y : 1 } while (1 === 1) { @@ -355,46 +355,46 @@ while (1 === 1) { >1 : 1 const x = 1, y = 1; ->x : number ->1 : number ->y : number ->1 : number +>x : 1 +>1 : 1 +>y : 1 +>1 : 1 (function() { return x + y}); >(function() { return x + y}) : () => number >function() { return x + y} : () => number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 (() => x + y); >(() => x + y) : () => number >() => x + y : () => number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 } do { const x = 1, y = 1; ->x : number ->1 : number ->y : number ->1 : number +>x : 1 +>1 : 1 +>y : 1 +>1 : 1 (function() { return x + y}); >(function() { return x + y}) : () => number >function() { return x + y} : () => number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 (() => x + y); >(() => x + y) : () => number >() => x + y : () => number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 } while (1 === 1) >1 === 1 : boolean @@ -402,27 +402,27 @@ do { >1 : 1 for (const y = 0; y < 1;) { ->y : number ->0 : number +>y : 0 +>0 : 0 >y < 1 : boolean ->y : number ->1 : number +>y : 0 +>1 : 1 const x = 1; ->x : number ->1 : number +>x : 1 +>1 : 1 (function() { return x + y}); >(function() { return x + y}) : () => number >function() { return x + y} : () => number >x + y : number ->x : number ->y : number +>x : 1 +>y : 0 (() => x + y); >(() => x + y) : () => number >() => x + y : () => number >x + y : number ->x : number ->y : number +>x : 1 +>y : 0 } diff --git a/tests/baselines/reference/capturedLetConstInLoop2.errors.txt b/tests/baselines/reference/capturedLetConstInLoop2.errors.txt deleted file mode 100644 index 9125a87ecfe..00000000000 --- a/tests/baselines/reference/capturedLetConstInLoop2.errors.txt +++ /dev/null @@ -1,191 +0,0 @@ -tests/cases/compiler/capturedLetConstInLoop2.ts(108,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop2.ts(133,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop2.ts(142,30): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop2.ts(170,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'. - - -==== tests/cases/compiler/capturedLetConstInLoop2.ts (4 errors) ==== - - - // ========let - function foo0(x) { - for (let x of []) { - let a = arguments.length; - (function() { return x + a }); - (() => x + a); - } - } - - function foo0_1(x) { - for (let x in []) { - let a = arguments.length; - (function() { return x + a }); - (() => x + a); - } - } - - function foo1(x) { - for (let x = 0; x < 1; ++x) { - let a = arguments.length; - (function() { return x + a }); - (() => x + a); - } - } - - function foo2(x) { - while (1 === 1) { - let a = arguments.length; - (function() { return x + a }); - (() => x + a); - } - } - - function foo3(x) { - do { - let x; - let a = arguments.length; - (function() { return x + a }); - (() => x + a); - } while (1 === 1) - } - - function foo4(x) { - for (let y = 0; y < 1; ++y) { - let a = arguments.length; - let x = 1; - (function() { return x + a }); - (() => x + a); - } - } - - function foo5(x) { - for (let x = 0, y = 1; x < 1; ++x) { - let a = arguments.length; - (function() { return x + y + a }); - (() => x + y + a); - } - } - - - function foo6(x) { - while (1 === 1) { - let x, y; - let a = arguments.length; - (function() { return x + y + a }); - (() => x + y + a); - } - } - - function foo7(x) { - do { - let x, y; - let a = arguments.length; - (function() { return x + y + a }); - (() => x + y + a); - } while (1 === 1) - } - - - function foo8(x) { - for (let y = 0; y < 1; ++y) { - let x = 1; - let a = arguments.length; - (function() { return x + y + a }); - (() => x + y + a); - } - } - ///=======const - function foo0_c(x) { - for (const x of []) { - const a = arguments.length; - (function() { return x + a }); - (() => x + a); - } - } - - function foo0_1_c(x) { - for (const x in []) { - const a = arguments.length; - (function() { return x + a }); - (() => x + a); - } - } - - function foo1_c(x) { - for (const x = 0; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - const a = arguments.length; - (function() { return x + a }); - (() => x + a); - } - } - - function foo2_c(x) { - while (1 === 1) { - const a = arguments.length; - (function() { return x + a }); - (() => x + a); - } - } - - function foo3_c(x) { - do { - const x = 1; - const a = arguments.length; - (function() { return x + a }); - (() => x + a); - } while (1 === 1) - } - - function foo4_c(x) { - for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - const a = arguments.length; - const x = 1; - (function() { return x + a }); - (() => x + a); - } - } - - function foo5_c(x) { - for (const x = 0, y = 1; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - const a = arguments.length; - (function() { return x + y + a }); - (() => x + y + a); - } - } - - - function foo6_c(x) { - while (1 === 1) { - const x = 1, y =1 ; - const a = arguments.length; - (function() { return x + y + a }); - (() => x + y + a); - } - } - - function foo7_c(x) { - do { - const x = 1, y = 1; - const a = arguments.length; - (function() { return x + y + a }); - (() => x + y + a); - } while (1 === 1) - } - - - function foo8_c(x) { - for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - const x = 1; - const a = arguments.length; - (function() { return x + y + a }); - (() => x + y + a); - } - } \ No newline at end of file diff --git a/tests/baselines/reference/capturedLetConstInLoop2.types b/tests/baselines/reference/capturedLetConstInLoop2.types index f4f7a926f89..4f819d3c3f9 100644 --- a/tests/baselines/reference/capturedLetConstInLoop2.types +++ b/tests/baselines/reference/capturedLetConstInLoop2.types @@ -68,10 +68,10 @@ function foo1(x) { for (let x = 0; x < 1; ++x) { >x : number ->0 : number +>0 : 0 >x < 1 : boolean >x : number ->1 : number +>1 : 1 >++x : number >x : number @@ -168,10 +168,10 @@ function foo4(x) { for (let y = 0; y < 1; ++y) { >y : number ->0 : number +>0 : 0 >y < 1 : boolean >y : number ->1 : number +>1 : 1 >++y : number >y : number @@ -183,7 +183,7 @@ function foo4(x) { let x = 1; >x : number ->1 : number +>1 : 1 (function() { return x + a }); >(function() { return x + a }) : () => number @@ -207,12 +207,12 @@ function foo5(x) { for (let x = 0, y = 1; x < 1; ++x) { >x : number ->0 : number +>0 : 0 >y : number ->1 : number +>1 : 1 >x < 1 : boolean >x : number ->1 : number +>1 : 1 >++x : number >x : number @@ -328,16 +328,16 @@ function foo8(x) { for (let y = 0; y < 1; ++y) { >y : number ->0 : number +>0 : 0 >y < 1 : boolean >y : number ->1 : number +>1 : 1 >++y : number >y : number let x = 1; >x : number ->1 : number +>1 : 1 let a = arguments.length; >a : number @@ -430,11 +430,11 @@ function foo1_c(x) { >x : any for (const x = 0; x < 1;) { ->x : number ->0 : number +>x : 0 +>0 : 0 >x < 1 : boolean ->x : number ->1 : number +>x : 0 +>1 : 1 const a = arguments.length; >a : number @@ -446,14 +446,14 @@ function foo1_c(x) { >(function() { return x + a }) : () => number >function() { return x + a } : () => number >x + a : number ->x : number +>x : 0 >a : number (() => x + a); >(() => x + a) : () => number >() => x + a : () => number >x + a : number ->x : number +>x : 0 >a : number } } @@ -495,8 +495,8 @@ function foo3_c(x) { do { const x = 1; ->x : number ->1 : number +>x : 1 +>1 : 1 const a = arguments.length; >a : number @@ -508,14 +508,14 @@ function foo3_c(x) { >(function() { return x + a }) : () => number >function() { return x + a } : () => number >x + a : number ->x : number +>x : 1 >a : number (() => x + a); >(() => x + a) : () => number >() => x + a : () => number >x + a : number ->x : number +>x : 1 >a : number } while (1 === 1) @@ -529,11 +529,11 @@ function foo4_c(x) { >x : any for (const y = 0; y < 1;) { ->y : number ->0 : number +>y : 0 +>0 : 0 >y < 1 : boolean ->y : number ->1 : number +>y : 0 +>1 : 1 const a = arguments.length; >a : number @@ -542,21 +542,21 @@ function foo4_c(x) { >length : number const x = 1; ->x : number ->1 : number +>x : 1 +>1 : 1 (function() { return x + a }); >(function() { return x + a }) : () => number >function() { return x + a } : () => number >x + a : number ->x : number +>x : 1 >a : number (() => x + a); >(() => x + a) : () => number >() => x + a : () => number >x + a : number ->x : number +>x : 1 >a : number } } @@ -566,13 +566,13 @@ function foo5_c(x) { >x : any for (const x = 0, y = 1; x < 1;) { ->x : number ->0 : number ->y : number ->1 : number +>x : 0 +>0 : 0 +>y : 1 +>1 : 1 >x < 1 : boolean ->x : number ->1 : number +>x : 0 +>1 : 1 const a = arguments.length; >a : number @@ -585,8 +585,8 @@ function foo5_c(x) { >function() { return x + y + a } : () => number >x + y + a : number >x + y : number ->x : number ->y : number +>x : 0 +>y : 1 >a : number (() => x + y + a); @@ -594,8 +594,8 @@ function foo5_c(x) { >() => x + y + a : () => number >x + y + a : number >x + y : number ->x : number ->y : number +>x : 0 +>y : 1 >a : number } } @@ -611,10 +611,10 @@ function foo6_c(x) { >1 : 1 const x = 1, y =1 ; ->x : number ->1 : number ->y : number ->1 : number +>x : 1 +>1 : 1 +>y : 1 +>1 : 1 const a = arguments.length; >a : number @@ -627,8 +627,8 @@ function foo6_c(x) { >function() { return x + y + a } : () => number >x + y + a : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 >a : number (() => x + y + a); @@ -636,8 +636,8 @@ function foo6_c(x) { >() => x + y + a : () => number >x + y + a : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 >a : number } } @@ -648,10 +648,10 @@ function foo7_c(x) { do { const x = 1, y = 1; ->x : number ->1 : number ->y : number ->1 : number +>x : 1 +>1 : 1 +>y : 1 +>1 : 1 const a = arguments.length; >a : number @@ -664,8 +664,8 @@ function foo7_c(x) { >function() { return x + y + a } : () => number >x + y + a : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 >a : number (() => x + y + a); @@ -673,8 +673,8 @@ function foo7_c(x) { >() => x + y + a : () => number >x + y + a : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 >a : number } while (1 === 1) @@ -689,15 +689,15 @@ function foo8_c(x) { >x : any for (const y = 0; y < 1;) { ->y : number ->0 : number +>y : 0 +>0 : 0 >y < 1 : boolean ->y : number ->1 : number +>y : 0 +>1 : 1 const x = 1; ->x : number ->1 : number +>x : 1 +>1 : 1 const a = arguments.length; >a : number @@ -710,8 +710,8 @@ function foo8_c(x) { >function() { return x + y + a } : () => number >x + y + a : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 0 >a : number (() => x + y + a); @@ -719,8 +719,8 @@ function foo8_c(x) { >() => x + y + a : () => number >x + y + a : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 0 >a : number } } diff --git a/tests/baselines/reference/capturedLetConstInLoop2_ES6.errors.txt b/tests/baselines/reference/capturedLetConstInLoop2_ES6.errors.txt deleted file mode 100644 index d61bf3619c7..00000000000 --- a/tests/baselines/reference/capturedLetConstInLoop2_ES6.errors.txt +++ /dev/null @@ -1,190 +0,0 @@ -tests/cases/compiler/capturedLetConstInLoop2_ES6.ts(107,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop2_ES6.ts(132,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop2_ES6.ts(141,30): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop2_ES6.ts(169,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'. - - -==== tests/cases/compiler/capturedLetConstInLoop2_ES6.ts (4 errors) ==== - - // ========let - function foo0(x) { - for (let x of []) { - let a = arguments.length; - (function() { return x + a }); - (() => x + a); - } - } - - function foo0_1(x) { - for (let x in []) { - let a = arguments.length; - (function() { return x + a }); - (() => x + a); - } - } - - function foo1(x) { - for (let x = 0; x < 1; ++x) { - let a = arguments.length; - (function() { return x + a }); - (() => x + a); - } - } - - function foo2(x) { - while (1 === 1) { - let a = arguments.length; - (function() { return x + a }); - (() => x + a); - } - } - - function foo3(x) { - do { - let x; - let a = arguments.length; - (function() { return x + a }); - (() => x + a); - } while (1 === 1) - } - - function foo4(x) { - for (let y = 0; y < 1; ++y) { - let a = arguments.length; - let x = 1; - (function() { return x + a }); - (() => x + a); - } - } - - function foo5(x) { - for (let x = 0, y = 1; x < 1; ++x) { - let a = arguments.length; - (function() { return x + y + a }); - (() => x + y + a); - } - } - - - function foo6(x) { - while (1 === 1) { - let x, y; - let a = arguments.length; - (function() { return x + y + a }); - (() => x + y + a); - } - } - - function foo7(x) { - do { - let x, y; - let a = arguments.length; - (function() { return x + y + a }); - (() => x + y + a); - } while (1 === 1) - } - - - function foo8(x) { - for (let y = 0; y < 1; ++y) { - let x = 1; - let a = arguments.length; - (function() { return x + y + a }); - (() => x + y + a); - } - } - ///=======const - function foo0_c(x) { - for (const x of []) { - const a = arguments.length; - (function() { return x + a }); - (() => x + a); - } - } - - function foo0_1_c(x) { - for (const x in []) { - const a = arguments.length; - (function() { return x + a }); - (() => x + a); - } - } - - function foo1_c(x) { - for (const x = 0; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - const a = arguments.length; - (function() { return x + a }); - (() => x + a); - } - } - - function foo2_c(x) { - while (1 === 1) { - const a = arguments.length; - (function() { return x + a }); - (() => x + a); - } - } - - function foo3_c(x) { - do { - const x = 1; - const a = arguments.length; - (function() { return x + a }); - (() => x + a); - } while (1 === 1) - } - - function foo4_c(x) { - for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - const a = arguments.length; - const x = 1; - (function() { return x + a }); - (() => x + a); - } - } - - function foo5_c(x) { - for (const x = 0, y = 1; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - const a = arguments.length; - (function() { return x + y + a }); - (() => x + y + a); - } - } - - - function foo6_c(x) { - while (1 === 1) { - const x = 1, y =1 ; - const a = arguments.length; - (function() { return x + y + a }); - (() => x + y + a); - } - } - - function foo7_c(x) { - do { - const x = 1, y = 1; - const a = arguments.length; - (function() { return x + y + a }); - (() => x + y + a); - } while (1 === 1) - } - - - function foo8_c(x) { - for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - const x = 1; - const a = arguments.length; - (function() { return x + y + a }); - (() => x + y + a); - } - } \ No newline at end of file diff --git a/tests/baselines/reference/capturedLetConstInLoop2_ES6.types b/tests/baselines/reference/capturedLetConstInLoop2_ES6.types index 80e455e44ce..e72221d85cd 100644 --- a/tests/baselines/reference/capturedLetConstInLoop2_ES6.types +++ b/tests/baselines/reference/capturedLetConstInLoop2_ES6.types @@ -67,10 +67,10 @@ function foo1(x) { for (let x = 0; x < 1; ++x) { >x : number ->0 : number +>0 : 0 >x < 1 : boolean >x : number ->1 : number +>1 : 1 >++x : number >x : number @@ -167,10 +167,10 @@ function foo4(x) { for (let y = 0; y < 1; ++y) { >y : number ->0 : number +>0 : 0 >y < 1 : boolean >y : number ->1 : number +>1 : 1 >++y : number >y : number @@ -182,7 +182,7 @@ function foo4(x) { let x = 1; >x : number ->1 : number +>1 : 1 (function() { return x + a }); >(function() { return x + a }) : () => number @@ -206,12 +206,12 @@ function foo5(x) { for (let x = 0, y = 1; x < 1; ++x) { >x : number ->0 : number +>0 : 0 >y : number ->1 : number +>1 : 1 >x < 1 : boolean >x : number ->1 : number +>1 : 1 >++x : number >x : number @@ -327,16 +327,16 @@ function foo8(x) { for (let y = 0; y < 1; ++y) { >y : number ->0 : number +>0 : 0 >y < 1 : boolean >y : number ->1 : number +>1 : 1 >++y : number >y : number let x = 1; >x : number ->1 : number +>1 : 1 let a = arguments.length; >a : number @@ -429,11 +429,11 @@ function foo1_c(x) { >x : any for (const x = 0; x < 1;) { ->x : number ->0 : number +>x : 0 +>0 : 0 >x < 1 : boolean ->x : number ->1 : number +>x : 0 +>1 : 1 const a = arguments.length; >a : number @@ -445,14 +445,14 @@ function foo1_c(x) { >(function() { return x + a }) : () => number >function() { return x + a } : () => number >x + a : number ->x : number +>x : 0 >a : number (() => x + a); >(() => x + a) : () => number >() => x + a : () => number >x + a : number ->x : number +>x : 0 >a : number } } @@ -494,8 +494,8 @@ function foo3_c(x) { do { const x = 1; ->x : number ->1 : number +>x : 1 +>1 : 1 const a = arguments.length; >a : number @@ -507,14 +507,14 @@ function foo3_c(x) { >(function() { return x + a }) : () => number >function() { return x + a } : () => number >x + a : number ->x : number +>x : 1 >a : number (() => x + a); >(() => x + a) : () => number >() => x + a : () => number >x + a : number ->x : number +>x : 1 >a : number } while (1 === 1) @@ -528,11 +528,11 @@ function foo4_c(x) { >x : any for (const y = 0; y < 1;) { ->y : number ->0 : number +>y : 0 +>0 : 0 >y < 1 : boolean ->y : number ->1 : number +>y : 0 +>1 : 1 const a = arguments.length; >a : number @@ -541,21 +541,21 @@ function foo4_c(x) { >length : number const x = 1; ->x : number ->1 : number +>x : 1 +>1 : 1 (function() { return x + a }); >(function() { return x + a }) : () => number >function() { return x + a } : () => number >x + a : number ->x : number +>x : 1 >a : number (() => x + a); >(() => x + a) : () => number >() => x + a : () => number >x + a : number ->x : number +>x : 1 >a : number } } @@ -565,13 +565,13 @@ function foo5_c(x) { >x : any for (const x = 0, y = 1; x < 1;) { ->x : number ->0 : number ->y : number ->1 : number +>x : 0 +>0 : 0 +>y : 1 +>1 : 1 >x < 1 : boolean ->x : number ->1 : number +>x : 0 +>1 : 1 const a = arguments.length; >a : number @@ -584,8 +584,8 @@ function foo5_c(x) { >function() { return x + y + a } : () => number >x + y + a : number >x + y : number ->x : number ->y : number +>x : 0 +>y : 1 >a : number (() => x + y + a); @@ -593,8 +593,8 @@ function foo5_c(x) { >() => x + y + a : () => number >x + y + a : number >x + y : number ->x : number ->y : number +>x : 0 +>y : 1 >a : number } } @@ -610,10 +610,10 @@ function foo6_c(x) { >1 : 1 const x = 1, y =1 ; ->x : number ->1 : number ->y : number ->1 : number +>x : 1 +>1 : 1 +>y : 1 +>1 : 1 const a = arguments.length; >a : number @@ -626,8 +626,8 @@ function foo6_c(x) { >function() { return x + y + a } : () => number >x + y + a : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 >a : number (() => x + y + a); @@ -635,8 +635,8 @@ function foo6_c(x) { >() => x + y + a : () => number >x + y + a : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 >a : number } } @@ -647,10 +647,10 @@ function foo7_c(x) { do { const x = 1, y = 1; ->x : number ->1 : number ->y : number ->1 : number +>x : 1 +>1 : 1 +>y : 1 +>1 : 1 const a = arguments.length; >a : number @@ -663,8 +663,8 @@ function foo7_c(x) { >function() { return x + y + a } : () => number >x + y + a : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 >a : number (() => x + y + a); @@ -672,8 +672,8 @@ function foo7_c(x) { >() => x + y + a : () => number >x + y + a : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 >a : number } while (1 === 1) @@ -688,15 +688,15 @@ function foo8_c(x) { >x : any for (const y = 0; y < 1;) { ->y : number ->0 : number +>y : 0 +>0 : 0 >y < 1 : boolean ->y : number ->1 : number +>y : 0 +>1 : 1 const x = 1; ->x : number ->1 : number +>x : 1 +>1 : 1 const a = arguments.length; >a : number @@ -709,8 +709,8 @@ function foo8_c(x) { >function() { return x + y + a } : () => number >x + y + a : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 0 >a : number (() => x + y + a); @@ -718,8 +718,8 @@ function foo8_c(x) { >() => x + y + a : () => number >x + y + a : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 0 >a : number } } diff --git a/tests/baselines/reference/capturedLetConstInLoop3.errors.txt b/tests/baselines/reference/capturedLetConstInLoop3.errors.txt deleted file mode 100644 index ecc9dbcccc5..00000000000 --- a/tests/baselines/reference/capturedLetConstInLoop3.errors.txt +++ /dev/null @@ -1,232 +0,0 @@ -tests/cases/compiler/capturedLetConstInLoop3.ts(132,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop3.ts(164,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop3.ts(175,30): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop3.ts(209,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'. - - -==== tests/cases/compiler/capturedLetConstInLoop3.ts (4 errors) ==== - ///=========let - declare function use(a: any); - function foo0(x) { - for (let x of []) { - var v = x; - (function() { return x + v }); - (() => x + v); - } - - use(v); - } - - function foo0_1(x) { - for (let x in []) { - var v = x; - (function() { return x + v }); - (() => x + v); - } - - use(v); - } - - function foo1(x) { - for (let x = 0; x < 1; ++x) { - var v = x; - (function() { return x + v }); - (() => x + v); - } - - use(v); - } - - function foo2(x) { - while (1 === 1) { - let x = 1; - var v = x; - (function() { return x + v }); - (() => x + v); - } - - use(v); - } - - function foo3(x) { - do { - let x; - var v; - (function() { return x + v }); - (() => x + v); - } while (1 === 1); - - use(v); - } - - function foo4(x) { - for (let y = 0; y < 1; ++y) { - var v = y; - let x = 1; - (function() { return x + v }); - (() => x + v); - } - - use(v); - } - - function foo5(x) { - for (let x = 0, y = 1; x < 1; ++x) { - var v = x; - (function() { return x + y + v }); - (() => x + y + v); - } - - use(v); - } - - - function foo6(x) { - while (1 === 1) { - let x, y; - var v = x; - (function() { return x + y + v }); - (() => x + y + v); - } - - use(v) - } - - function foo7(x) { - do { - let x, y; - var v = x; - (function() { return x + y + v }); - (() => x + y + v); - } while (1 === 1); - - use(v); - } - - - function foo8(x) { - for (let y = 0; y < 1; ++y) { - let x = 1; - var v = x; - (function() { return x + y + v }); - (() => x + y + v); - } - - use(v); - } - //===const - function foo0_c(x) { - for (const x of []) { - var v = x; - (function() { return x + v }); - (() => x + v); - } - - use(v); - } - - function foo0_1_c(x) { - for (const x in []) { - var v = x; - (function() { return x + v }); - (() => x + v); - } - - use(v); - } - - function foo1_c(x) { - for (const x = 0; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - var v = x; - (function() { return x + v }); - (() => x + v); - } - - use(v); - } - - function foo2_c(x) { - while (1 === 1) { - const x = 1; - var v = x; - (function() { return x + v }); - (() => x + v); - } - - use(v); - } - - function foo3_c(x) { - do { - const x = 1; - var v; - (function() { return x + v }); - (() => x + v); - } while (1 === 1); - - use(v); - } - - function foo4_c(x) { - for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - var v = y; - const x = 1; - (function() { return x + v }); - (() => x + v); - } - - use(v); - } - - function foo5_c(x) { - for (const x = 0, y = 1; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - var v = x; - (function() { return x + y + v }); - (() => x + y + v); - } - - use(v); - } - - - function foo6_c(x) { - while (1 === 1) { - const x = 1, y = 1; - var v = x; - (function() { return x + y + v }); - (() => x + y + v); - } - - use(v) - } - - function foo7_c(x) { - do { - const x = 1, y = 1; - var v = x; - (function() { return x + y + v }); - (() => x + y + v); - } while (1 === 1); - - use(v); - } - - - function foo8_c(x) { - for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - const x = 1; - var v = x; - (function() { return x + y + v }); - (() => x + y + v); - } - - use(v); - } \ No newline at end of file diff --git a/tests/baselines/reference/capturedLetConstInLoop3.types b/tests/baselines/reference/capturedLetConstInLoop3.types index 3f35072fdb2..1fee8db67c4 100644 --- a/tests/baselines/reference/capturedLetConstInLoop3.types +++ b/tests/baselines/reference/capturedLetConstInLoop3.types @@ -76,10 +76,10 @@ function foo1(x) { for (let x = 0; x < 1; ++x) { >x : number ->0 : number +>0 : 0 >x < 1 : boolean >x : number ->1 : number +>1 : 1 >++x : number >x : number @@ -119,7 +119,7 @@ function foo2(x) { let x = 1; >x : number ->1 : number +>1 : 1 var v = x; >v : number @@ -179,7 +179,7 @@ function foo3(x) { use(v); >use(v) : any >use : (a: any) => any ->v : any +>v : undefined } function foo4(x) { @@ -188,10 +188,10 @@ function foo4(x) { for (let y = 0; y < 1; ++y) { >y : number ->0 : number +>0 : 0 >y < 1 : boolean >y : number ->1 : number +>1 : 1 >++y : number >y : number @@ -201,7 +201,7 @@ function foo4(x) { let x = 1; >x : number ->1 : number +>1 : 1 (function() { return x + v }); >(function() { return x + v }) : () => number @@ -230,12 +230,12 @@ function foo5(x) { for (let x = 0, y = 1; x < 1; ++x) { >x : number ->0 : number +>0 : 0 >y : number ->1 : number +>1 : 1 >x < 1 : boolean >x : number ->1 : number +>1 : 1 >++x : number >x : number @@ -283,8 +283,8 @@ function foo6(x) { >y : any var v = x; ->v : any ->x : any +>v : undefined +>x : undefined (function() { return x + y + v }); >(function() { return x + y + v }) : () => any @@ -293,7 +293,7 @@ function foo6(x) { >x + y : any >x : any >y : any ->v : any +>v : undefined (() => x + y + v); >(() => x + y + v) : () => any @@ -302,13 +302,13 @@ function foo6(x) { >x + y : any >x : any >y : any ->v : any +>v : undefined } use(v) >use(v) : any >use : (a: any) => any ->v : any +>v : undefined } function foo7(x) { @@ -321,8 +321,8 @@ function foo7(x) { >y : any var v = x; ->v : any ->x : any +>v : undefined +>x : undefined (function() { return x + y + v }); >(function() { return x + y + v }) : () => any @@ -331,7 +331,7 @@ function foo7(x) { >x + y : any >x : any >y : any ->v : any +>v : undefined (() => x + y + v); >(() => x + y + v) : () => any @@ -340,7 +340,7 @@ function foo7(x) { >x + y : any >x : any >y : any ->v : any +>v : undefined } while (1 === 1); >1 === 1 : boolean @@ -350,7 +350,7 @@ function foo7(x) { use(v); >use(v) : any >use : (a: any) => any ->v : any +>v : undefined } @@ -360,16 +360,16 @@ function foo8(x) { for (let y = 0; y < 1; ++y) { >y : number ->0 : number +>0 : 0 >y < 1 : boolean >y : number ->1 : number +>1 : 1 >++y : number >y : number let x = 1; >x : number ->1 : number +>1 : 1 var v = x; >v : number @@ -471,28 +471,28 @@ function foo1_c(x) { >x : any for (const x = 0; x < 1;) { ->x : number ->0 : number +>x : 0 +>0 : 0 >x < 1 : boolean ->x : number ->1 : number +>x : 0 +>1 : 1 var v = x; >v : number ->x : number +>x : 0 (function() { return x + v }); >(function() { return x + v }) : () => number >function() { return x + v } : () => number >x + v : number ->x : number +>x : 0 >v : number (() => x + v); >(() => x + v) : () => number >() => x + v : () => number >x + v : number ->x : number +>x : 0 >v : number } @@ -512,25 +512,25 @@ function foo2_c(x) { >1 : 1 const x = 1; ->x : number ->1 : number +>x : 1 +>1 : 1 var v = x; >v : number ->x : number +>x : 1 (function() { return x + v }); >(function() { return x + v }) : () => number >function() { return x + v } : () => number >x + v : number ->x : number +>x : 1 >v : number (() => x + v); >(() => x + v) : () => number >() => x + v : () => number >x + v : number ->x : number +>x : 1 >v : number } @@ -546,8 +546,8 @@ function foo3_c(x) { do { const x = 1; ->x : number ->1 : number +>x : 1 +>1 : 1 var v; >v : any @@ -556,14 +556,14 @@ function foo3_c(x) { >(function() { return x + v }) : () => any >function() { return x + v } : () => any >x + v : any ->x : number +>x : 1 >v : any (() => x + v); >(() => x + v) : () => any >() => x + v : () => any >x + v : any ->x : number +>x : 1 >v : any } while (1 === 1); @@ -574,7 +574,7 @@ function foo3_c(x) { use(v); >use(v) : any >use : (a: any) => any ->v : any +>v : undefined } function foo4_c(x) { @@ -582,32 +582,32 @@ function foo4_c(x) { >x : any for (const y = 0; y < 1;) { ->y : number ->0 : number +>y : 0 +>0 : 0 >y < 1 : boolean ->y : number ->1 : number +>y : 0 +>1 : 1 var v = y; >v : number ->y : number +>y : 0 const x = 1; ->x : number ->1 : number +>x : 1 +>1 : 1 (function() { return x + v }); >(function() { return x + v }) : () => number >function() { return x + v } : () => number >x + v : number ->x : number +>x : 1 >v : number (() => x + v); >(() => x + v) : () => number >() => x + v : () => number >x + v : number ->x : number +>x : 1 >v : number } @@ -622,25 +622,25 @@ function foo5_c(x) { >x : any for (const x = 0, y = 1; x < 1;) { ->x : number ->0 : number ->y : number ->1 : number +>x : 0 +>0 : 0 +>y : 1 +>1 : 1 >x < 1 : boolean ->x : number ->1 : number +>x : 0 +>1 : 1 var v = x; >v : number ->x : number +>x : 0 (function() { return x + y + v }); >(function() { return x + y + v }) : () => number >function() { return x + y + v } : () => number >x + y + v : number >x + y : number ->x : number ->y : number +>x : 0 +>y : 1 >v : number (() => x + y + v); @@ -648,8 +648,8 @@ function foo5_c(x) { >() => x + y + v : () => number >x + y + v : number >x + y : number ->x : number ->y : number +>x : 0 +>y : 1 >v : number } @@ -670,22 +670,22 @@ function foo6_c(x) { >1 : 1 const x = 1, y = 1; ->x : number ->1 : number ->y : number ->1 : number +>x : 1 +>1 : 1 +>y : 1 +>1 : 1 var v = x; >v : number ->x : number +>x : 1 (function() { return x + y + v }); >(function() { return x + y + v }) : () => number >function() { return x + y + v } : () => number >x + y + v : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 >v : number (() => x + y + v); @@ -693,8 +693,8 @@ function foo6_c(x) { >() => x + y + v : () => number >x + y + v : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 >v : number } @@ -710,22 +710,22 @@ function foo7_c(x) { do { const x = 1, y = 1; ->x : number ->1 : number ->y : number ->1 : number +>x : 1 +>1 : 1 +>y : 1 +>1 : 1 var v = x; >v : number ->x : number +>x : 1 (function() { return x + y + v }); >(function() { return x + y + v }) : () => number >function() { return x + y + v } : () => number >x + y + v : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 >v : number (() => x + y + v); @@ -733,8 +733,8 @@ function foo7_c(x) { >() => x + y + v : () => number >x + y + v : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 >v : number } while (1 === 1); @@ -754,27 +754,27 @@ function foo8_c(x) { >x : any for (const y = 0; y < 1;) { ->y : number ->0 : number +>y : 0 +>0 : 0 >y < 1 : boolean ->y : number ->1 : number +>y : 0 +>1 : 1 const x = 1; ->x : number ->1 : number +>x : 1 +>1 : 1 var v = x; >v : number ->x : number +>x : 1 (function() { return x + y + v }); >(function() { return x + y + v }) : () => number >function() { return x + y + v } : () => number >x + y + v : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 0 >v : number (() => x + y + v); @@ -782,8 +782,8 @@ function foo8_c(x) { >() => x + y + v : () => number >x + y + v : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 0 >v : number } diff --git a/tests/baselines/reference/capturedLetConstInLoop3_ES6.errors.txt b/tests/baselines/reference/capturedLetConstInLoop3_ES6.errors.txt deleted file mode 100644 index 487c47e32a5..00000000000 --- a/tests/baselines/reference/capturedLetConstInLoop3_ES6.errors.txt +++ /dev/null @@ -1,233 +0,0 @@ -tests/cases/compiler/capturedLetConstInLoop3_ES6.ts(133,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop3_ES6.ts(165,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop3_ES6.ts(176,30): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop3_ES6.ts(210,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'. - - -==== tests/cases/compiler/capturedLetConstInLoop3_ES6.ts (4 errors) ==== - - ///=========let - declare function use(a: any); - function foo0(x) { - for (let x of []) { - var v = x; - (function() { return x + v }); - (() => x + v); - } - - use(v); - } - - function foo0_1(x) { - for (let x in []) { - var v = x; - (function() { return x + v }); - (() => x + v); - } - - use(v); - } - - function foo1(x) { - for (let x = 0; x < 1; ++x) { - var v = x; - (function() { return x + v }); - (() => x + v); - } - - use(v); - } - - function foo2(x) { - while (1 === 1) { - let x = 1; - var v = x; - (function() { return x + v }); - (() => x + v); - } - - use(v); - } - - function foo3(x) { - do { - let x; - var v; - (function() { return x + v }); - (() => x + v); - } while (1 === 1); - - use(v); - } - - function foo4(x) { - for (let y = 0; y < 1; ++y) { - var v = y; - let x = 1; - (function() { return x + v }); - (() => x + v); - } - - use(v); - } - - function foo5(x) { - for (let x = 0, y = 1; x < 1; ++x) { - var v = x; - (function() { return x + y + v }); - (() => x + y + v); - } - - use(v); - } - - - function foo6(x) { - while (1 === 1) { - let x, y; - var v = x; - (function() { return x + y + v }); - (() => x + y + v); - } - - use(v) - } - - function foo7(x) { - do { - let x, y; - var v = x; - (function() { return x + y + v }); - (() => x + y + v); - } while (1 === 1); - - use(v); - } - - - function foo8(x) { - for (let y = 0; y < 1; ++y) { - let x = 1; - var v = x; - (function() { return x + y + v }); - (() => x + y + v); - } - - use(v); - } - //===const - function foo0_c(x) { - for (const x of []) { - var v = x; - (function() { return x + v }); - (() => x + v); - } - - use(v); - } - - function foo0_1_c(x) { - for (const x in []) { - var v = x; - (function() { return x + v }); - (() => x + v); - } - - use(v); - } - - function foo1_c(x) { - for (const x = 0; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - var v = x; - (function() { return x + v }); - (() => x + v); - } - - use(v); - } - - function foo2_c(x) { - while (1 === 1) { - const x = 1; - var v = x; - (function() { return x + v }); - (() => x + v); - } - - use(v); - } - - function foo3_c(x) { - do { - const x = 1; - var v; - (function() { return x + v }); - (() => x + v); - } while (1 === 1); - - use(v); - } - - function foo4_c(x) { - for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - var v = y; - const x = 1; - (function() { return x + v }); - (() => x + v); - } - - use(v); - } - - function foo5_c(x) { - for (const x = 0, y = 1; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - var v = x; - (function() { return x + y + v }); - (() => x + y + v); - } - - use(v); - } - - - function foo6_c(x) { - while (1 === 1) { - const x = 1, y = 1; - var v = x; - (function() { return x + y + v }); - (() => x + y + v); - } - - use(v) - } - - function foo7_c(x) { - do { - const x = 1, y = 1; - var v = x; - (function() { return x + y + v }); - (() => x + y + v); - } while (1 === 1); - - use(v); - } - - - function foo8_c(x) { - for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - const x = 1; - var v = x; - (function() { return x + y + v }); - (() => x + y + v); - } - - use(v); - } \ No newline at end of file diff --git a/tests/baselines/reference/capturedLetConstInLoop3_ES6.types b/tests/baselines/reference/capturedLetConstInLoop3_ES6.types index 3c7776a6651..bfd279afdff 100644 --- a/tests/baselines/reference/capturedLetConstInLoop3_ES6.types +++ b/tests/baselines/reference/capturedLetConstInLoop3_ES6.types @@ -77,10 +77,10 @@ function foo1(x) { for (let x = 0; x < 1; ++x) { >x : number ->0 : number +>0 : 0 >x < 1 : boolean >x : number ->1 : number +>1 : 1 >++x : number >x : number @@ -120,7 +120,7 @@ function foo2(x) { let x = 1; >x : number ->1 : number +>1 : 1 var v = x; >v : number @@ -180,7 +180,7 @@ function foo3(x) { use(v); >use(v) : any >use : (a: any) => any ->v : any +>v : undefined } function foo4(x) { @@ -189,10 +189,10 @@ function foo4(x) { for (let y = 0; y < 1; ++y) { >y : number ->0 : number +>0 : 0 >y < 1 : boolean >y : number ->1 : number +>1 : 1 >++y : number >y : number @@ -202,7 +202,7 @@ function foo4(x) { let x = 1; >x : number ->1 : number +>1 : 1 (function() { return x + v }); >(function() { return x + v }) : () => number @@ -231,12 +231,12 @@ function foo5(x) { for (let x = 0, y = 1; x < 1; ++x) { >x : number ->0 : number +>0 : 0 >y : number ->1 : number +>1 : 1 >x < 1 : boolean >x : number ->1 : number +>1 : 1 >++x : number >x : number @@ -284,8 +284,8 @@ function foo6(x) { >y : any var v = x; ->v : any ->x : any +>v : undefined +>x : undefined (function() { return x + y + v }); >(function() { return x + y + v }) : () => any @@ -294,7 +294,7 @@ function foo6(x) { >x + y : any >x : any >y : any ->v : any +>v : undefined (() => x + y + v); >(() => x + y + v) : () => any @@ -303,13 +303,13 @@ function foo6(x) { >x + y : any >x : any >y : any ->v : any +>v : undefined } use(v) >use(v) : any >use : (a: any) => any ->v : any +>v : undefined } function foo7(x) { @@ -322,8 +322,8 @@ function foo7(x) { >y : any var v = x; ->v : any ->x : any +>v : undefined +>x : undefined (function() { return x + y + v }); >(function() { return x + y + v }) : () => any @@ -332,7 +332,7 @@ function foo7(x) { >x + y : any >x : any >y : any ->v : any +>v : undefined (() => x + y + v); >(() => x + y + v) : () => any @@ -341,7 +341,7 @@ function foo7(x) { >x + y : any >x : any >y : any ->v : any +>v : undefined } while (1 === 1); >1 === 1 : boolean @@ -351,7 +351,7 @@ function foo7(x) { use(v); >use(v) : any >use : (a: any) => any ->v : any +>v : undefined } @@ -361,16 +361,16 @@ function foo8(x) { for (let y = 0; y < 1; ++y) { >y : number ->0 : number +>0 : 0 >y < 1 : boolean >y : number ->1 : number +>1 : 1 >++y : number >y : number let x = 1; >x : number ->1 : number +>1 : 1 var v = x; >v : number @@ -472,28 +472,28 @@ function foo1_c(x) { >x : any for (const x = 0; x < 1;) { ->x : number ->0 : number +>x : 0 +>0 : 0 >x < 1 : boolean ->x : number ->1 : number +>x : 0 +>1 : 1 var v = x; >v : number ->x : number +>x : 0 (function() { return x + v }); >(function() { return x + v }) : () => number >function() { return x + v } : () => number >x + v : number ->x : number +>x : 0 >v : number (() => x + v); >(() => x + v) : () => number >() => x + v : () => number >x + v : number ->x : number +>x : 0 >v : number } @@ -513,25 +513,25 @@ function foo2_c(x) { >1 : 1 const x = 1; ->x : number ->1 : number +>x : 1 +>1 : 1 var v = x; >v : number ->x : number +>x : 1 (function() { return x + v }); >(function() { return x + v }) : () => number >function() { return x + v } : () => number >x + v : number ->x : number +>x : 1 >v : number (() => x + v); >(() => x + v) : () => number >() => x + v : () => number >x + v : number ->x : number +>x : 1 >v : number } @@ -547,8 +547,8 @@ function foo3_c(x) { do { const x = 1; ->x : number ->1 : number +>x : 1 +>1 : 1 var v; >v : any @@ -557,14 +557,14 @@ function foo3_c(x) { >(function() { return x + v }) : () => any >function() { return x + v } : () => any >x + v : any ->x : number +>x : 1 >v : any (() => x + v); >(() => x + v) : () => any >() => x + v : () => any >x + v : any ->x : number +>x : 1 >v : any } while (1 === 1); @@ -575,7 +575,7 @@ function foo3_c(x) { use(v); >use(v) : any >use : (a: any) => any ->v : any +>v : undefined } function foo4_c(x) { @@ -583,32 +583,32 @@ function foo4_c(x) { >x : any for (const y = 0; y < 1;) { ->y : number ->0 : number +>y : 0 +>0 : 0 >y < 1 : boolean ->y : number ->1 : number +>y : 0 +>1 : 1 var v = y; >v : number ->y : number +>y : 0 const x = 1; ->x : number ->1 : number +>x : 1 +>1 : 1 (function() { return x + v }); >(function() { return x + v }) : () => number >function() { return x + v } : () => number >x + v : number ->x : number +>x : 1 >v : number (() => x + v); >(() => x + v) : () => number >() => x + v : () => number >x + v : number ->x : number +>x : 1 >v : number } @@ -623,25 +623,25 @@ function foo5_c(x) { >x : any for (const x = 0, y = 1; x < 1;) { ->x : number ->0 : number ->y : number ->1 : number +>x : 0 +>0 : 0 +>y : 1 +>1 : 1 >x < 1 : boolean ->x : number ->1 : number +>x : 0 +>1 : 1 var v = x; >v : number ->x : number +>x : 0 (function() { return x + y + v }); >(function() { return x + y + v }) : () => number >function() { return x + y + v } : () => number >x + y + v : number >x + y : number ->x : number ->y : number +>x : 0 +>y : 1 >v : number (() => x + y + v); @@ -649,8 +649,8 @@ function foo5_c(x) { >() => x + y + v : () => number >x + y + v : number >x + y : number ->x : number ->y : number +>x : 0 +>y : 1 >v : number } @@ -671,22 +671,22 @@ function foo6_c(x) { >1 : 1 const x = 1, y = 1; ->x : number ->1 : number ->y : number ->1 : number +>x : 1 +>1 : 1 +>y : 1 +>1 : 1 var v = x; >v : number ->x : number +>x : 1 (function() { return x + y + v }); >(function() { return x + y + v }) : () => number >function() { return x + y + v } : () => number >x + y + v : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 >v : number (() => x + y + v); @@ -694,8 +694,8 @@ function foo6_c(x) { >() => x + y + v : () => number >x + y + v : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 >v : number } @@ -711,22 +711,22 @@ function foo7_c(x) { do { const x = 1, y = 1; ->x : number ->1 : number ->y : number ->1 : number +>x : 1 +>1 : 1 +>y : 1 +>1 : 1 var v = x; >v : number ->x : number +>x : 1 (function() { return x + y + v }); >(function() { return x + y + v }) : () => number >function() { return x + y + v } : () => number >x + y + v : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 >v : number (() => x + y + v); @@ -734,8 +734,8 @@ function foo7_c(x) { >() => x + y + v : () => number >x + y + v : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 >v : number } while (1 === 1); @@ -755,27 +755,27 @@ function foo8_c(x) { >x : any for (const y = 0; y < 1;) { ->y : number ->0 : number +>y : 0 +>0 : 0 >y < 1 : boolean ->y : number ->1 : number +>y : 0 +>1 : 1 const x = 1; ->x : number ->1 : number +>x : 1 +>1 : 1 var v = x; >v : number ->x : number +>x : 1 (function() { return x + y + v }); >(function() { return x + y + v }) : () => number >function() { return x + y + v } : () => number >x + y + v : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 0 >v : number (() => x + y + v); @@ -783,8 +783,8 @@ function foo8_c(x) { >() => x + y + v : () => number >x + y + v : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 0 >v : number } diff --git a/tests/baselines/reference/capturedLetConstInLoop4.errors.txt b/tests/baselines/reference/capturedLetConstInLoop4.errors.txt deleted file mode 100644 index 000286537b8..00000000000 --- a/tests/baselines/reference/capturedLetConstInLoop4.errors.txt +++ /dev/null @@ -1,158 +0,0 @@ -tests/cases/compiler/capturedLetConstInLoop4.ts(90,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop4.ts(110,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop4.ts(117,26): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop4.ts(137,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'. - - -==== tests/cases/compiler/capturedLetConstInLoop4.ts (4 errors) ==== - - //======let - export function exportedFoo() { - return v0 + v00 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8; - } - - for (let x of []) { - var v0 = x; - (function() { return x + v0}); - (() => x); - } - - for (let x in []) { - var v00 = x; - (function() { return x + v00}); - (() => x); - } - - for (let x = 0; x < 1; ++x) { - var v1 = x; - (function() { return x + v1}); - (() => x); - } - - while (1 === 1) { - let x; - var v2 = x; - (function() { return x + v2}); - (() => x); - } - - do { - let x; - var v3 = x; - (function() { return x + v3}); - (() => x); - } while (1 === 1) - - for (let y = 0; y < 1; ++y) { - let x = 1; - var v4 = x; - (function() { return x + v4}); - (() => x); - } - - for (let x = 0, y = 1; x < 1; ++x) { - var v5 = x; - (function() { return x + y + v5}); - (() => x + y); - } - - while (1 === 1) { - let x, y; - var v6 = x; - (function() { return x + y + v6}); - (() => x + y); - } - - do { - let x, y; - var v7 = x; - (function() { return x + y + v7}); - (() => x + y); - } while (1 === 1) - - for (let y = 0; y < 1; ++y) { - let x = 1; - var v8 = x; - (function() { return x + y + v8}); - (() => x + y); - } - - //======const - export function exportedFoo2() { - return v0_c + v00_c + v1_c + v2_c + v3_c + v4_c + v5_c + v6_c + v7_c + v8_c; - } - - for (const x of []) { - var v0_c = x; - (function() { return x + v0_c}); - (() => x); - } - - for (const x in []) { - var v00_c = x; - (function() { return x + v00}); - (() => x); - } - - for (const x = 0; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - var v1_c = x; - (function() { return x + v1_c}); - (() => x); - } - - while (1 === 1) { - const x =1; - var v2_c = x; - (function() { return x + v2_c}); - (() => x); - } - - do { - const x = 1; - var v3_c = x; - (function() { return x + v3_c}); - (() => x); - } while (1 === 1) - - for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - const x = 1; - var v4_c = x; - (function() { return x + v4_c}); - (() => x); - } - - for (const x = 0, y = 1; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - var v5_c = x; - (function() { return x + y + v5_c}); - (() => x + y); - } - - while (1 === 1) { - const x = 1, y = 1; - var v6_c = x; - (function() { return x + y + v6_c}); - (() => x + y); - } - - do { - const x = 1, y = 1; - var v7_c = x; - (function() { return x + y + v7_c}); - (() => x + y); - } while (1 === 1) - - for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - const x = 1; - var v8_c = x; - (function() { return x + y + v8_c}); - (() => x + y); - } - \ No newline at end of file diff --git a/tests/baselines/reference/capturedLetConstInLoop4.types b/tests/baselines/reference/capturedLetConstInLoop4.types index 16226243c53..0feff77f604 100644 --- a/tests/baselines/reference/capturedLetConstInLoop4.types +++ b/tests/baselines/reference/capturedLetConstInLoop4.types @@ -17,12 +17,12 @@ export function exportedFoo() { >v0 : any >v00 : string >v1 : number ->v2 : any ->v3 : any +>v2 : undefined +>v3 : undefined >v4 : number >v5 : number ->v6 : any ->v7 : any +>v6 : undefined +>v7 : undefined >v8 : number } @@ -70,10 +70,10 @@ for (let x in []) { for (let x = 0; x < 1; ++x) { >x : number ->0 : number +>0 : 0 >x < 1 : boolean >x : number ->1 : number +>1 : 1 >++x : number >x : number @@ -103,15 +103,15 @@ while (1 === 1) { >x : any var v2 = x; ->v2 : any ->x : any +>v2 : undefined +>x : undefined (function() { return x + v2}); >(function() { return x + v2}) : () => any >function() { return x + v2} : () => any >x + v2 : any >x : any ->v2 : any +>v2 : undefined (() => x); >(() => x) : () => any @@ -124,15 +124,15 @@ do { >x : any var v3 = x; ->v3 : any ->x : any +>v3 : undefined +>x : undefined (function() { return x + v3}); >(function() { return x + v3}) : () => any >function() { return x + v3} : () => any >x + v3 : any >x : any ->v3 : any +>v3 : undefined (() => x); >(() => x) : () => any @@ -146,16 +146,16 @@ do { for (let y = 0; y < 1; ++y) { >y : number ->0 : number +>0 : 0 >y < 1 : boolean >y : number ->1 : number +>1 : 1 >++y : number >y : number let x = 1; >x : number ->1 : number +>1 : 1 var v4 = x; >v4 : number @@ -176,12 +176,12 @@ for (let y = 0; y < 1; ++y) { for (let x = 0, y = 1; x < 1; ++x) { >x : number ->0 : number +>0 : 0 >y : number ->1 : number +>1 : 1 >x < 1 : boolean >x : number ->1 : number +>1 : 1 >++x : number >x : number @@ -216,8 +216,8 @@ while (1 === 1) { >y : any var v6 = x; ->v6 : any ->x : any +>v6 : undefined +>x : undefined (function() { return x + y + v6}); >(function() { return x + y + v6}) : () => any @@ -226,7 +226,7 @@ while (1 === 1) { >x + y : any >x : any >y : any ->v6 : any +>v6 : undefined (() => x + y); >(() => x + y) : () => any @@ -242,8 +242,8 @@ do { >y : any var v7 = x; ->v7 : any ->x : any +>v7 : undefined +>x : undefined (function() { return x + y + v7}); >(function() { return x + y + v7}) : () => any @@ -252,7 +252,7 @@ do { >x + y : any >x : any >y : any ->v7 : any +>v7 : undefined (() => x + y); >(() => x + y) : () => any @@ -268,16 +268,16 @@ do { for (let y = 0; y < 1; ++y) { >y : number ->0 : number +>0 : 0 >y < 1 : boolean >y : number ->1 : number +>1 : 1 >++y : number >y : number let x = 1; >x : number ->1 : number +>1 : 1 var v8 = x; >v8 : number @@ -369,27 +369,27 @@ for (const x in []) { } for (const x = 0; x < 1;) { ->x : number ->0 : number +>x : 0 +>0 : 0 >x < 1 : boolean ->x : number ->1 : number +>x : 0 +>1 : 1 var v1_c = x; >v1_c : number ->x : number +>x : 0 (function() { return x + v1_c}); >(function() { return x + v1_c}) : () => number >function() { return x + v1_c} : () => number >x + v1_c : number ->x : number +>x : 0 >v1_c : number (() => x); >(() => x) : () => number >() => x : () => number ->x : number +>x : 0 } while (1 === 1) { @@ -398,46 +398,46 @@ while (1 === 1) { >1 : 1 const x =1; ->x : number ->1 : number +>x : 1 +>1 : 1 var v2_c = x; >v2_c : number ->x : number +>x : 1 (function() { return x + v2_c}); >(function() { return x + v2_c}) : () => number >function() { return x + v2_c} : () => number >x + v2_c : number ->x : number +>x : 1 >v2_c : number (() => x); >(() => x) : () => number >() => x : () => number ->x : number +>x : 1 } do { const x = 1; ->x : number ->1 : number +>x : 1 +>1 : 1 var v3_c = x; >v3_c : number ->x : number +>x : 1 (function() { return x + v3_c}); >(function() { return x + v3_c}) : () => number >function() { return x + v3_c} : () => number >x + v3_c : number ->x : number +>x : 1 >v3_c : number (() => x); >(() => x) : () => number >() => x : () => number ->x : number +>x : 1 } while (1 === 1) >1 === 1 : boolean @@ -445,61 +445,61 @@ do { >1 : 1 for (const y = 0; y < 1;) { ->y : number ->0 : number +>y : 0 +>0 : 0 >y < 1 : boolean ->y : number ->1 : number +>y : 0 +>1 : 1 const x = 1; ->x : number ->1 : number +>x : 1 +>1 : 1 var v4_c = x; >v4_c : number ->x : number +>x : 1 (function() { return x + v4_c}); >(function() { return x + v4_c}) : () => number >function() { return x + v4_c} : () => number >x + v4_c : number ->x : number +>x : 1 >v4_c : number (() => x); >(() => x) : () => number >() => x : () => number ->x : number +>x : 1 } for (const x = 0, y = 1; x < 1;) { ->x : number ->0 : number ->y : number ->1 : number +>x : 0 +>0 : 0 +>y : 1 +>1 : 1 >x < 1 : boolean ->x : number ->1 : number +>x : 0 +>1 : 1 var v5_c = x; >v5_c : number ->x : number +>x : 0 (function() { return x + y + v5_c}); >(function() { return x + y + v5_c}) : () => number >function() { return x + y + v5_c} : () => number >x + y + v5_c : number >x + y : number ->x : number ->y : number +>x : 0 +>y : 1 >v5_c : number (() => x + y); >(() => x + y) : () => number >() => x + y : () => number >x + y : number ->x : number ->y : number +>x : 0 +>y : 1 } while (1 === 1) { @@ -508,58 +508,58 @@ while (1 === 1) { >1 : 1 const x = 1, y = 1; ->x : number ->1 : number ->y : number ->1 : number +>x : 1 +>1 : 1 +>y : 1 +>1 : 1 var v6_c = x; >v6_c : number ->x : number +>x : 1 (function() { return x + y + v6_c}); >(function() { return x + y + v6_c}) : () => number >function() { return x + y + v6_c} : () => number >x + y + v6_c : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 >v6_c : number (() => x + y); >(() => x + y) : () => number >() => x + y : () => number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 } do { const x = 1, y = 1; ->x : number ->1 : number ->y : number ->1 : number +>x : 1 +>1 : 1 +>y : 1 +>1 : 1 var v7_c = x; >v7_c : number ->x : number +>x : 1 (function() { return x + y + v7_c}); >(function() { return x + y + v7_c}) : () => number >function() { return x + y + v7_c} : () => number >x + y + v7_c : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 >v7_c : number (() => x + y); >(() => x + y) : () => number >() => x + y : () => number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 } while (1 === 1) >1 === 1 : boolean @@ -567,34 +567,34 @@ do { >1 : 1 for (const y = 0; y < 1;) { ->y : number ->0 : number +>y : 0 +>0 : 0 >y < 1 : boolean ->y : number ->1 : number +>y : 0 +>1 : 1 const x = 1; ->x : number ->1 : number +>x : 1 +>1 : 1 var v8_c = x; >v8_c : number ->x : number +>x : 1 (function() { return x + y + v8_c}); >(function() { return x + y + v8_c}) : () => number >function() { return x + y + v8_c} : () => number >x + y + v8_c : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 0 >v8_c : number (() => x + y); >(() => x + y) : () => number >() => x + y : () => number >x + y : number ->x : number ->y : number +>x : 1 +>y : 0 } diff --git a/tests/baselines/reference/capturedLetConstInLoop4_ES6.errors.txt b/tests/baselines/reference/capturedLetConstInLoop4_ES6.errors.txt deleted file mode 100644 index a83bb1d414f..00000000000 --- a/tests/baselines/reference/capturedLetConstInLoop4_ES6.errors.txt +++ /dev/null @@ -1,158 +0,0 @@ -tests/cases/compiler/capturedLetConstInLoop4_ES6.ts(90,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop4_ES6.ts(110,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop4_ES6.ts(117,26): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop4_ES6.ts(137,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'. - - -==== tests/cases/compiler/capturedLetConstInLoop4_ES6.ts (4 errors) ==== - - //======let - export function exportedFoo() { - return v0 + v00 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8; - } - - for (let x of []) { - var v0 = x; - (function() { return x + v0}); - (() => x); - } - - for (let x in []) { - var v00 = x; - (function() { return x + v00}); - (() => x); - } - - for (let x = 0; x < 1; ++x) { - var v1 = x; - (function() { return x + v1}); - (() => x); - } - - while (1 === 1) { - let x; - var v2 = x; - (function() { return x + v2}); - (() => x); - } - - do { - let x; - var v3 = x; - (function() { return x + v3}); - (() => x); - } while (1 === 1) - - for (let y = 0; y < 1; ++y) { - let x = 1; - var v4 = x; - (function() { return x + v4}); - (() => x); - } - - for (let x = 0, y = 1; x < 1; ++x) { - var v5 = x; - (function() { return x + y + v5}); - (() => x + y); - } - - while (1 === 1) { - let x, y; - var v6 = x; - (function() { return x + y + v6}); - (() => x + y); - } - - do { - let x, y; - var v7 = x; - (function() { return x + y + v7}); - (() => x + y); - } while (1 === 1) - - for (let y = 0; y < 1; ++y) { - let x = 1; - var v8 = x; - (function() { return x + y + v8}); - (() => x + y); - } - - //======const - export function exportedFoo2() { - return v0_c + v00_c + v1_c + v2_c + v3_c + v4_c + v5_c + v6_c + v7_c + v8_c; - } - - for (const x of []) { - var v0_c = x; - (function() { return x + v0_c}); - (() => x); - } - - for (const x in []) { - var v00_c = x; - (function() { return x + v00}); - (() => x); - } - - for (const x = 0; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - var v1_c = x; - (function() { return x + v1_c}); - (() => x); - } - - while (1 === 1) { - const x =1; - var v2_c = x; - (function() { return x + v2_c}); - (() => x); - } - - do { - const x = 1; - var v3_c = x; - (function() { return x + v3_c}); - (() => x); - } while (1 === 1) - - for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - const x = 1; - var v4_c = x; - (function() { return x + v4_c}); - (() => x); - } - - for (const x = 0, y = 1; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - var v5_c = x; - (function() { return x + y + v5_c}); - (() => x + y); - } - - while (1 === 1) { - const x = 1, y = 1; - var v6_c = x; - (function() { return x + y + v6_c}); - (() => x + y); - } - - do { - const x = 1, y = 1; - var v7_c = x; - (function() { return x + y + v7_c}); - (() => x + y); - } while (1 === 1) - - for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. - const x = 1; - var v8_c = x; - (function() { return x + y + v8_c}); - (() => x + y); - } - \ No newline at end of file diff --git a/tests/baselines/reference/capturedLetConstInLoop4_ES6.types b/tests/baselines/reference/capturedLetConstInLoop4_ES6.types index fba7d88ec48..301a6ef90f1 100644 --- a/tests/baselines/reference/capturedLetConstInLoop4_ES6.types +++ b/tests/baselines/reference/capturedLetConstInLoop4_ES6.types @@ -17,12 +17,12 @@ export function exportedFoo() { >v0 : any >v00 : string >v1 : number ->v2 : any ->v3 : any +>v2 : undefined +>v3 : undefined >v4 : number >v5 : number ->v6 : any ->v7 : any +>v6 : undefined +>v7 : undefined >v8 : number } @@ -70,10 +70,10 @@ for (let x in []) { for (let x = 0; x < 1; ++x) { >x : number ->0 : number +>0 : 0 >x < 1 : boolean >x : number ->1 : number +>1 : 1 >++x : number >x : number @@ -103,15 +103,15 @@ while (1 === 1) { >x : any var v2 = x; ->v2 : any ->x : any +>v2 : undefined +>x : undefined (function() { return x + v2}); >(function() { return x + v2}) : () => any >function() { return x + v2} : () => any >x + v2 : any >x : any ->v2 : any +>v2 : undefined (() => x); >(() => x) : () => any @@ -124,15 +124,15 @@ do { >x : any var v3 = x; ->v3 : any ->x : any +>v3 : undefined +>x : undefined (function() { return x + v3}); >(function() { return x + v3}) : () => any >function() { return x + v3} : () => any >x + v3 : any >x : any ->v3 : any +>v3 : undefined (() => x); >(() => x) : () => any @@ -146,16 +146,16 @@ do { for (let y = 0; y < 1; ++y) { >y : number ->0 : number +>0 : 0 >y < 1 : boolean >y : number ->1 : number +>1 : 1 >++y : number >y : number let x = 1; >x : number ->1 : number +>1 : 1 var v4 = x; >v4 : number @@ -176,12 +176,12 @@ for (let y = 0; y < 1; ++y) { for (let x = 0, y = 1; x < 1; ++x) { >x : number ->0 : number +>0 : 0 >y : number ->1 : number +>1 : 1 >x < 1 : boolean >x : number ->1 : number +>1 : 1 >++x : number >x : number @@ -216,8 +216,8 @@ while (1 === 1) { >y : any var v6 = x; ->v6 : any ->x : any +>v6 : undefined +>x : undefined (function() { return x + y + v6}); >(function() { return x + y + v6}) : () => any @@ -226,7 +226,7 @@ while (1 === 1) { >x + y : any >x : any >y : any ->v6 : any +>v6 : undefined (() => x + y); >(() => x + y) : () => any @@ -242,8 +242,8 @@ do { >y : any var v7 = x; ->v7 : any ->x : any +>v7 : undefined +>x : undefined (function() { return x + y + v7}); >(function() { return x + y + v7}) : () => any @@ -252,7 +252,7 @@ do { >x + y : any >x : any >y : any ->v7 : any +>v7 : undefined (() => x + y); >(() => x + y) : () => any @@ -268,16 +268,16 @@ do { for (let y = 0; y < 1; ++y) { >y : number ->0 : number +>0 : 0 >y < 1 : boolean >y : number ->1 : number +>1 : 1 >++y : number >y : number let x = 1; >x : number ->1 : number +>1 : 1 var v8 = x; >v8 : number @@ -369,27 +369,27 @@ for (const x in []) { } for (const x = 0; x < 1;) { ->x : number ->0 : number +>x : 0 +>0 : 0 >x < 1 : boolean ->x : number ->1 : number +>x : 0 +>1 : 1 var v1_c = x; >v1_c : number ->x : number +>x : 0 (function() { return x + v1_c}); >(function() { return x + v1_c}) : () => number >function() { return x + v1_c} : () => number >x + v1_c : number ->x : number +>x : 0 >v1_c : number (() => x); >(() => x) : () => number >() => x : () => number ->x : number +>x : 0 } while (1 === 1) { @@ -398,46 +398,46 @@ while (1 === 1) { >1 : 1 const x =1; ->x : number ->1 : number +>x : 1 +>1 : 1 var v2_c = x; >v2_c : number ->x : number +>x : 1 (function() { return x + v2_c}); >(function() { return x + v2_c}) : () => number >function() { return x + v2_c} : () => number >x + v2_c : number ->x : number +>x : 1 >v2_c : number (() => x); >(() => x) : () => number >() => x : () => number ->x : number +>x : 1 } do { const x = 1; ->x : number ->1 : number +>x : 1 +>1 : 1 var v3_c = x; >v3_c : number ->x : number +>x : 1 (function() { return x + v3_c}); >(function() { return x + v3_c}) : () => number >function() { return x + v3_c} : () => number >x + v3_c : number ->x : number +>x : 1 >v3_c : number (() => x); >(() => x) : () => number >() => x : () => number ->x : number +>x : 1 } while (1 === 1) >1 === 1 : boolean @@ -445,61 +445,61 @@ do { >1 : 1 for (const y = 0; y < 1;) { ->y : number ->0 : number +>y : 0 +>0 : 0 >y < 1 : boolean ->y : number ->1 : number +>y : 0 +>1 : 1 const x = 1; ->x : number ->1 : number +>x : 1 +>1 : 1 var v4_c = x; >v4_c : number ->x : number +>x : 1 (function() { return x + v4_c}); >(function() { return x + v4_c}) : () => number >function() { return x + v4_c} : () => number >x + v4_c : number ->x : number +>x : 1 >v4_c : number (() => x); >(() => x) : () => number >() => x : () => number ->x : number +>x : 1 } for (const x = 0, y = 1; x < 1;) { ->x : number ->0 : number ->y : number ->1 : number +>x : 0 +>0 : 0 +>y : 1 +>1 : 1 >x < 1 : boolean ->x : number ->1 : number +>x : 0 +>1 : 1 var v5_c = x; >v5_c : number ->x : number +>x : 0 (function() { return x + y + v5_c}); >(function() { return x + y + v5_c}) : () => number >function() { return x + y + v5_c} : () => number >x + y + v5_c : number >x + y : number ->x : number ->y : number +>x : 0 +>y : 1 >v5_c : number (() => x + y); >(() => x + y) : () => number >() => x + y : () => number >x + y : number ->x : number ->y : number +>x : 0 +>y : 1 } while (1 === 1) { @@ -508,58 +508,58 @@ while (1 === 1) { >1 : 1 const x = 1, y = 1; ->x : number ->1 : number ->y : number ->1 : number +>x : 1 +>1 : 1 +>y : 1 +>1 : 1 var v6_c = x; >v6_c : number ->x : number +>x : 1 (function() { return x + y + v6_c}); >(function() { return x + y + v6_c}) : () => number >function() { return x + y + v6_c} : () => number >x + y + v6_c : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 >v6_c : number (() => x + y); >(() => x + y) : () => number >() => x + y : () => number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 } do { const x = 1, y = 1; ->x : number ->1 : number ->y : number ->1 : number +>x : 1 +>1 : 1 +>y : 1 +>1 : 1 var v7_c = x; >v7_c : number ->x : number +>x : 1 (function() { return x + y + v7_c}); >(function() { return x + y + v7_c}) : () => number >function() { return x + y + v7_c} : () => number >x + y + v7_c : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 >v7_c : number (() => x + y); >(() => x + y) : () => number >() => x + y : () => number >x + y : number ->x : number ->y : number +>x : 1 +>y : 1 } while (1 === 1) >1 === 1 : boolean @@ -567,34 +567,34 @@ do { >1 : 1 for (const y = 0; y < 1;) { ->y : number ->0 : number +>y : 0 +>0 : 0 >y < 1 : boolean ->y : number ->1 : number +>y : 0 +>1 : 1 const x = 1; ->x : number ->1 : number +>x : 1 +>1 : 1 var v8_c = x; >v8_c : number ->x : number +>x : 1 (function() { return x + y + v8_c}); >(function() { return x + y + v8_c}) : () => number >function() { return x + y + v8_c} : () => number >x + y + v8_c : number >x + y : number ->x : number ->y : number +>x : 1 +>y : 0 >v8_c : number (() => x + y); >(() => x + y) : () => number >() => x + y : () => number >x + y : number ->x : number ->y : number +>x : 1 +>y : 0 } diff --git a/tests/baselines/reference/capturedLetConstInLoop5.errors.txt b/tests/baselines/reference/capturedLetConstInLoop5.errors.txt index b182d8347de..cb641af478d 100644 --- a/tests/baselines/reference/capturedLetConstInLoop5.errors.txt +++ b/tests/baselines/reference/capturedLetConstInLoop5.errors.txt @@ -1,12 +1,8 @@ -tests/cases/compiler/capturedLetConstInLoop5.ts(170,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop5.ts(174,13): error TS2365: Operator '==' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop5.ts(211,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop5.ts(225,30): error TS2365: Operator '<' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop5.ts(229,13): error TS2365: Operator '==' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop5.ts(268,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -==== tests/cases/compiler/capturedLetConstInLoop5.ts (6 errors) ==== +==== tests/cases/compiler/capturedLetConstInLoop5.ts (2 errors) ==== declare function use(a: any); //====let @@ -177,8 +173,6 @@ tests/cases/compiler/capturedLetConstInLoop5.ts(268,23): error TS2365: Operator function foo1_c(x) { for (const x = 0; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. var v = x; (function() { return x + v }); (() => x + v); @@ -222,8 +216,6 @@ tests/cases/compiler/capturedLetConstInLoop5.ts(268,23): error TS2365: Operator function foo4_c(x) { for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. var v = y; let x = 1; (function() { return x + v }); @@ -238,8 +230,6 @@ tests/cases/compiler/capturedLetConstInLoop5.ts(268,23): error TS2365: Operator function foo5_c(x) { for (const x = 0, y = 1; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. var v = x; (function() { return x + y + v }); (() => x + y + v); @@ -285,8 +275,6 @@ tests/cases/compiler/capturedLetConstInLoop5.ts(268,23): error TS2365: Operator function foo8_c(x) { for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. const x = 1; var v = x; (function() { return x + y + v }); diff --git a/tests/baselines/reference/capturedLetConstInLoop5_ES6.errors.txt b/tests/baselines/reference/capturedLetConstInLoop5_ES6.errors.txt index 05eb0626e2d..a9a4742631a 100644 --- a/tests/baselines/reference/capturedLetConstInLoop5_ES6.errors.txt +++ b/tests/baselines/reference/capturedLetConstInLoop5_ES6.errors.txt @@ -1,12 +1,8 @@ -tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(171,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(175,13): error TS2365: Operator '==' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(212,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(226,30): error TS2365: Operator '<' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(230,13): error TS2365: Operator '==' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(269,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -==== tests/cases/compiler/capturedLetConstInLoop5_ES6.ts (6 errors) ==== +==== tests/cases/compiler/capturedLetConstInLoop5_ES6.ts (2 errors) ==== declare function use(a: any); @@ -178,8 +174,6 @@ tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(269,23): error TS2365: Opera function foo1_c(x) { for (const x = 0; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. var v = x; (function() { return x + v }); (() => x + v); @@ -223,8 +217,6 @@ tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(269,23): error TS2365: Opera function foo4_c(x) { for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. var v = y; let x = 1; (function() { return x + v }); @@ -239,8 +231,6 @@ tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(269,23): error TS2365: Opera function foo5_c(x) { for (const x = 0, y = 1; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. var v = x; (function() { return x + y + v }); (() => x + y + v); @@ -286,8 +276,6 @@ tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(269,23): error TS2365: Opera function foo8_c(x) { for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. const x = 1; var v = x; (function() { return x + y + v }); diff --git a/tests/baselines/reference/capturedLetConstInLoop6.errors.txt b/tests/baselines/reference/capturedLetConstInLoop6.errors.txt index c332c5b7323..cc5d238e7af 100644 --- a/tests/baselines/reference/capturedLetConstInLoop6.errors.txt +++ b/tests/baselines/reference/capturedLetConstInLoop6.errors.txt @@ -1,14 +1,10 @@ -tests/cases/compiler/capturedLetConstInLoop6.ts(144,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop6.ts(147,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop6.ts(150,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'. -tests/cases/compiler/capturedLetConstInLoop6.ts(179,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop6.ts(191,26): error TS2365: Operator '<' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop6.ts(194,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop6.ts(197,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'. -tests/cases/compiler/capturedLetConstInLoop6.ts(226,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -==== tests/cases/compiler/capturedLetConstInLoop6.ts (8 errors) ==== +==== tests/cases/compiler/capturedLetConstInLoop6.ts (4 errors) ==== // ====let for (let x of []) { (function() { return x}); @@ -153,8 +149,6 @@ tests/cases/compiler/capturedLetConstInLoop6.ts(226,19): error TS2365: Operator for (const x = 0; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. (function() { return x}); (() => x); if (x == 1) { @@ -194,8 +188,6 @@ tests/cases/compiler/capturedLetConstInLoop6.ts(226,19): error TS2365: Operator } while (1 === 1) for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. const x = 1; (function() { return x}); (() => x); @@ -208,8 +200,6 @@ tests/cases/compiler/capturedLetConstInLoop6.ts(226,19): error TS2365: Operator } for (const x = 0, y = 1; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. (function() { return x + y}); (() => x + y); if (x == 1) { @@ -249,8 +239,6 @@ tests/cases/compiler/capturedLetConstInLoop6.ts(226,19): error TS2365: Operator } while (1 === 1) for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. const x = 1; (function() { return x + y}); (() => x + y); diff --git a/tests/baselines/reference/capturedLetConstInLoop6_ES6.errors.txt b/tests/baselines/reference/capturedLetConstInLoop6_ES6.errors.txt index 18ecfe7c666..4e563153ac9 100644 --- a/tests/baselines/reference/capturedLetConstInLoop6_ES6.errors.txt +++ b/tests/baselines/reference/capturedLetConstInLoop6_ES6.errors.txt @@ -1,14 +1,10 @@ -tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(144,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(147,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(150,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'. -tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(179,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(191,26): error TS2365: Operator '<' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(194,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(197,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'. -tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(226,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -==== tests/cases/compiler/capturedLetConstInLoop6_ES6.ts (8 errors) ==== +==== tests/cases/compiler/capturedLetConstInLoop6_ES6.ts (4 errors) ==== // ====let for (let x of []) { (function() { return x}); @@ -153,8 +149,6 @@ tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(226,19): error TS2365: Opera for (const x = 0; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. (function() { return x}); (() => x); if (x == 1) { @@ -194,8 +188,6 @@ tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(226,19): error TS2365: Opera } while (1 === 1) for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. const x = 1; (function() { return x}); (() => x); @@ -208,8 +200,6 @@ tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(226,19): error TS2365: Opera } for (const x = 0, y = 1; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. (function() { return x + y}); (() => x + y); if (x == 1) { @@ -249,8 +239,6 @@ tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(226,19): error TS2365: Opera } while (1 === 1) for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. const x = 1; (function() { return x + y}); (() => x + y); diff --git a/tests/baselines/reference/capturedLetConstInLoop7.errors.txt b/tests/baselines/reference/capturedLetConstInLoop7.errors.txt index 29e6fbca6cd..4b8e512f41a 100644 --- a/tests/baselines/reference/capturedLetConstInLoop7.errors.txt +++ b/tests/baselines/reference/capturedLetConstInLoop7.errors.txt @@ -1,18 +1,14 @@ -tests/cases/compiler/capturedLetConstInLoop7.ts(227,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop7.ts(230,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop7.ts(233,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop7.ts(236,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'. tests/cases/compiler/capturedLetConstInLoop7.ts(239,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'. -tests/cases/compiler/capturedLetConstInLoop7.ts(283,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop7.ts(302,26): error TS2365: Operator '<' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop7.ts(305,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop7.ts(308,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop7.ts(311,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'. tests/cases/compiler/capturedLetConstInLoop7.ts(314,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'. -tests/cases/compiler/capturedLetConstInLoop7.ts(359,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -==== tests/cases/compiler/capturedLetConstInLoop7.ts (12 errors) ==== +==== tests/cases/compiler/capturedLetConstInLoop7.ts (8 errors) ==== //===let l0: for (let x of []) { @@ -240,8 +236,6 @@ tests/cases/compiler/capturedLetConstInLoop7.ts(359,19): error TS2365: Operator l1_c: for (const x = 0; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. (function() { return x}); (() => x); if (x == 1) { @@ -306,8 +300,6 @@ tests/cases/compiler/capturedLetConstInLoop7.ts(359,19): error TS2365: Operator l4_c: for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. const x = 1; (function() { return x}); (() => x); @@ -327,8 +319,6 @@ tests/cases/compiler/capturedLetConstInLoop7.ts(359,19): error TS2365: Operator l5_c: for (const x = 0, y = 1; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. (function() { return x + y}); (() => x + y); if (x == 1) { @@ -394,8 +384,6 @@ tests/cases/compiler/capturedLetConstInLoop7.ts(359,19): error TS2365: Operator l8_c: for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. const x = 1; (function() { return x + y}); (() => x + y); diff --git a/tests/baselines/reference/capturedLetConstInLoop7_ES6.errors.txt b/tests/baselines/reference/capturedLetConstInLoop7_ES6.errors.txt index a2001dc09b3..30e2db6a253 100644 --- a/tests/baselines/reference/capturedLetConstInLoop7_ES6.errors.txt +++ b/tests/baselines/reference/capturedLetConstInLoop7_ES6.errors.txt @@ -1,18 +1,14 @@ -tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(227,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(230,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(233,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(236,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'. tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(239,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'. -tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(283,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(302,26): error TS2365: Operator '<' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(305,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(308,9): error TS2365: Operator '==' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(311,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'. tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(314,9): error TS2365: Operator '==' cannot be applied to types '0' and '2'. -tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(359,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -==== tests/cases/compiler/capturedLetConstInLoop7_ES6.ts (12 errors) ==== +==== tests/cases/compiler/capturedLetConstInLoop7_ES6.ts (8 errors) ==== //===let l0: for (let x of []) { @@ -240,8 +236,6 @@ tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(359,19): error TS2365: Opera l1_c: for (const x = 0; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. (function() { return x}); (() => x); if (x == 1) { @@ -306,8 +300,6 @@ tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(359,19): error TS2365: Opera l4_c: for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. const x = 1; (function() { return x}); (() => x); @@ -327,8 +319,6 @@ tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(359,19): error TS2365: Opera l5_c: for (const x = 0, y = 1; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. (function() { return x + y}); (() => x + y); if (x == 1) { @@ -394,8 +384,6 @@ tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(359,19): error TS2365: Opera l8_c: for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. const x = 1; (function() { return x + y}); (() => x + y); diff --git a/tests/baselines/reference/capturedLetConstInLoop8.errors.txt b/tests/baselines/reference/capturedLetConstInLoop8.errors.txt index c3743feaf90..d54c79dfebb 100644 --- a/tests/baselines/reference/capturedLetConstInLoop8.errors.txt +++ b/tests/baselines/reference/capturedLetConstInLoop8.errors.txt @@ -1,6 +1,3 @@ -tests/cases/compiler/capturedLetConstInLoop8.ts(66,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop8.ts(68,27): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop8.ts(70,31): error TS2365: Operator '<' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop8.ts(73,21): error TS2365: Operator '==' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop8.ts(76,21): error TS2365: Operator '==' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop8.ts(79,21): error TS2365: Operator '==' cannot be applied to types '0' and '1'. @@ -19,7 +16,7 @@ tests/cases/compiler/capturedLetConstInLoop8.ts(117,17): error TS2365: Operator tests/cases/compiler/capturedLetConstInLoop8.ts(120,17): error TS2365: Operator '==' cannot be applied to types '0' and '3'. -==== tests/cases/compiler/capturedLetConstInLoop8.ts (19 errors) ==== +==== tests/cases/compiler/capturedLetConstInLoop8.ts (16 errors) ==== function foo() { l0: for (let z = 0; z < 1; ++z) { @@ -86,16 +83,10 @@ tests/cases/compiler/capturedLetConstInLoop8.ts(120,17): error TS2365: Operator function foo_c() { l0: for (const z = 0; z < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. l1: for (const x = 0; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. ll1: for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. (function() { return x + y }); (() => x + y); if (y == 1) { diff --git a/tests/baselines/reference/capturedLetConstInLoop8_ES6.errors.txt b/tests/baselines/reference/capturedLetConstInLoop8_ES6.errors.txt index da6947884fa..b8e856b66bf 100644 --- a/tests/baselines/reference/capturedLetConstInLoop8_ES6.errors.txt +++ b/tests/baselines/reference/capturedLetConstInLoop8_ES6.errors.txt @@ -1,6 +1,3 @@ -tests/cases/compiler/capturedLetConstInLoop8_ES6.ts(66,23): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop8_ES6.ts(68,27): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -tests/cases/compiler/capturedLetConstInLoop8_ES6.ts(70,31): error TS2365: Operator '<' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop8_ES6.ts(73,21): error TS2365: Operator '==' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop8_ES6.ts(76,21): error TS2365: Operator '==' cannot be applied to types '0' and '1'. tests/cases/compiler/capturedLetConstInLoop8_ES6.ts(79,21): error TS2365: Operator '==' cannot be applied to types '0' and '1'. @@ -19,7 +16,7 @@ tests/cases/compiler/capturedLetConstInLoop8_ES6.ts(117,17): error TS2365: Opera tests/cases/compiler/capturedLetConstInLoop8_ES6.ts(120,17): error TS2365: Operator '==' cannot be applied to types '0' and '3'. -==== tests/cases/compiler/capturedLetConstInLoop8_ES6.ts (19 errors) ==== +==== tests/cases/compiler/capturedLetConstInLoop8_ES6.ts (16 errors) ==== function foo() { l0: for (let z = 0; z < 1; ++z) { @@ -86,16 +83,10 @@ tests/cases/compiler/capturedLetConstInLoop8_ES6.ts(120,17): error TS2365: Opera function foo_c() { l0: for (const z = 0; z < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. l1: for (const x = 0; x < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. ll1: for (const y = 0; y < 1;) { - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. (function() { return x + y }); (() => x + y); if (y == 1) { diff --git a/tests/baselines/reference/comparisonOperatorWithNumericLiteral.errors.txt b/tests/baselines/reference/comparisonOperatorWithNumericLiteral.errors.txt deleted file mode 100644 index d863ca29090..00000000000 --- a/tests/baselines/reference/comparisonOperatorWithNumericLiteral.errors.txt +++ /dev/null @@ -1,58 +0,0 @@ -tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNumericLiteral.ts(5,1): error TS2365: Operator '>' cannot be applied to types 'BrandedNum' and '0'. -tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNumericLiteral.ts(10,1): error TS2365: Operator '<' cannot be applied to types 'BrandedNum' and '0'. -tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNumericLiteral.ts(15,1): error TS2365: Operator '>=' cannot be applied to types 'BrandedNum' and '0'. -tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNumericLiteral.ts(20,1): error TS2365: Operator '<=' cannot be applied to types 'BrandedNum' and '0'. - - -==== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNumericLiteral.ts (4 errors) ==== - type BrandedNum = number & { __numberBrand: any }; - var x : BrandedNum; - - // operator > - x > 0; - ~~~~~ -!!! error TS2365: Operator '>' cannot be applied to types 'BrandedNum' and '0'. - x > 0; - x > 0; - - // operator < - x < 0; - ~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types 'BrandedNum' and '0'. - x < 0; - x < 0; - - // operator >= - x >= 0; - ~~~~~~ -!!! error TS2365: Operator '>=' cannot be applied to types 'BrandedNum' and '0'. - x >= 0; - x >= 0; - - // operator <= - x <= 0; - ~~~~~~ -!!! error TS2365: Operator '<=' cannot be applied to types 'BrandedNum' and '0'. - x <= 0; - x <= 0; - - // operator == - x == 0; - x == 0; - x == 0; - - // operator != - x != 0; - x != 0; - x != 0; - - // operator === - x === 0; - x === 0; - x === 0; - - // operator !== - x !== 0; - x !== 0; - x !== 0; - \ No newline at end of file diff --git a/tests/baselines/reference/comparisonOperatorWithNumericLiteral.symbols b/tests/baselines/reference/comparisonOperatorWithNumericLiteral.symbols new file mode 100644 index 00000000000..0511f88b2a8 --- /dev/null +++ b/tests/baselines/reference/comparisonOperatorWithNumericLiteral.symbols @@ -0,0 +1,97 @@ +=== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNumericLiteral.ts === +type BrandedNum = number & { __numberBrand: any }; +>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0)) +>__numberBrand : Symbol(__numberBrand, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 28)) + +var x : BrandedNum; +>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3)) +>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0)) + +// operator > +x > 0; +>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3)) + +x > 0; +>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3)) + +x > 0; +>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3)) +>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0)) + +// operator < +x < 0; +>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3)) + +x < 0; +>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3)) + +x < 0; +>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3)) +>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0)) + +// operator >= +x >= 0; +>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3)) + +x >= 0; +>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3)) + +x >= 0; +>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3)) +>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0)) + +// operator <= +x <= 0; +>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3)) + +x <= 0; +>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3)) + +x <= 0; +>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3)) +>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0)) + +// operator == +x == 0; +>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3)) + +x == 0; +>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3)) + +x == 0; +>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3)) +>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0)) + +// operator != +x != 0; +>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3)) + +x != 0; +>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3)) + +x != 0; +>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3)) +>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0)) + +// operator === +x === 0; +>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3)) + +x === 0; +>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3)) + +x === 0; +>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3)) +>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0)) + +// operator !== +x !== 0; +>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3)) + +x !== 0; +>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3)) + +x !== 0; +>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3)) +>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0)) + diff --git a/tests/baselines/reference/comparisonOperatorWithNumericLiteral.types b/tests/baselines/reference/comparisonOperatorWithNumericLiteral.types new file mode 100644 index 00000000000..31f7aadfec2 --- /dev/null +++ b/tests/baselines/reference/comparisonOperatorWithNumericLiteral.types @@ -0,0 +1,161 @@ +=== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNumericLiteral.ts === +type BrandedNum = number & { __numberBrand: any }; +>BrandedNum : BrandedNum +>__numberBrand : any + +var x : BrandedNum; +>x : BrandedNum +>BrandedNum : BrandedNum + +// operator > +x > 0; +>x > 0 : boolean +>x : BrandedNum +>0 : 0 + +x > 0; +>x > 0 : boolean +>x : BrandedNum +>0 : number +>0 : 0 + +x > 0; +>x > 0 : boolean +>x : BrandedNum +>0 : BrandedNum +>BrandedNum : BrandedNum +>0 : 0 + +// operator < +x < 0; +>x < 0 : boolean +>x : BrandedNum +>0 : 0 + +x < 0; +>x < 0 : boolean +>x : BrandedNum +>0 : number +>0 : 0 + +x < 0; +>x < 0 : boolean +>x : BrandedNum +>0 : BrandedNum +>BrandedNum : BrandedNum +>0 : 0 + +// operator >= +x >= 0; +>x >= 0 : boolean +>x : BrandedNum +>0 : 0 + +x >= 0; +>x >= 0 : boolean +>x : BrandedNum +>0 : number +>0 : 0 + +x >= 0; +>x >= 0 : boolean +>x : BrandedNum +>0 : BrandedNum +>BrandedNum : BrandedNum +>0 : 0 + +// operator <= +x <= 0; +>x <= 0 : boolean +>x : BrandedNum +>0 : 0 + +x <= 0; +>x <= 0 : boolean +>x : BrandedNum +>0 : number +>0 : 0 + +x <= 0; +>x <= 0 : boolean +>x : BrandedNum +>0 : BrandedNum +>BrandedNum : BrandedNum +>0 : 0 + +// operator == +x == 0; +>x == 0 : boolean +>x : BrandedNum +>0 : 0 + +x == 0; +>x == 0 : boolean +>x : BrandedNum +>0 : number +>0 : 0 + +x == 0; +>x == 0 : boolean +>x : BrandedNum +>0 : BrandedNum +>BrandedNum : BrandedNum +>0 : 0 + +// operator != +x != 0; +>x != 0 : boolean +>x : BrandedNum +>0 : 0 + +x != 0; +>x != 0 : boolean +>x : BrandedNum +>0 : number +>0 : 0 + +x != 0; +>x != 0 : boolean +>x : BrandedNum +>0 : BrandedNum +>BrandedNum : BrandedNum +>0 : 0 + +// operator === +x === 0; +>x === 0 : boolean +>x : BrandedNum +>0 : 0 + +x === 0; +>x === 0 : boolean +>x : BrandedNum +>0 : number +>0 : 0 + +x === 0; +>x === 0 : boolean +>x : BrandedNum +>0 : BrandedNum +>BrandedNum : BrandedNum +>0 : 0 + +// operator !== +x !== 0; +>x !== 0 : boolean +>x : BrandedNum +>0 : 0 + +x !== 0; +>x !== 0 : boolean +>x : BrandedNum +>0 : number +>0 : 0 + +x !== 0; +>x !== 0 : boolean +>x : BrandedNum +>0 : BrandedNum +>BrandedNum : BrandedNum +>0 : 0 + diff --git a/tests/baselines/reference/conditionalOperatorConditionIsBooleanType.errors.txt b/tests/baselines/reference/conditionalOperatorConditionIsBooleanType.errors.txt deleted file mode 100644 index 25153c1ba15..00000000000 --- a/tests/baselines/reference/conditionalOperatorConditionIsBooleanType.errors.txt +++ /dev/null @@ -1,71 +0,0 @@ -tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorConditionIsBooleanType.ts(35,1): error TS2365: Operator '>' cannot be applied to types '2' and '1'. -tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorConditionIsBooleanType.ts(58,23): error TS2365: Operator '>' cannot be applied to types '2' and '1'. - - -==== tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorConditionIsBooleanType.ts (2 errors) ==== - //Cond ? Expr1 : Expr2, Cond is of boolean type, Expr1 and Expr2 have the same type - var condBoolean: boolean; - - var exprAny1: any; - var exprBoolean1: boolean; - var exprNumber1: number; - var exprString1: string; - var exprIsObject1: Object; - - var exprAny2: any; - var exprBoolean2: boolean; - var exprNumber2: number; - var exprString2: string; - var exprIsObject2: Object; - - //Cond is a boolean type variable - condBoolean ? exprAny1 : exprAny2; - condBoolean ? exprBoolean1 : exprBoolean2; - condBoolean ? exprNumber1 : exprNumber2; - condBoolean ? exprString1 : exprString2; - condBoolean ? exprIsObject1 : exprIsObject2; - condBoolean ? exprString1 : exprBoolean1; // union - - //Cond is a boolean type literal - true ? exprAny1 : exprAny2; - false ? exprBoolean1 : exprBoolean2; - true ? exprNumber1 : exprNumber2; - false ? exprString1 : exprString2; - true ? exprIsObject1 : exprIsObject2; - true ? exprString1 : exprBoolean1; // union - - //Cond is a boolean type expression - !true ? exprAny1 : exprAny2; - typeof "123" == "string" ? exprBoolean1 : exprBoolean2; - 2 > 1 ? exprNumber1 : exprNumber2; - ~~~~~ -!!! error TS2365: Operator '>' cannot be applied to types '2' and '1'. - null === undefined ? exprString1 : exprString2; - true || false ? exprIsObject1 : exprIsObject2; - null === undefined ? exprString1 : exprBoolean1; // union - - //Results shoud be same as Expr1 and Expr2 - var resultIsAny1 = condBoolean ? exprAny1 : exprAny2; - var resultIsBoolean1 = condBoolean ? exprBoolean1 : exprBoolean2; - var resultIsNumber1 = condBoolean ? exprNumber1 : exprNumber2; - var resultIsString1 = condBoolean ? exprString1 : exprString2; - var resultIsObject1 = condBoolean ? exprIsObject1 : exprIsObject2; - var resultIsStringOrBoolean1 = condBoolean ? exprString1 : exprBoolean1; // union - - var resultIsAny2 = true ? exprAny1 : exprAny2; - var resultIsBoolean2 = false ? exprBoolean1 : exprBoolean2; - var resultIsNumber2 = true ? exprNumber1 : exprNumber2; - var resultIsString2 = false ? exprString1 : exprString2; - var resultIsObject2 = true ? exprIsObject1 : exprIsObject2; - var resultIsStringOrBoolean2 = true ? exprString1 : exprBoolean1; // union - var resultIsStringOrBoolean3 = false ? exprString1 : exprBoolean1; // union - - var resultIsAny3 = !true ? exprAny1 : exprAny2; - var resultIsBoolean3 = typeof "123" == "string" ? exprBoolean1 : exprBoolean2; - var resultIsNumber3 = 2 > 1 ? exprNumber1 : exprNumber2; - ~~~~~ -!!! error TS2365: Operator '>' cannot be applied to types '2' and '1'. - var resultIsString3 = null === undefined ? exprString1 : exprString2; - var resultIsObject3 = true || false ? exprIsObject1 : exprIsObject2; - var resultIsStringOrBoolean4 = typeof "123" === "string" ? exprString1 : exprBoolean1; // union - \ No newline at end of file diff --git a/tests/baselines/reference/conditionalOperatorConditionIsBooleanType.types b/tests/baselines/reference/conditionalOperatorConditionIsBooleanType.types index 7733b80f69b..f19769b1c58 100644 --- a/tests/baselines/reference/conditionalOperatorConditionIsBooleanType.types +++ b/tests/baselines/reference/conditionalOperatorConditionIsBooleanType.types @@ -75,37 +75,37 @@ condBoolean ? exprString1 : exprBoolean1; // union //Cond is a boolean type literal true ? exprAny1 : exprAny2; >true ? exprAny1 : exprAny2 : any ->true : boolean +>true : true >exprAny1 : any >exprAny2 : any false ? exprBoolean1 : exprBoolean2; >false ? exprBoolean1 : exprBoolean2 : boolean ->false : boolean +>false : false >exprBoolean1 : boolean >exprBoolean2 : boolean true ? exprNumber1 : exprNumber2; >true ? exprNumber1 : exprNumber2 : number ->true : boolean +>true : true >exprNumber1 : number >exprNumber2 : number false ? exprString1 : exprString2; >false ? exprString1 : exprString2 : string ->false : boolean +>false : false >exprString1 : string >exprString2 : string true ? exprIsObject1 : exprIsObject2; >true ? exprIsObject1 : exprIsObject2 : Object ->true : boolean +>true : true >exprIsObject1 : Object >exprIsObject2 : Object true ? exprString1 : exprBoolean1; // union >true ? exprString1 : exprBoolean1 : string | boolean ->true : boolean +>true : true >exprString1 : string >exprBoolean1 : boolean @@ -113,7 +113,7 @@ true ? exprString1 : exprBoolean1; // union !true ? exprAny1 : exprAny2; >!true ? exprAny1 : exprAny2 : any >!true : boolean ->true : boolean +>true : true >exprAny1 : any >exprAny2 : any @@ -121,7 +121,7 @@ typeof "123" == "string" ? exprBoolean1 : exprBoolean2; >typeof "123" == "string" ? exprBoolean1 : exprBoolean2 : boolean >typeof "123" == "string" : boolean >typeof "123" : string ->"123" : string +>"123" : "123" >"string" : "string" >exprBoolean1 : boolean >exprBoolean2 : boolean @@ -129,8 +129,8 @@ typeof "123" == "string" ? exprBoolean1 : exprBoolean2; 2 > 1 ? exprNumber1 : exprNumber2; >2 > 1 ? exprNumber1 : exprNumber2 : number >2 > 1 : boolean ->2 : number ->1 : number +>2 : 2 +>1 : 1 >exprNumber1 : number >exprNumber2 : number @@ -145,7 +145,7 @@ null === undefined ? exprString1 : exprString2; true || false ? exprIsObject1 : exprIsObject2; >true || false ? exprIsObject1 : exprIsObject2 : Object >true || false : boolean ->true : boolean +>true : true >false : false >exprIsObject1 : Object >exprIsObject2 : Object @@ -204,49 +204,49 @@ var resultIsStringOrBoolean1 = condBoolean ? exprString1 : exprBoolean1; // unio var resultIsAny2 = true ? exprAny1 : exprAny2; >resultIsAny2 : any >true ? exprAny1 : exprAny2 : any ->true : boolean +>true : true >exprAny1 : any >exprAny2 : any var resultIsBoolean2 = false ? exprBoolean1 : exprBoolean2; >resultIsBoolean2 : boolean >false ? exprBoolean1 : exprBoolean2 : boolean ->false : boolean +>false : false >exprBoolean1 : boolean >exprBoolean2 : boolean var resultIsNumber2 = true ? exprNumber1 : exprNumber2; >resultIsNumber2 : number >true ? exprNumber1 : exprNumber2 : number ->true : boolean +>true : true >exprNumber1 : number >exprNumber2 : number var resultIsString2 = false ? exprString1 : exprString2; >resultIsString2 : string >false ? exprString1 : exprString2 : string ->false : boolean +>false : false >exprString1 : string >exprString2 : string var resultIsObject2 = true ? exprIsObject1 : exprIsObject2; >resultIsObject2 : Object >true ? exprIsObject1 : exprIsObject2 : Object ->true : boolean +>true : true >exprIsObject1 : Object >exprIsObject2 : Object var resultIsStringOrBoolean2 = true ? exprString1 : exprBoolean1; // union >resultIsStringOrBoolean2 : string | boolean >true ? exprString1 : exprBoolean1 : string | boolean ->true : boolean +>true : true >exprString1 : string >exprBoolean1 : boolean var resultIsStringOrBoolean3 = false ? exprString1 : exprBoolean1; // union >resultIsStringOrBoolean3 : string | boolean >false ? exprString1 : exprBoolean1 : string | boolean ->false : boolean +>false : false >exprString1 : string >exprBoolean1 : boolean @@ -254,7 +254,7 @@ var resultIsAny3 = !true ? exprAny1 : exprAny2; >resultIsAny3 : any >!true ? exprAny1 : exprAny2 : any >!true : boolean ->true : boolean +>true : true >exprAny1 : any >exprAny2 : any @@ -263,7 +263,7 @@ var resultIsBoolean3 = typeof "123" == "string" ? exprBoolean1 : exprBoolean2; >typeof "123" == "string" ? exprBoolean1 : exprBoolean2 : boolean >typeof "123" == "string" : boolean >typeof "123" : string ->"123" : string +>"123" : "123" >"string" : "string" >exprBoolean1 : boolean >exprBoolean2 : boolean @@ -272,8 +272,8 @@ var resultIsNumber3 = 2 > 1 ? exprNumber1 : exprNumber2; >resultIsNumber3 : number >2 > 1 ? exprNumber1 : exprNumber2 : number >2 > 1 : boolean ->2 : number ->1 : number +>2 : 2 +>1 : 1 >exprNumber1 : number >exprNumber2 : number @@ -290,7 +290,7 @@ var resultIsObject3 = true || false ? exprIsObject1 : exprIsObject2; >resultIsObject3 : Object >true || false ? exprIsObject1 : exprIsObject2 : Object >true || false : boolean ->true : boolean +>true : true >false : false >exprIsObject1 : Object >exprIsObject2 : Object @@ -300,7 +300,7 @@ var resultIsStringOrBoolean4 = typeof "123" === "string" ? exprString1 : exprBoo >typeof "123" === "string" ? exprString1 : exprBoolean1 : string | boolean >typeof "123" === "string" : boolean >typeof "123" : string ->"123" : string +>"123" : "123" >"string" : "string" >exprString1 : string >exprBoolean1 : boolean diff --git a/tests/baselines/reference/constDeclarations-errors.errors.txt b/tests/baselines/reference/constDeclarations-errors.errors.txt index ace4cd7b25f..83031e0aa79 100644 --- a/tests/baselines/reference/constDeclarations-errors.errors.txt +++ b/tests/baselines/reference/constDeclarations-errors.errors.txt @@ -4,14 +4,12 @@ tests/cases/compiler/constDeclarations-errors.ts(5,7): error TS1155: 'const' dec tests/cases/compiler/constDeclarations-errors.ts(5,11): error TS1155: 'const' declarations must be initialized tests/cases/compiler/constDeclarations-errors.ts(5,15): error TS1155: 'const' declarations must be initialized tests/cases/compiler/constDeclarations-errors.ts(5,27): error TS1155: 'const' declarations must be initialized -tests/cases/compiler/constDeclarations-errors.ts(10,19): error TS2365: Operator '<' cannot be applied to types '0' and '1'. tests/cases/compiler/constDeclarations-errors.ts(10,27): error TS2540: Cannot assign to 'c8' because it is a constant or a read-only property. tests/cases/compiler/constDeclarations-errors.ts(13,11): error TS1155: 'const' declarations must be initialized tests/cases/compiler/constDeclarations-errors.ts(16,20): error TS1155: 'const' declarations must be initialized -tests/cases/compiler/constDeclarations-errors.ts(16,25): error TS2365: Operator '<' cannot be applied to types '0' and '1'. -==== tests/cases/compiler/constDeclarations-errors.ts (11 errors) ==== +==== tests/cases/compiler/constDeclarations-errors.ts (9 errors) ==== // error, missing intialicer const c1; @@ -34,8 +32,6 @@ tests/cases/compiler/constDeclarations-errors.ts(16,25): error TS2365: Operator // error, assigning to a const for(const c8 = 0; c8 < 1; c8++) { } - ~~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. ~~ !!! error TS2540: Cannot assign to 'c8' because it is a constant or a read-only property. @@ -47,6 +43,4 @@ tests/cases/compiler/constDeclarations-errors.ts(16,25): error TS2365: Operator // error, can not be unintalized for(const c10 = 0, c11; c10 < 1;) { } ~~~ -!!! error TS1155: 'const' declarations must be initialized - ~~~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'. \ No newline at end of file +!!! error TS1155: 'const' declarations must be initialized \ No newline at end of file diff --git a/tests/baselines/reference/constDeclarations-scopes2.errors.txt b/tests/baselines/reference/constDeclarations-scopes2.errors.txt deleted file mode 100644 index b998f3a9980..00000000000 --- a/tests/baselines/reference/constDeclarations-scopes2.errors.txt +++ /dev/null @@ -1,21 +0,0 @@ -tests/cases/compiler/constDeclarations-scopes2.ts(9,19): error TS2365: Operator '<' cannot be applied to types '0' and '10'. - - -==== tests/cases/compiler/constDeclarations-scopes2.ts (1 errors) ==== - - // global - const c = "string"; - - var n: number; - var b: boolean; - - // for scope - for (const c = 0; c < 10; n = c ) { - ~~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '10'. - // for block - const c = false; - b = c; - } - - \ No newline at end of file diff --git a/tests/baselines/reference/constDeclarations-scopes2.types b/tests/baselines/reference/constDeclarations-scopes2.types index a6bbdee7612..9834c6bb16e 100644 --- a/tests/baselines/reference/constDeclarations-scopes2.types +++ b/tests/baselines/reference/constDeclarations-scopes2.types @@ -2,8 +2,8 @@ // global const c = "string"; ->c : string ->"string" : string +>c : "string" +>"string" : "string" var n: number; >n : number @@ -13,24 +13,24 @@ var b: boolean; // for scope for (const c = 0; c < 10; n = c ) { ->c : number ->0 : number +>c : 0 +>0 : 0 >c < 10 : boolean ->c : number ->10 : number ->n = c : number +>c : 0 +>10 : 10 +>n = c : 0 >n : number ->c : number +>c : 0 // for block const c = false; ->c : boolean ->false : boolean +>c : false +>false : false b = c; ->b = c : boolean +>b = c : false >b : boolean ->c : boolean +>c : false } diff --git a/tests/baselines/reference/constDeclarations.errors.txt b/tests/baselines/reference/constDeclarations.errors.txt deleted file mode 100644 index 1642610eec2..00000000000 --- a/tests/baselines/reference/constDeclarations.errors.txt +++ /dev/null @@ -1,17 +0,0 @@ -tests/cases/compiler/constDeclarations.ts(8,19): error TS2365: Operator '<' cannot be applied to types '0' and '9'. - - -==== tests/cases/compiler/constDeclarations.ts (1 errors) ==== - - // No error - const c1 = false; - const c2: number = 23; - const c3 = 0, c4 :string = "", c5 = null; - - - for(const c4 = 0; c4 < 9; ) { break; } - ~~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '0' and '9'. - - - for(const c5 = 0, c6 = 0; c5 < c6; ) { break; } \ No newline at end of file diff --git a/tests/baselines/reference/constDeclarations.types b/tests/baselines/reference/constDeclarations.types index efdc534ef1c..0fa7893529f 100644 --- a/tests/baselines/reference/constDeclarations.types +++ b/tests/baselines/reference/constDeclarations.types @@ -2,36 +2,36 @@ // No error const c1 = false; ->c1 : boolean ->false : boolean +>c1 : false +>false : false const c2: number = 23; >c2 : number ->23 : number +>23 : 23 const c3 = 0, c4 :string = "", c5 = null; ->c3 : number ->0 : number +>c3 : 0 +>0 : 0 >c4 : string ->"" : string +>"" : "" >c5 : any >null : null for(const c4 = 0; c4 < 9; ) { break; } ->c4 : number ->0 : number +>c4 : 0 +>0 : 0 >c4 < 9 : boolean ->c4 : number ->9 : number +>c4 : 0 +>9 : 9 for(const c5 = 0, c6 = 0; c5 < c6; ) { break; } ->c5 : number ->0 : number ->c6 : number ->0 : number +>c5 : 0 +>0 : 0 +>c6 : 0 +>0 : 0 >c5 < c6 : boolean ->c5 : number ->c6 : number +>c5 : 0 +>c6 : 0 diff --git a/tests/baselines/reference/duplicateLocalVariable1.errors.txt b/tests/baselines/reference/duplicateLocalVariable1.errors.txt index 87bcc71cdfc..b264574ea09 100644 --- a/tests/baselines/reference/duplicateLocalVariable1.errors.txt +++ b/tests/baselines/reference/duplicateLocalVariable1.errors.txt @@ -2,7 +2,7 @@ tests/cases/compiler/duplicateLocalVariable1.ts(2,4): error TS1005: ';' expected tests/cases/compiler/duplicateLocalVariable1.ts(2,11): error TS1146: Declaration expected. tests/cases/compiler/duplicateLocalVariable1.ts(2,13): error TS2304: Cannot find name 'commonjs'. tests/cases/compiler/duplicateLocalVariable1.ts(187,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'string', but here has type 'number'. -tests/cases/compiler/duplicateLocalVariable1.ts(187,29): error TS2365: Operator '<' cannot be applied to types 'string' and '14'. +tests/cases/compiler/duplicateLocalVariable1.ts(187,29): error TS2365: Operator '<' cannot be applied to types 'string' and 'number'. tests/cases/compiler/duplicateLocalVariable1.ts(187,37): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. @@ -203,7 +203,7 @@ tests/cases/compiler/duplicateLocalVariable1.ts(187,37): error TS2356: An arithm ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'string', but here has type 'number'. ~~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types 'string' and '14'. +!!! error TS2365: Operator '<' cannot be applied to types 'string' and 'number'. ~ !!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. bytes.push(fb.readByte()); diff --git a/tests/baselines/reference/duplicateLocalVariable2.errors.txt b/tests/baselines/reference/duplicateLocalVariable2.errors.txt index 466e145d28d..5e89cc422cc 100644 --- a/tests/baselines/reference/duplicateLocalVariable2.errors.txt +++ b/tests/baselines/reference/duplicateLocalVariable2.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/duplicateLocalVariable2.ts(27,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'string', but here has type 'number'. -tests/cases/compiler/duplicateLocalVariable2.ts(27,29): error TS2365: Operator '<' cannot be applied to types 'string' and '14'. +tests/cases/compiler/duplicateLocalVariable2.ts(27,29): error TS2365: Operator '<' cannot be applied to types 'string' and 'number'. tests/cases/compiler/duplicateLocalVariable2.ts(27,37): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. @@ -34,7 +34,7 @@ tests/cases/compiler/duplicateLocalVariable2.ts(27,37): error TS2356: An arithme ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'string', but here has type 'number'. ~~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types 'string' and '14'. +!!! error TS2365: Operator '<' cannot be applied to types 'string' and 'number'. ~ !!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. bytes.push(fb.readByte()); diff --git a/tests/baselines/reference/grammarAmbiguities1.errors.txt b/tests/baselines/reference/grammarAmbiguities1.errors.txt index 8809c4aa334..12df5f3c1e0 100644 --- a/tests/baselines/reference/grammarAmbiguities1.errors.txt +++ b/tests/baselines/reference/grammarAmbiguities1.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/grammarAmbiguities1.ts(8,1): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/compiler/grammarAmbiguities1.ts(8,3): error TS2365: Operator '<' cannot be applied to types '(x: any) => any' and 'typeof A'. -tests/cases/compiler/grammarAmbiguities1.ts(8,10): error TS2365: Operator '>' cannot be applied to types 'typeof B' and '7'. +tests/cases/compiler/grammarAmbiguities1.ts(8,10): error TS2365: Operator '>' cannot be applied to types 'typeof B' and 'number'. tests/cases/compiler/grammarAmbiguities1.ts(9,1): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/compiler/grammarAmbiguities1.ts(9,3): error TS2365: Operator '<' cannot be applied to types '(x: any) => any' and 'typeof A'. tests/cases/compiler/grammarAmbiguities1.ts(9,10): error TS2365: Operator '>' cannot be applied to types 'typeof B' and 'number'. @@ -20,7 +20,7 @@ tests/cases/compiler/grammarAmbiguities1.ts(9,10): error TS2365: Operator '>' ca ~~~~~ !!! error TS2365: Operator '<' cannot be applied to types '(x: any) => any' and 'typeof A'. ~~~~~ -!!! error TS2365: Operator '>' cannot be applied to types 'typeof B' and '7'. +!!! error TS2365: Operator '>' cannot be applied to types 'typeof B' and 'number'. f(g < A, B > +(7)); ~~~~~~~~~~~~~~~~~~ !!! error TS2346: Supplied parameters do not match any signature of call target. diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity2.errors.txt b/tests/baselines/reference/parserGreaterThanTokenAmbiguity2.errors.txt index ee2d3666682..30ede342a85 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity2.errors.txt +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity2.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity2.ts(1,1): error TS2365: Operator '>' cannot be applied to types 'boolean' and '2'. +tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity2.ts(1,1): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'number'. tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity2.ts(1,5): error TS1109: Expression expected. ==== tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity2.ts (2 errors) ==== 1 > > 2; ~~~~~~~ -!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and '2'. +!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and 'number'. ~ !!! error TS1109: Expression expected. \ No newline at end of file diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity3.errors.txt b/tests/baselines/reference/parserGreaterThanTokenAmbiguity3.errors.txt index 1651009bf0d..baebfd81304 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity3.errors.txt +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity3.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity3.ts(1,1): error TS2365: Operator '>' cannot be applied to types 'boolean' and '2'. +tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity3.ts(1,1): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'number'. tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity3.ts(1,8): error TS1109: Expression expected. ==== tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity3.ts (2 errors) ==== 1 >/**/> 2; ~~~~~~~~~~ -!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and '2'. +!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and 'number'. ~ !!! error TS1109: Expression expected. \ No newline at end of file diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity4.errors.txt b/tests/baselines/reference/parserGreaterThanTokenAmbiguity4.errors.txt index dff69b37612..924c9440d16 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity4.errors.txt +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity4.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity4.ts(1,1): error TS2365: Operator '>' cannot be applied to types 'boolean' and '2'. +tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity4.ts(1,1): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'number'. tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity4.ts(2,1): error TS1109: Expression expected. @@ -7,6 +7,6 @@ tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbigu ~~~ > 2; ~~~ -!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and '2'. +!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and 'number'. ~ !!! error TS1109: Expression expected. \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesWithVariousOperators02.errors.txt b/tests/baselines/reference/stringLiteralTypesWithVariousOperators02.errors.txt index a51469baa93..a4944f7f163 100644 --- a/tests/baselines/reference/stringLiteralTypesWithVariousOperators02.errors.txt +++ b/tests/baselines/reference/stringLiteralTypesWithVariousOperators02.errors.txt @@ -7,12 +7,11 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperato tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(13,11): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(14,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(15,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(16,9): error TS2365: Operator '<' cannot be applied to types '"ABC"' and '"XYZ"'. tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(17,9): error TS2365: Operator '===' cannot be applied to types '"ABC"' and '"XYZ"'. tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(18,9): error TS2365: Operator '!=' cannot be applied to types '"ABC"' and '"XYZ"'. -==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts (12 errors) ==== +==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts (11 errors) ==== let abc: "ABC" = "ABC"; let xyz: "XYZ" = "XYZ"; @@ -47,8 +46,6 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperato ~~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. let j = abc < xyz; - ~~~~~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types '"ABC"' and '"XYZ"'. let k = abc === xyz; ~~~~~~~~~~~ !!! error TS2365: Operator '===' cannot be applied to types '"ABC"' and '"XYZ"'.