Merge pull request #12158 from Microsoft/fix-literal-comparability-in-relational-comparison-operators
Fix literal comparability in relational comparison operators
This commit is contained in:
commit
a74e9d8ccf
|
@ -14502,6 +14502,8 @@ namespace ts {
|
||||||
case SyntaxKind.LessThanEqualsToken:
|
case SyntaxKind.LessThanEqualsToken:
|
||||||
case SyntaxKind.GreaterThanEqualsToken:
|
case SyntaxKind.GreaterThanEqualsToken:
|
||||||
if (checkForDisallowedESSymbolOperand(operator)) {
|
if (checkForDisallowedESSymbolOperand(operator)) {
|
||||||
|
leftType = getBaseTypeOfLiteralType(leftType);
|
||||||
|
rightType = getBaseTypeOfLiteralType(rightType);
|
||||||
if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) {
|
if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) {
|
||||||
reportOperatorError();
|
reportOperatorError();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
|
||||||
}
|
|
|
@ -32,10 +32,10 @@ for (let x of []) {
|
||||||
|
|
||||||
for (let x = 0; x < 1; ++x) {
|
for (let x = 0; x < 1; ++x) {
|
||||||
>x : number
|
>x : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++x : number
|
>++x : number
|
||||||
>x : number
|
>x : number
|
||||||
|
|
||||||
|
@ -90,16 +90,16 @@ do {
|
||||||
|
|
||||||
for (let y = 0; y < 1; ++y) {
|
for (let y = 0; y < 1; ++y) {
|
||||||
>y : number
|
>y : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++y : number
|
>++y : number
|
||||||
>y : number
|
>y : number
|
||||||
|
|
||||||
let x = 1;
|
let x = 1;
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
(function() { return x});
|
(function() { return x});
|
||||||
>(function() { return x}) : () => number
|
>(function() { return x}) : () => number
|
||||||
|
@ -114,12 +114,12 @@ for (let y = 0; y < 1; ++y) {
|
||||||
|
|
||||||
for (let x = 0, y = 1; x < 1; ++x) {
|
for (let x = 0, y = 1; x < 1; ++x) {
|
||||||
>x : number
|
>x : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y : number
|
>y : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++x : number
|
>++x : number
|
||||||
>x : number
|
>x : number
|
||||||
|
|
||||||
|
@ -188,16 +188,16 @@ do {
|
||||||
|
|
||||||
for (let y = 0; y < 1; ++y) {
|
for (let y = 0; y < 1; ++y) {
|
||||||
>y : number
|
>y : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++y : number
|
>++y : number
|
||||||
>y : number
|
>y : number
|
||||||
|
|
||||||
let x = 1;
|
let x = 1;
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
(function() { return x + y});
|
(function() { return x + y});
|
||||||
>(function() { return x + y}) : () => number
|
>(function() { return x + y}) : () => number
|
||||||
|
@ -246,21 +246,21 @@ for (const x of []) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const x = 0; x < 1;) {
|
for (const x = 0; x < 1;) {
|
||||||
>x : number
|
>x : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
(function() { return x});
|
(function() { return x});
|
||||||
>(function() { return x}) : () => number
|
>(function() { return x}) : () => number
|
||||||
>function() { return x} : () => number
|
>function() { return x} : () => number
|
||||||
>x : number
|
>x : 0
|
||||||
|
|
||||||
(() => x);
|
(() => x);
|
||||||
>(() => x) : () => number
|
>(() => x) : () => number
|
||||||
>() => x : () => number
|
>() => x : () => number
|
||||||
>x : number
|
>x : 0
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1 === 1) {
|
while (1 === 1) {
|
||||||
|
@ -269,34 +269,34 @@ while (1 === 1) {
|
||||||
>1 : 1
|
>1 : 1
|
||||||
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
(function() { return x});
|
(function() { return x});
|
||||||
>(function() { return x}) : () => number
|
>(function() { return x}) : () => number
|
||||||
>function() { return x} : () => number
|
>function() { return x} : () => number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
(() => x);
|
(() => x);
|
||||||
>(() => x) : () => number
|
>(() => x) : () => number
|
||||||
>() => x : () => number
|
>() => x : () => number
|
||||||
>x : number
|
>x : 1
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
const x = 1;
|
const x = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
(function() { return x});
|
(function() { return x});
|
||||||
>(function() { return x}) : () => number
|
>(function() { return x}) : () => number
|
||||||
>function() { return x} : () => number
|
>function() { return x} : () => number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
(() => x);
|
(() => x);
|
||||||
>(() => x) : () => number
|
>(() => x) : () => number
|
||||||
>() => x : () => number
|
>() => x : () => number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
} while (1 === 1)
|
} while (1 === 1)
|
||||||
>1 === 1 : boolean
|
>1 === 1 : boolean
|
||||||
|
@ -304,49 +304,49 @@ do {
|
||||||
>1 : 1
|
>1 : 1
|
||||||
|
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
>y : number
|
>y : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
(function() { return x});
|
(function() { return x});
|
||||||
>(function() { return x}) : () => number
|
>(function() { return x}) : () => number
|
||||||
>function() { return x} : () => number
|
>function() { return x} : () => number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
(() => x);
|
(() => x);
|
||||||
>(() => x) : () => number
|
>(() => x) : () => number
|
||||||
>() => x : () => number
|
>() => x : () => number
|
||||||
>x : number
|
>x : 1
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const x = 0, y = 1; x < 1;) {
|
for (const x = 0, y = 1; x < 1;) {
|
||||||
>x : number
|
>x : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y : number
|
>y : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
(function() { return x + y});
|
(function() { return x + y});
|
||||||
>(function() { return x + y}) : () => number
|
>(function() { return x + y}) : () => number
|
||||||
>function() { return x + y} : () => number
|
>function() { return x + y} : () => number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 0
|
||||||
>y : number
|
>y : 1
|
||||||
|
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
>(() => x + y) : () => number
|
>(() => x + y) : () => number
|
||||||
>() => x + y : () => number
|
>() => x + y : () => number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 0
|
||||||
>y : number
|
>y : 1
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1 === 1) {
|
while (1 === 1) {
|
||||||
|
@ -355,46 +355,46 @@ while (1 === 1) {
|
||||||
>1 : 1
|
>1 : 1
|
||||||
|
|
||||||
const x = 1, y = 1;
|
const x = 1, y = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
(function() { return x + y});
|
(function() { return x + y});
|
||||||
>(function() { return x + y}) : () => number
|
>(function() { return x + y}) : () => number
|
||||||
>function() { return x + y} : () => number
|
>function() { return x + y} : () => number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
|
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
>(() => x + y) : () => number
|
>(() => x + y) : () => number
|
||||||
>() => x + y : () => number
|
>() => x + y : () => number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
const x = 1, y = 1;
|
const x = 1, y = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
(function() { return x + y});
|
(function() { return x + y});
|
||||||
>(function() { return x + y}) : () => number
|
>(function() { return x + y}) : () => number
|
||||||
>function() { return x + y} : () => number
|
>function() { return x + y} : () => number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
|
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
>(() => x + y) : () => number
|
>(() => x + y) : () => number
|
||||||
>() => x + y : () => number
|
>() => x + y : () => number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
|
|
||||||
} while (1 === 1)
|
} while (1 === 1)
|
||||||
>1 === 1 : boolean
|
>1 === 1 : boolean
|
||||||
|
@ -402,27 +402,27 @@ do {
|
||||||
>1 : 1
|
>1 : 1
|
||||||
|
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
>y : number
|
>y : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
(function() { return x + y});
|
(function() { return x + y});
|
||||||
>(function() { return x + y}) : () => number
|
>(function() { return x + y}) : () => number
|
||||||
>function() { return x + y} : () => number
|
>function() { return x + y} : () => number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 0
|
||||||
|
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
>(() => x + y) : () => number
|
>(() => x + y) : () => number
|
||||||
>() => x + y : () => number
|
>() => x + y : () => number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
|
||||||
}
|
|
|
@ -32,10 +32,10 @@ for (let x of []) {
|
||||||
|
|
||||||
for (let x = 0; x < 1; ++x) {
|
for (let x = 0; x < 1; ++x) {
|
||||||
>x : number
|
>x : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++x : number
|
>++x : number
|
||||||
>x : number
|
>x : number
|
||||||
|
|
||||||
|
@ -90,16 +90,16 @@ do {
|
||||||
|
|
||||||
for (let y = 0; y < 1; ++y) {
|
for (let y = 0; y < 1; ++y) {
|
||||||
>y : number
|
>y : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++y : number
|
>++y : number
|
||||||
>y : number
|
>y : number
|
||||||
|
|
||||||
let x = 1;
|
let x = 1;
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
(function() { return x});
|
(function() { return x});
|
||||||
>(function() { return x}) : () => number
|
>(function() { return x}) : () => number
|
||||||
|
@ -114,12 +114,12 @@ for (let y = 0; y < 1; ++y) {
|
||||||
|
|
||||||
for (let x = 0, y = 1; x < 1; ++x) {
|
for (let x = 0, y = 1; x < 1; ++x) {
|
||||||
>x : number
|
>x : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y : number
|
>y : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++x : number
|
>++x : number
|
||||||
>x : number
|
>x : number
|
||||||
|
|
||||||
|
@ -188,16 +188,16 @@ do {
|
||||||
|
|
||||||
for (let y = 0; y < 1; ++y) {
|
for (let y = 0; y < 1; ++y) {
|
||||||
>y : number
|
>y : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++y : number
|
>++y : number
|
||||||
>y : number
|
>y : number
|
||||||
|
|
||||||
let x = 1;
|
let x = 1;
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
(function() { return x + y});
|
(function() { return x + y});
|
||||||
>(function() { return x + y}) : () => number
|
>(function() { return x + y}) : () => number
|
||||||
|
@ -246,21 +246,21 @@ for (const x of []) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const x = 0; x < 1;) {
|
for (const x = 0; x < 1;) {
|
||||||
>x : number
|
>x : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
(function() { return x});
|
(function() { return x});
|
||||||
>(function() { return x}) : () => number
|
>(function() { return x}) : () => number
|
||||||
>function() { return x} : () => number
|
>function() { return x} : () => number
|
||||||
>x : number
|
>x : 0
|
||||||
|
|
||||||
(() => x);
|
(() => x);
|
||||||
>(() => x) : () => number
|
>(() => x) : () => number
|
||||||
>() => x : () => number
|
>() => x : () => number
|
||||||
>x : number
|
>x : 0
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1 === 1) {
|
while (1 === 1) {
|
||||||
|
@ -269,34 +269,34 @@ while (1 === 1) {
|
||||||
>1 : 1
|
>1 : 1
|
||||||
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
(function() { return x});
|
(function() { return x});
|
||||||
>(function() { return x}) : () => number
|
>(function() { return x}) : () => number
|
||||||
>function() { return x} : () => number
|
>function() { return x} : () => number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
(() => x);
|
(() => x);
|
||||||
>(() => x) : () => number
|
>(() => x) : () => number
|
||||||
>() => x : () => number
|
>() => x : () => number
|
||||||
>x : number
|
>x : 1
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
const x = 1;
|
const x = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
(function() { return x});
|
(function() { return x});
|
||||||
>(function() { return x}) : () => number
|
>(function() { return x}) : () => number
|
||||||
>function() { return x} : () => number
|
>function() { return x} : () => number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
(() => x);
|
(() => x);
|
||||||
>(() => x) : () => number
|
>(() => x) : () => number
|
||||||
>() => x : () => number
|
>() => x : () => number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
} while (1 === 1)
|
} while (1 === 1)
|
||||||
>1 === 1 : boolean
|
>1 === 1 : boolean
|
||||||
|
@ -304,49 +304,49 @@ do {
|
||||||
>1 : 1
|
>1 : 1
|
||||||
|
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
>y : number
|
>y : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
(function() { return x});
|
(function() { return x});
|
||||||
>(function() { return x}) : () => number
|
>(function() { return x}) : () => number
|
||||||
>function() { return x} : () => number
|
>function() { return x} : () => number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
(() => x);
|
(() => x);
|
||||||
>(() => x) : () => number
|
>(() => x) : () => number
|
||||||
>() => x : () => number
|
>() => x : () => number
|
||||||
>x : number
|
>x : 1
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const x = 0, y = 1; x < 1;) {
|
for (const x = 0, y = 1; x < 1;) {
|
||||||
>x : number
|
>x : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y : number
|
>y : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
(function() { return x + y});
|
(function() { return x + y});
|
||||||
>(function() { return x + y}) : () => number
|
>(function() { return x + y}) : () => number
|
||||||
>function() { return x + y} : () => number
|
>function() { return x + y} : () => number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 0
|
||||||
>y : number
|
>y : 1
|
||||||
|
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
>(() => x + y) : () => number
|
>(() => x + y) : () => number
|
||||||
>() => x + y : () => number
|
>() => x + y : () => number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 0
|
||||||
>y : number
|
>y : 1
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1 === 1) {
|
while (1 === 1) {
|
||||||
|
@ -355,46 +355,46 @@ while (1 === 1) {
|
||||||
>1 : 1
|
>1 : 1
|
||||||
|
|
||||||
const x = 1, y = 1;
|
const x = 1, y = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
(function() { return x + y});
|
(function() { return x + y});
|
||||||
>(function() { return x + y}) : () => number
|
>(function() { return x + y}) : () => number
|
||||||
>function() { return x + y} : () => number
|
>function() { return x + y} : () => number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
|
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
>(() => x + y) : () => number
|
>(() => x + y) : () => number
|
||||||
>() => x + y : () => number
|
>() => x + y : () => number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
const x = 1, y = 1;
|
const x = 1, y = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
(function() { return x + y});
|
(function() { return x + y});
|
||||||
>(function() { return x + y}) : () => number
|
>(function() { return x + y}) : () => number
|
||||||
>function() { return x + y} : () => number
|
>function() { return x + y} : () => number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
|
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
>(() => x + y) : () => number
|
>(() => x + y) : () => number
|
||||||
>() => x + y : () => number
|
>() => x + y : () => number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
|
|
||||||
} while (1 === 1)
|
} while (1 === 1)
|
||||||
>1 === 1 : boolean
|
>1 === 1 : boolean
|
||||||
|
@ -402,27 +402,27 @@ do {
|
||||||
>1 : 1
|
>1 : 1
|
||||||
|
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
>y : number
|
>y : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
(function() { return x + y});
|
(function() { return x + y});
|
||||||
>(function() { return x + y}) : () => number
|
>(function() { return x + y}) : () => number
|
||||||
>function() { return x + y} : () => number
|
>function() { return x + y} : () => number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 0
|
||||||
|
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
>(() => x + y) : () => number
|
>(() => x + y) : () => number
|
||||||
>() => x + y : () => number
|
>() => x + y : () => number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -68,10 +68,10 @@ function foo1(x) {
|
||||||
|
|
||||||
for (let x = 0; x < 1; ++x) {
|
for (let x = 0; x < 1; ++x) {
|
||||||
>x : number
|
>x : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++x : number
|
>++x : number
|
||||||
>x : number
|
>x : number
|
||||||
|
|
||||||
|
@ -168,10 +168,10 @@ function foo4(x) {
|
||||||
|
|
||||||
for (let y = 0; y < 1; ++y) {
|
for (let y = 0; y < 1; ++y) {
|
||||||
>y : number
|
>y : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++y : number
|
>++y : number
|
||||||
>y : number
|
>y : number
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ function foo4(x) {
|
||||||
|
|
||||||
let x = 1;
|
let x = 1;
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
(function() { return x + a });
|
(function() { return x + a });
|
||||||
>(function() { return x + a }) : () => number
|
>(function() { return x + a }) : () => number
|
||||||
|
@ -207,12 +207,12 @@ function foo5(x) {
|
||||||
|
|
||||||
for (let x = 0, y = 1; x < 1; ++x) {
|
for (let x = 0, y = 1; x < 1; ++x) {
|
||||||
>x : number
|
>x : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y : number
|
>y : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++x : number
|
>++x : number
|
||||||
>x : number
|
>x : number
|
||||||
|
|
||||||
|
@ -328,16 +328,16 @@ function foo8(x) {
|
||||||
|
|
||||||
for (let y = 0; y < 1; ++y) {
|
for (let y = 0; y < 1; ++y) {
|
||||||
>y : number
|
>y : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++y : number
|
>++y : number
|
||||||
>y : number
|
>y : number
|
||||||
|
|
||||||
let x = 1;
|
let x = 1;
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
let a = arguments.length;
|
let a = arguments.length;
|
||||||
>a : number
|
>a : number
|
||||||
|
@ -430,11 +430,11 @@ function foo1_c(x) {
|
||||||
>x : any
|
>x : any
|
||||||
|
|
||||||
for (const x = 0; x < 1;) {
|
for (const x = 0; x < 1;) {
|
||||||
>x : number
|
>x : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
const a = arguments.length;
|
const a = arguments.length;
|
||||||
>a : number
|
>a : number
|
||||||
|
@ -446,14 +446,14 @@ function foo1_c(x) {
|
||||||
>(function() { return x + a }) : () => number
|
>(function() { return x + a }) : () => number
|
||||||
>function() { return x + a } : () => number
|
>function() { return x + a } : () => number
|
||||||
>x + a : number
|
>x + a : number
|
||||||
>x : number
|
>x : 0
|
||||||
>a : number
|
>a : number
|
||||||
|
|
||||||
(() => x + a);
|
(() => x + a);
|
||||||
>(() => x + a) : () => number
|
>(() => x + a) : () => number
|
||||||
>() => x + a : () => number
|
>() => x + a : () => number
|
||||||
>x + a : number
|
>x + a : number
|
||||||
>x : number
|
>x : 0
|
||||||
>a : number
|
>a : number
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -495,8 +495,8 @@ function foo3_c(x) {
|
||||||
|
|
||||||
do {
|
do {
|
||||||
const x = 1;
|
const x = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
const a = arguments.length;
|
const a = arguments.length;
|
||||||
>a : number
|
>a : number
|
||||||
|
@ -508,14 +508,14 @@ function foo3_c(x) {
|
||||||
>(function() { return x + a }) : () => number
|
>(function() { return x + a }) : () => number
|
||||||
>function() { return x + a } : () => number
|
>function() { return x + a } : () => number
|
||||||
>x + a : number
|
>x + a : number
|
||||||
>x : number
|
>x : 1
|
||||||
>a : number
|
>a : number
|
||||||
|
|
||||||
(() => x + a);
|
(() => x + a);
|
||||||
>(() => x + a) : () => number
|
>(() => x + a) : () => number
|
||||||
>() => x + a : () => number
|
>() => x + a : () => number
|
||||||
>x + a : number
|
>x + a : number
|
||||||
>x : number
|
>x : 1
|
||||||
>a : number
|
>a : number
|
||||||
|
|
||||||
} while (1 === 1)
|
} while (1 === 1)
|
||||||
|
@ -529,11 +529,11 @@ function foo4_c(x) {
|
||||||
>x : any
|
>x : any
|
||||||
|
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
>y : number
|
>y : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
const a = arguments.length;
|
const a = arguments.length;
|
||||||
>a : number
|
>a : number
|
||||||
|
@ -542,21 +542,21 @@ function foo4_c(x) {
|
||||||
>length : number
|
>length : number
|
||||||
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
(function() { return x + a });
|
(function() { return x + a });
|
||||||
>(function() { return x + a }) : () => number
|
>(function() { return x + a }) : () => number
|
||||||
>function() { return x + a } : () => number
|
>function() { return x + a } : () => number
|
||||||
>x + a : number
|
>x + a : number
|
||||||
>x : number
|
>x : 1
|
||||||
>a : number
|
>a : number
|
||||||
|
|
||||||
(() => x + a);
|
(() => x + a);
|
||||||
>(() => x + a) : () => number
|
>(() => x + a) : () => number
|
||||||
>() => x + a : () => number
|
>() => x + a : () => number
|
||||||
>x + a : number
|
>x + a : number
|
||||||
>x : number
|
>x : 1
|
||||||
>a : number
|
>a : number
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -566,13 +566,13 @@ function foo5_c(x) {
|
||||||
>x : any
|
>x : any
|
||||||
|
|
||||||
for (const x = 0, y = 1; x < 1;) {
|
for (const x = 0, y = 1; x < 1;) {
|
||||||
>x : number
|
>x : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y : number
|
>y : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
const a = arguments.length;
|
const a = arguments.length;
|
||||||
>a : number
|
>a : number
|
||||||
|
@ -585,8 +585,8 @@ function foo5_c(x) {
|
||||||
>function() { return x + y + a } : () => number
|
>function() { return x + y + a } : () => number
|
||||||
>x + y + a : number
|
>x + y + a : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 0
|
||||||
>y : number
|
>y : 1
|
||||||
>a : number
|
>a : number
|
||||||
|
|
||||||
(() => x + y + a);
|
(() => x + y + a);
|
||||||
|
@ -594,8 +594,8 @@ function foo5_c(x) {
|
||||||
>() => x + y + a : () => number
|
>() => x + y + a : () => number
|
||||||
>x + y + a : number
|
>x + y + a : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 0
|
||||||
>y : number
|
>y : 1
|
||||||
>a : number
|
>a : number
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -611,10 +611,10 @@ function foo6_c(x) {
|
||||||
>1 : 1
|
>1 : 1
|
||||||
|
|
||||||
const x = 1, y =1 ;
|
const x = 1, y =1 ;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
const a = arguments.length;
|
const a = arguments.length;
|
||||||
>a : number
|
>a : number
|
||||||
|
@ -627,8 +627,8 @@ function foo6_c(x) {
|
||||||
>function() { return x + y + a } : () => number
|
>function() { return x + y + a } : () => number
|
||||||
>x + y + a : number
|
>x + y + a : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>a : number
|
>a : number
|
||||||
|
|
||||||
(() => x + y + a);
|
(() => x + y + a);
|
||||||
|
@ -636,8 +636,8 @@ function foo6_c(x) {
|
||||||
>() => x + y + a : () => number
|
>() => x + y + a : () => number
|
||||||
>x + y + a : number
|
>x + y + a : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>a : number
|
>a : number
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -648,10 +648,10 @@ function foo7_c(x) {
|
||||||
|
|
||||||
do {
|
do {
|
||||||
const x = 1, y = 1;
|
const x = 1, y = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
const a = arguments.length;
|
const a = arguments.length;
|
||||||
>a : number
|
>a : number
|
||||||
|
@ -664,8 +664,8 @@ function foo7_c(x) {
|
||||||
>function() { return x + y + a } : () => number
|
>function() { return x + y + a } : () => number
|
||||||
>x + y + a : number
|
>x + y + a : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>a : number
|
>a : number
|
||||||
|
|
||||||
(() => x + y + a);
|
(() => x + y + a);
|
||||||
|
@ -673,8 +673,8 @@ function foo7_c(x) {
|
||||||
>() => x + y + a : () => number
|
>() => x + y + a : () => number
|
||||||
>x + y + a : number
|
>x + y + a : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>a : number
|
>a : number
|
||||||
|
|
||||||
} while (1 === 1)
|
} while (1 === 1)
|
||||||
|
@ -689,15 +689,15 @@ function foo8_c(x) {
|
||||||
>x : any
|
>x : any
|
||||||
|
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
>y : number
|
>y : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
const a = arguments.length;
|
const a = arguments.length;
|
||||||
>a : number
|
>a : number
|
||||||
|
@ -710,8 +710,8 @@ function foo8_c(x) {
|
||||||
>function() { return x + y + a } : () => number
|
>function() { return x + y + a } : () => number
|
||||||
>x + y + a : number
|
>x + y + a : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 0
|
||||||
>a : number
|
>a : number
|
||||||
|
|
||||||
(() => x + y + a);
|
(() => x + y + a);
|
||||||
|
@ -719,8 +719,8 @@ function foo8_c(x) {
|
||||||
>() => x + y + a : () => number
|
>() => x + y + a : () => number
|
||||||
>x + y + a : number
|
>x + y + a : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 0
|
||||||
>a : number
|
>a : number
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -67,10 +67,10 @@ function foo1(x) {
|
||||||
|
|
||||||
for (let x = 0; x < 1; ++x) {
|
for (let x = 0; x < 1; ++x) {
|
||||||
>x : number
|
>x : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++x : number
|
>++x : number
|
||||||
>x : number
|
>x : number
|
||||||
|
|
||||||
|
@ -167,10 +167,10 @@ function foo4(x) {
|
||||||
|
|
||||||
for (let y = 0; y < 1; ++y) {
|
for (let y = 0; y < 1; ++y) {
|
||||||
>y : number
|
>y : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++y : number
|
>++y : number
|
||||||
>y : number
|
>y : number
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ function foo4(x) {
|
||||||
|
|
||||||
let x = 1;
|
let x = 1;
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
(function() { return x + a });
|
(function() { return x + a });
|
||||||
>(function() { return x + a }) : () => number
|
>(function() { return x + a }) : () => number
|
||||||
|
@ -206,12 +206,12 @@ function foo5(x) {
|
||||||
|
|
||||||
for (let x = 0, y = 1; x < 1; ++x) {
|
for (let x = 0, y = 1; x < 1; ++x) {
|
||||||
>x : number
|
>x : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y : number
|
>y : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++x : number
|
>++x : number
|
||||||
>x : number
|
>x : number
|
||||||
|
|
||||||
|
@ -327,16 +327,16 @@ function foo8(x) {
|
||||||
|
|
||||||
for (let y = 0; y < 1; ++y) {
|
for (let y = 0; y < 1; ++y) {
|
||||||
>y : number
|
>y : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++y : number
|
>++y : number
|
||||||
>y : number
|
>y : number
|
||||||
|
|
||||||
let x = 1;
|
let x = 1;
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
let a = arguments.length;
|
let a = arguments.length;
|
||||||
>a : number
|
>a : number
|
||||||
|
@ -429,11 +429,11 @@ function foo1_c(x) {
|
||||||
>x : any
|
>x : any
|
||||||
|
|
||||||
for (const x = 0; x < 1;) {
|
for (const x = 0; x < 1;) {
|
||||||
>x : number
|
>x : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
const a = arguments.length;
|
const a = arguments.length;
|
||||||
>a : number
|
>a : number
|
||||||
|
@ -445,14 +445,14 @@ function foo1_c(x) {
|
||||||
>(function() { return x + a }) : () => number
|
>(function() { return x + a }) : () => number
|
||||||
>function() { return x + a } : () => number
|
>function() { return x + a } : () => number
|
||||||
>x + a : number
|
>x + a : number
|
||||||
>x : number
|
>x : 0
|
||||||
>a : number
|
>a : number
|
||||||
|
|
||||||
(() => x + a);
|
(() => x + a);
|
||||||
>(() => x + a) : () => number
|
>(() => x + a) : () => number
|
||||||
>() => x + a : () => number
|
>() => x + a : () => number
|
||||||
>x + a : number
|
>x + a : number
|
||||||
>x : number
|
>x : 0
|
||||||
>a : number
|
>a : number
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -494,8 +494,8 @@ function foo3_c(x) {
|
||||||
|
|
||||||
do {
|
do {
|
||||||
const x = 1;
|
const x = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
const a = arguments.length;
|
const a = arguments.length;
|
||||||
>a : number
|
>a : number
|
||||||
|
@ -507,14 +507,14 @@ function foo3_c(x) {
|
||||||
>(function() { return x + a }) : () => number
|
>(function() { return x + a }) : () => number
|
||||||
>function() { return x + a } : () => number
|
>function() { return x + a } : () => number
|
||||||
>x + a : number
|
>x + a : number
|
||||||
>x : number
|
>x : 1
|
||||||
>a : number
|
>a : number
|
||||||
|
|
||||||
(() => x + a);
|
(() => x + a);
|
||||||
>(() => x + a) : () => number
|
>(() => x + a) : () => number
|
||||||
>() => x + a : () => number
|
>() => x + a : () => number
|
||||||
>x + a : number
|
>x + a : number
|
||||||
>x : number
|
>x : 1
|
||||||
>a : number
|
>a : number
|
||||||
|
|
||||||
} while (1 === 1)
|
} while (1 === 1)
|
||||||
|
@ -528,11 +528,11 @@ function foo4_c(x) {
|
||||||
>x : any
|
>x : any
|
||||||
|
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
>y : number
|
>y : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
const a = arguments.length;
|
const a = arguments.length;
|
||||||
>a : number
|
>a : number
|
||||||
|
@ -541,21 +541,21 @@ function foo4_c(x) {
|
||||||
>length : number
|
>length : number
|
||||||
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
(function() { return x + a });
|
(function() { return x + a });
|
||||||
>(function() { return x + a }) : () => number
|
>(function() { return x + a }) : () => number
|
||||||
>function() { return x + a } : () => number
|
>function() { return x + a } : () => number
|
||||||
>x + a : number
|
>x + a : number
|
||||||
>x : number
|
>x : 1
|
||||||
>a : number
|
>a : number
|
||||||
|
|
||||||
(() => x + a);
|
(() => x + a);
|
||||||
>(() => x + a) : () => number
|
>(() => x + a) : () => number
|
||||||
>() => x + a : () => number
|
>() => x + a : () => number
|
||||||
>x + a : number
|
>x + a : number
|
||||||
>x : number
|
>x : 1
|
||||||
>a : number
|
>a : number
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -565,13 +565,13 @@ function foo5_c(x) {
|
||||||
>x : any
|
>x : any
|
||||||
|
|
||||||
for (const x = 0, y = 1; x < 1;) {
|
for (const x = 0, y = 1; x < 1;) {
|
||||||
>x : number
|
>x : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y : number
|
>y : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
const a = arguments.length;
|
const a = arguments.length;
|
||||||
>a : number
|
>a : number
|
||||||
|
@ -584,8 +584,8 @@ function foo5_c(x) {
|
||||||
>function() { return x + y + a } : () => number
|
>function() { return x + y + a } : () => number
|
||||||
>x + y + a : number
|
>x + y + a : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 0
|
||||||
>y : number
|
>y : 1
|
||||||
>a : number
|
>a : number
|
||||||
|
|
||||||
(() => x + y + a);
|
(() => x + y + a);
|
||||||
|
@ -593,8 +593,8 @@ function foo5_c(x) {
|
||||||
>() => x + y + a : () => number
|
>() => x + y + a : () => number
|
||||||
>x + y + a : number
|
>x + y + a : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 0
|
||||||
>y : number
|
>y : 1
|
||||||
>a : number
|
>a : number
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -610,10 +610,10 @@ function foo6_c(x) {
|
||||||
>1 : 1
|
>1 : 1
|
||||||
|
|
||||||
const x = 1, y =1 ;
|
const x = 1, y =1 ;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
const a = arguments.length;
|
const a = arguments.length;
|
||||||
>a : number
|
>a : number
|
||||||
|
@ -626,8 +626,8 @@ function foo6_c(x) {
|
||||||
>function() { return x + y + a } : () => number
|
>function() { return x + y + a } : () => number
|
||||||
>x + y + a : number
|
>x + y + a : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>a : number
|
>a : number
|
||||||
|
|
||||||
(() => x + y + a);
|
(() => x + y + a);
|
||||||
|
@ -635,8 +635,8 @@ function foo6_c(x) {
|
||||||
>() => x + y + a : () => number
|
>() => x + y + a : () => number
|
||||||
>x + y + a : number
|
>x + y + a : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>a : number
|
>a : number
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -647,10 +647,10 @@ function foo7_c(x) {
|
||||||
|
|
||||||
do {
|
do {
|
||||||
const x = 1, y = 1;
|
const x = 1, y = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
const a = arguments.length;
|
const a = arguments.length;
|
||||||
>a : number
|
>a : number
|
||||||
|
@ -663,8 +663,8 @@ function foo7_c(x) {
|
||||||
>function() { return x + y + a } : () => number
|
>function() { return x + y + a } : () => number
|
||||||
>x + y + a : number
|
>x + y + a : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>a : number
|
>a : number
|
||||||
|
|
||||||
(() => x + y + a);
|
(() => x + y + a);
|
||||||
|
@ -672,8 +672,8 @@ function foo7_c(x) {
|
||||||
>() => x + y + a : () => number
|
>() => x + y + a : () => number
|
||||||
>x + y + a : number
|
>x + y + a : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>a : number
|
>a : number
|
||||||
|
|
||||||
} while (1 === 1)
|
} while (1 === 1)
|
||||||
|
@ -688,15 +688,15 @@ function foo8_c(x) {
|
||||||
>x : any
|
>x : any
|
||||||
|
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
>y : number
|
>y : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
const a = arguments.length;
|
const a = arguments.length;
|
||||||
>a : number
|
>a : number
|
||||||
|
@ -709,8 +709,8 @@ function foo8_c(x) {
|
||||||
>function() { return x + y + a } : () => number
|
>function() { return x + y + a } : () => number
|
||||||
>x + y + a : number
|
>x + y + a : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 0
|
||||||
>a : number
|
>a : number
|
||||||
|
|
||||||
(() => x + y + a);
|
(() => x + y + a);
|
||||||
|
@ -718,8 +718,8 @@ function foo8_c(x) {
|
||||||
>() => x + y + a : () => number
|
>() => x + y + a : () => number
|
||||||
>x + y + a : number
|
>x + y + a : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 0
|
||||||
>a : number
|
>a : number
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
|
||||||
}
|
|
|
@ -76,10 +76,10 @@ function foo1(x) {
|
||||||
|
|
||||||
for (let x = 0; x < 1; ++x) {
|
for (let x = 0; x < 1; ++x) {
|
||||||
>x : number
|
>x : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++x : number
|
>++x : number
|
||||||
>x : number
|
>x : number
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ function foo2(x) {
|
||||||
|
|
||||||
let x = 1;
|
let x = 1;
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v = x;
|
var v = x;
|
||||||
>v : number
|
>v : number
|
||||||
|
@ -179,7 +179,7 @@ function foo3(x) {
|
||||||
use(v);
|
use(v);
|
||||||
>use(v) : any
|
>use(v) : any
|
||||||
>use : (a: any) => any
|
>use : (a: any) => any
|
||||||
>v : any
|
>v : undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
function foo4(x) {
|
function foo4(x) {
|
||||||
|
@ -188,10 +188,10 @@ function foo4(x) {
|
||||||
|
|
||||||
for (let y = 0; y < 1; ++y) {
|
for (let y = 0; y < 1; ++y) {
|
||||||
>y : number
|
>y : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++y : number
|
>++y : number
|
||||||
>y : number
|
>y : number
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ function foo4(x) {
|
||||||
|
|
||||||
let x = 1;
|
let x = 1;
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
(function() { return x + v });
|
(function() { return x + v });
|
||||||
>(function() { return x + v }) : () => number
|
>(function() { return x + v }) : () => number
|
||||||
|
@ -230,12 +230,12 @@ function foo5(x) {
|
||||||
|
|
||||||
for (let x = 0, y = 1; x < 1; ++x) {
|
for (let x = 0, y = 1; x < 1; ++x) {
|
||||||
>x : number
|
>x : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y : number
|
>y : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++x : number
|
>++x : number
|
||||||
>x : number
|
>x : number
|
||||||
|
|
||||||
|
@ -283,8 +283,8 @@ function foo6(x) {
|
||||||
>y : any
|
>y : any
|
||||||
|
|
||||||
var v = x;
|
var v = x;
|
||||||
>v : any
|
>v : undefined
|
||||||
>x : any
|
>x : undefined
|
||||||
|
|
||||||
(function() { return x + y + v });
|
(function() { return x + y + v });
|
||||||
>(function() { return x + y + v }) : () => any
|
>(function() { return x + y + v }) : () => any
|
||||||
|
@ -293,7 +293,7 @@ function foo6(x) {
|
||||||
>x + y : any
|
>x + y : any
|
||||||
>x : any
|
>x : any
|
||||||
>y : any
|
>y : any
|
||||||
>v : any
|
>v : undefined
|
||||||
|
|
||||||
(() => x + y + v);
|
(() => x + y + v);
|
||||||
>(() => x + y + v) : () => any
|
>(() => x + y + v) : () => any
|
||||||
|
@ -302,13 +302,13 @@ function foo6(x) {
|
||||||
>x + y : any
|
>x + y : any
|
||||||
>x : any
|
>x : any
|
||||||
>y : any
|
>y : any
|
||||||
>v : any
|
>v : undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
use(v)
|
use(v)
|
||||||
>use(v) : any
|
>use(v) : any
|
||||||
>use : (a: any) => any
|
>use : (a: any) => any
|
||||||
>v : any
|
>v : undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
function foo7(x) {
|
function foo7(x) {
|
||||||
|
@ -321,8 +321,8 @@ function foo7(x) {
|
||||||
>y : any
|
>y : any
|
||||||
|
|
||||||
var v = x;
|
var v = x;
|
||||||
>v : any
|
>v : undefined
|
||||||
>x : any
|
>x : undefined
|
||||||
|
|
||||||
(function() { return x + y + v });
|
(function() { return x + y + v });
|
||||||
>(function() { return x + y + v }) : () => any
|
>(function() { return x + y + v }) : () => any
|
||||||
|
@ -331,7 +331,7 @@ function foo7(x) {
|
||||||
>x + y : any
|
>x + y : any
|
||||||
>x : any
|
>x : any
|
||||||
>y : any
|
>y : any
|
||||||
>v : any
|
>v : undefined
|
||||||
|
|
||||||
(() => x + y + v);
|
(() => x + y + v);
|
||||||
>(() => x + y + v) : () => any
|
>(() => x + y + v) : () => any
|
||||||
|
@ -340,7 +340,7 @@ function foo7(x) {
|
||||||
>x + y : any
|
>x + y : any
|
||||||
>x : any
|
>x : any
|
||||||
>y : any
|
>y : any
|
||||||
>v : any
|
>v : undefined
|
||||||
|
|
||||||
} while (1 === 1);
|
} while (1 === 1);
|
||||||
>1 === 1 : boolean
|
>1 === 1 : boolean
|
||||||
|
@ -350,7 +350,7 @@ function foo7(x) {
|
||||||
use(v);
|
use(v);
|
||||||
>use(v) : any
|
>use(v) : any
|
||||||
>use : (a: any) => any
|
>use : (a: any) => any
|
||||||
>v : any
|
>v : undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -360,16 +360,16 @@ function foo8(x) {
|
||||||
|
|
||||||
for (let y = 0; y < 1; ++y) {
|
for (let y = 0; y < 1; ++y) {
|
||||||
>y : number
|
>y : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++y : number
|
>++y : number
|
||||||
>y : number
|
>y : number
|
||||||
|
|
||||||
let x = 1;
|
let x = 1;
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v = x;
|
var v = x;
|
||||||
>v : number
|
>v : number
|
||||||
|
@ -471,28 +471,28 @@ function foo1_c(x) {
|
||||||
>x : any
|
>x : any
|
||||||
|
|
||||||
for (const x = 0; x < 1;) {
|
for (const x = 0; x < 1;) {
|
||||||
>x : number
|
>x : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v = x;
|
var v = x;
|
||||||
>v : number
|
>v : number
|
||||||
>x : number
|
>x : 0
|
||||||
|
|
||||||
(function() { return x + v });
|
(function() { return x + v });
|
||||||
>(function() { return x + v }) : () => number
|
>(function() { return x + v }) : () => number
|
||||||
>function() { return x + v } : () => number
|
>function() { return x + v } : () => number
|
||||||
>x + v : number
|
>x + v : number
|
||||||
>x : number
|
>x : 0
|
||||||
>v : number
|
>v : number
|
||||||
|
|
||||||
(() => x + v);
|
(() => x + v);
|
||||||
>(() => x + v) : () => number
|
>(() => x + v) : () => number
|
||||||
>() => x + v : () => number
|
>() => x + v : () => number
|
||||||
>x + v : number
|
>x + v : number
|
||||||
>x : number
|
>x : 0
|
||||||
>v : number
|
>v : number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -512,25 +512,25 @@ function foo2_c(x) {
|
||||||
>1 : 1
|
>1 : 1
|
||||||
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v = x;
|
var v = x;
|
||||||
>v : number
|
>v : number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
(function() { return x + v });
|
(function() { return x + v });
|
||||||
>(function() { return x + v }) : () => number
|
>(function() { return x + v }) : () => number
|
||||||
>function() { return x + v } : () => number
|
>function() { return x + v } : () => number
|
||||||
>x + v : number
|
>x + v : number
|
||||||
>x : number
|
>x : 1
|
||||||
>v : number
|
>v : number
|
||||||
|
|
||||||
(() => x + v);
|
(() => x + v);
|
||||||
>(() => x + v) : () => number
|
>(() => x + v) : () => number
|
||||||
>() => x + v : () => number
|
>() => x + v : () => number
|
||||||
>x + v : number
|
>x + v : number
|
||||||
>x : number
|
>x : 1
|
||||||
>v : number
|
>v : number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -546,8 +546,8 @@ function foo3_c(x) {
|
||||||
|
|
||||||
do {
|
do {
|
||||||
const x = 1;
|
const x = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v;
|
var v;
|
||||||
>v : any
|
>v : any
|
||||||
|
@ -556,14 +556,14 @@ function foo3_c(x) {
|
||||||
>(function() { return x + v }) : () => any
|
>(function() { return x + v }) : () => any
|
||||||
>function() { return x + v } : () => any
|
>function() { return x + v } : () => any
|
||||||
>x + v : any
|
>x + v : any
|
||||||
>x : number
|
>x : 1
|
||||||
>v : any
|
>v : any
|
||||||
|
|
||||||
(() => x + v);
|
(() => x + v);
|
||||||
>(() => x + v) : () => any
|
>(() => x + v) : () => any
|
||||||
>() => x + v : () => any
|
>() => x + v : () => any
|
||||||
>x + v : any
|
>x + v : any
|
||||||
>x : number
|
>x : 1
|
||||||
>v : any
|
>v : any
|
||||||
|
|
||||||
} while (1 === 1);
|
} while (1 === 1);
|
||||||
|
@ -574,7 +574,7 @@ function foo3_c(x) {
|
||||||
use(v);
|
use(v);
|
||||||
>use(v) : any
|
>use(v) : any
|
||||||
>use : (a: any) => any
|
>use : (a: any) => any
|
||||||
>v : any
|
>v : undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
function foo4_c(x) {
|
function foo4_c(x) {
|
||||||
|
@ -582,32 +582,32 @@ function foo4_c(x) {
|
||||||
>x : any
|
>x : any
|
||||||
|
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
>y : number
|
>y : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v = y;
|
var v = y;
|
||||||
>v : number
|
>v : number
|
||||||
>y : number
|
>y : 0
|
||||||
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
(function() { return x + v });
|
(function() { return x + v });
|
||||||
>(function() { return x + v }) : () => number
|
>(function() { return x + v }) : () => number
|
||||||
>function() { return x + v } : () => number
|
>function() { return x + v } : () => number
|
||||||
>x + v : number
|
>x + v : number
|
||||||
>x : number
|
>x : 1
|
||||||
>v : number
|
>v : number
|
||||||
|
|
||||||
(() => x + v);
|
(() => x + v);
|
||||||
>(() => x + v) : () => number
|
>(() => x + v) : () => number
|
||||||
>() => x + v : () => number
|
>() => x + v : () => number
|
||||||
>x + v : number
|
>x + v : number
|
||||||
>x : number
|
>x : 1
|
||||||
>v : number
|
>v : number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -622,25 +622,25 @@ function foo5_c(x) {
|
||||||
>x : any
|
>x : any
|
||||||
|
|
||||||
for (const x = 0, y = 1; x < 1;) {
|
for (const x = 0, y = 1; x < 1;) {
|
||||||
>x : number
|
>x : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y : number
|
>y : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v = x;
|
var v = x;
|
||||||
>v : number
|
>v : number
|
||||||
>x : number
|
>x : 0
|
||||||
|
|
||||||
(function() { return x + y + v });
|
(function() { return x + y + v });
|
||||||
>(function() { return x + y + v }) : () => number
|
>(function() { return x + y + v }) : () => number
|
||||||
>function() { return x + y + v } : () => number
|
>function() { return x + y + v } : () => number
|
||||||
>x + y + v : number
|
>x + y + v : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 0
|
||||||
>y : number
|
>y : 1
|
||||||
>v : number
|
>v : number
|
||||||
|
|
||||||
(() => x + y + v);
|
(() => x + y + v);
|
||||||
|
@ -648,8 +648,8 @@ function foo5_c(x) {
|
||||||
>() => x + y + v : () => number
|
>() => x + y + v : () => number
|
||||||
>x + y + v : number
|
>x + y + v : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 0
|
||||||
>y : number
|
>y : 1
|
||||||
>v : number
|
>v : number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -670,22 +670,22 @@ function foo6_c(x) {
|
||||||
>1 : 1
|
>1 : 1
|
||||||
|
|
||||||
const x = 1, y = 1;
|
const x = 1, y = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v = x;
|
var v = x;
|
||||||
>v : number
|
>v : number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
(function() { return x + y + v });
|
(function() { return x + y + v });
|
||||||
>(function() { return x + y + v }) : () => number
|
>(function() { return x + y + v }) : () => number
|
||||||
>function() { return x + y + v } : () => number
|
>function() { return x + y + v } : () => number
|
||||||
>x + y + v : number
|
>x + y + v : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>v : number
|
>v : number
|
||||||
|
|
||||||
(() => x + y + v);
|
(() => x + y + v);
|
||||||
|
@ -693,8 +693,8 @@ function foo6_c(x) {
|
||||||
>() => x + y + v : () => number
|
>() => x + y + v : () => number
|
||||||
>x + y + v : number
|
>x + y + v : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>v : number
|
>v : number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -710,22 +710,22 @@ function foo7_c(x) {
|
||||||
|
|
||||||
do {
|
do {
|
||||||
const x = 1, y = 1;
|
const x = 1, y = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v = x;
|
var v = x;
|
||||||
>v : number
|
>v : number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
(function() { return x + y + v });
|
(function() { return x + y + v });
|
||||||
>(function() { return x + y + v }) : () => number
|
>(function() { return x + y + v }) : () => number
|
||||||
>function() { return x + y + v } : () => number
|
>function() { return x + y + v } : () => number
|
||||||
>x + y + v : number
|
>x + y + v : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>v : number
|
>v : number
|
||||||
|
|
||||||
(() => x + y + v);
|
(() => x + y + v);
|
||||||
|
@ -733,8 +733,8 @@ function foo7_c(x) {
|
||||||
>() => x + y + v : () => number
|
>() => x + y + v : () => number
|
||||||
>x + y + v : number
|
>x + y + v : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>v : number
|
>v : number
|
||||||
|
|
||||||
} while (1 === 1);
|
} while (1 === 1);
|
||||||
|
@ -754,27 +754,27 @@ function foo8_c(x) {
|
||||||
>x : any
|
>x : any
|
||||||
|
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
>y : number
|
>y : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v = x;
|
var v = x;
|
||||||
>v : number
|
>v : number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
(function() { return x + y + v });
|
(function() { return x + y + v });
|
||||||
>(function() { return x + y + v }) : () => number
|
>(function() { return x + y + v }) : () => number
|
||||||
>function() { return x + y + v } : () => number
|
>function() { return x + y + v } : () => number
|
||||||
>x + y + v : number
|
>x + y + v : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 0
|
||||||
>v : number
|
>v : number
|
||||||
|
|
||||||
(() => x + y + v);
|
(() => x + y + v);
|
||||||
|
@ -782,8 +782,8 @@ function foo8_c(x) {
|
||||||
>() => x + y + v : () => number
|
>() => x + y + v : () => number
|
||||||
>x + y + v : number
|
>x + y + v : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 0
|
||||||
>v : number
|
>v : number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
|
||||||
}
|
|
|
@ -77,10 +77,10 @@ function foo1(x) {
|
||||||
|
|
||||||
for (let x = 0; x < 1; ++x) {
|
for (let x = 0; x < 1; ++x) {
|
||||||
>x : number
|
>x : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++x : number
|
>++x : number
|
||||||
>x : number
|
>x : number
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ function foo2(x) {
|
||||||
|
|
||||||
let x = 1;
|
let x = 1;
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v = x;
|
var v = x;
|
||||||
>v : number
|
>v : number
|
||||||
|
@ -180,7 +180,7 @@ function foo3(x) {
|
||||||
use(v);
|
use(v);
|
||||||
>use(v) : any
|
>use(v) : any
|
||||||
>use : (a: any) => any
|
>use : (a: any) => any
|
||||||
>v : any
|
>v : undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
function foo4(x) {
|
function foo4(x) {
|
||||||
|
@ -189,10 +189,10 @@ function foo4(x) {
|
||||||
|
|
||||||
for (let y = 0; y < 1; ++y) {
|
for (let y = 0; y < 1; ++y) {
|
||||||
>y : number
|
>y : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++y : number
|
>++y : number
|
||||||
>y : number
|
>y : number
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ function foo4(x) {
|
||||||
|
|
||||||
let x = 1;
|
let x = 1;
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
(function() { return x + v });
|
(function() { return x + v });
|
||||||
>(function() { return x + v }) : () => number
|
>(function() { return x + v }) : () => number
|
||||||
|
@ -231,12 +231,12 @@ function foo5(x) {
|
||||||
|
|
||||||
for (let x = 0, y = 1; x < 1; ++x) {
|
for (let x = 0, y = 1; x < 1; ++x) {
|
||||||
>x : number
|
>x : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y : number
|
>y : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++x : number
|
>++x : number
|
||||||
>x : number
|
>x : number
|
||||||
|
|
||||||
|
@ -284,8 +284,8 @@ function foo6(x) {
|
||||||
>y : any
|
>y : any
|
||||||
|
|
||||||
var v = x;
|
var v = x;
|
||||||
>v : any
|
>v : undefined
|
||||||
>x : any
|
>x : undefined
|
||||||
|
|
||||||
(function() { return x + y + v });
|
(function() { return x + y + v });
|
||||||
>(function() { return x + y + v }) : () => any
|
>(function() { return x + y + v }) : () => any
|
||||||
|
@ -294,7 +294,7 @@ function foo6(x) {
|
||||||
>x + y : any
|
>x + y : any
|
||||||
>x : any
|
>x : any
|
||||||
>y : any
|
>y : any
|
||||||
>v : any
|
>v : undefined
|
||||||
|
|
||||||
(() => x + y + v);
|
(() => x + y + v);
|
||||||
>(() => x + y + v) : () => any
|
>(() => x + y + v) : () => any
|
||||||
|
@ -303,13 +303,13 @@ function foo6(x) {
|
||||||
>x + y : any
|
>x + y : any
|
||||||
>x : any
|
>x : any
|
||||||
>y : any
|
>y : any
|
||||||
>v : any
|
>v : undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
use(v)
|
use(v)
|
||||||
>use(v) : any
|
>use(v) : any
|
||||||
>use : (a: any) => any
|
>use : (a: any) => any
|
||||||
>v : any
|
>v : undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
function foo7(x) {
|
function foo7(x) {
|
||||||
|
@ -322,8 +322,8 @@ function foo7(x) {
|
||||||
>y : any
|
>y : any
|
||||||
|
|
||||||
var v = x;
|
var v = x;
|
||||||
>v : any
|
>v : undefined
|
||||||
>x : any
|
>x : undefined
|
||||||
|
|
||||||
(function() { return x + y + v });
|
(function() { return x + y + v });
|
||||||
>(function() { return x + y + v }) : () => any
|
>(function() { return x + y + v }) : () => any
|
||||||
|
@ -332,7 +332,7 @@ function foo7(x) {
|
||||||
>x + y : any
|
>x + y : any
|
||||||
>x : any
|
>x : any
|
||||||
>y : any
|
>y : any
|
||||||
>v : any
|
>v : undefined
|
||||||
|
|
||||||
(() => x + y + v);
|
(() => x + y + v);
|
||||||
>(() => x + y + v) : () => any
|
>(() => x + y + v) : () => any
|
||||||
|
@ -341,7 +341,7 @@ function foo7(x) {
|
||||||
>x + y : any
|
>x + y : any
|
||||||
>x : any
|
>x : any
|
||||||
>y : any
|
>y : any
|
||||||
>v : any
|
>v : undefined
|
||||||
|
|
||||||
} while (1 === 1);
|
} while (1 === 1);
|
||||||
>1 === 1 : boolean
|
>1 === 1 : boolean
|
||||||
|
@ -351,7 +351,7 @@ function foo7(x) {
|
||||||
use(v);
|
use(v);
|
||||||
>use(v) : any
|
>use(v) : any
|
||||||
>use : (a: any) => any
|
>use : (a: any) => any
|
||||||
>v : any
|
>v : undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -361,16 +361,16 @@ function foo8(x) {
|
||||||
|
|
||||||
for (let y = 0; y < 1; ++y) {
|
for (let y = 0; y < 1; ++y) {
|
||||||
>y : number
|
>y : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++y : number
|
>++y : number
|
||||||
>y : number
|
>y : number
|
||||||
|
|
||||||
let x = 1;
|
let x = 1;
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v = x;
|
var v = x;
|
||||||
>v : number
|
>v : number
|
||||||
|
@ -472,28 +472,28 @@ function foo1_c(x) {
|
||||||
>x : any
|
>x : any
|
||||||
|
|
||||||
for (const x = 0; x < 1;) {
|
for (const x = 0; x < 1;) {
|
||||||
>x : number
|
>x : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v = x;
|
var v = x;
|
||||||
>v : number
|
>v : number
|
||||||
>x : number
|
>x : 0
|
||||||
|
|
||||||
(function() { return x + v });
|
(function() { return x + v });
|
||||||
>(function() { return x + v }) : () => number
|
>(function() { return x + v }) : () => number
|
||||||
>function() { return x + v } : () => number
|
>function() { return x + v } : () => number
|
||||||
>x + v : number
|
>x + v : number
|
||||||
>x : number
|
>x : 0
|
||||||
>v : number
|
>v : number
|
||||||
|
|
||||||
(() => x + v);
|
(() => x + v);
|
||||||
>(() => x + v) : () => number
|
>(() => x + v) : () => number
|
||||||
>() => x + v : () => number
|
>() => x + v : () => number
|
||||||
>x + v : number
|
>x + v : number
|
||||||
>x : number
|
>x : 0
|
||||||
>v : number
|
>v : number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,25 +513,25 @@ function foo2_c(x) {
|
||||||
>1 : 1
|
>1 : 1
|
||||||
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v = x;
|
var v = x;
|
||||||
>v : number
|
>v : number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
(function() { return x + v });
|
(function() { return x + v });
|
||||||
>(function() { return x + v }) : () => number
|
>(function() { return x + v }) : () => number
|
||||||
>function() { return x + v } : () => number
|
>function() { return x + v } : () => number
|
||||||
>x + v : number
|
>x + v : number
|
||||||
>x : number
|
>x : 1
|
||||||
>v : number
|
>v : number
|
||||||
|
|
||||||
(() => x + v);
|
(() => x + v);
|
||||||
>(() => x + v) : () => number
|
>(() => x + v) : () => number
|
||||||
>() => x + v : () => number
|
>() => x + v : () => number
|
||||||
>x + v : number
|
>x + v : number
|
||||||
>x : number
|
>x : 1
|
||||||
>v : number
|
>v : number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -547,8 +547,8 @@ function foo3_c(x) {
|
||||||
|
|
||||||
do {
|
do {
|
||||||
const x = 1;
|
const x = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v;
|
var v;
|
||||||
>v : any
|
>v : any
|
||||||
|
@ -557,14 +557,14 @@ function foo3_c(x) {
|
||||||
>(function() { return x + v }) : () => any
|
>(function() { return x + v }) : () => any
|
||||||
>function() { return x + v } : () => any
|
>function() { return x + v } : () => any
|
||||||
>x + v : any
|
>x + v : any
|
||||||
>x : number
|
>x : 1
|
||||||
>v : any
|
>v : any
|
||||||
|
|
||||||
(() => x + v);
|
(() => x + v);
|
||||||
>(() => x + v) : () => any
|
>(() => x + v) : () => any
|
||||||
>() => x + v : () => any
|
>() => x + v : () => any
|
||||||
>x + v : any
|
>x + v : any
|
||||||
>x : number
|
>x : 1
|
||||||
>v : any
|
>v : any
|
||||||
|
|
||||||
} while (1 === 1);
|
} while (1 === 1);
|
||||||
|
@ -575,7 +575,7 @@ function foo3_c(x) {
|
||||||
use(v);
|
use(v);
|
||||||
>use(v) : any
|
>use(v) : any
|
||||||
>use : (a: any) => any
|
>use : (a: any) => any
|
||||||
>v : any
|
>v : undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
function foo4_c(x) {
|
function foo4_c(x) {
|
||||||
|
@ -583,32 +583,32 @@ function foo4_c(x) {
|
||||||
>x : any
|
>x : any
|
||||||
|
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
>y : number
|
>y : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v = y;
|
var v = y;
|
||||||
>v : number
|
>v : number
|
||||||
>y : number
|
>y : 0
|
||||||
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
(function() { return x + v });
|
(function() { return x + v });
|
||||||
>(function() { return x + v }) : () => number
|
>(function() { return x + v }) : () => number
|
||||||
>function() { return x + v } : () => number
|
>function() { return x + v } : () => number
|
||||||
>x + v : number
|
>x + v : number
|
||||||
>x : number
|
>x : 1
|
||||||
>v : number
|
>v : number
|
||||||
|
|
||||||
(() => x + v);
|
(() => x + v);
|
||||||
>(() => x + v) : () => number
|
>(() => x + v) : () => number
|
||||||
>() => x + v : () => number
|
>() => x + v : () => number
|
||||||
>x + v : number
|
>x + v : number
|
||||||
>x : number
|
>x : 1
|
||||||
>v : number
|
>v : number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -623,25 +623,25 @@ function foo5_c(x) {
|
||||||
>x : any
|
>x : any
|
||||||
|
|
||||||
for (const x = 0, y = 1; x < 1;) {
|
for (const x = 0, y = 1; x < 1;) {
|
||||||
>x : number
|
>x : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y : number
|
>y : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v = x;
|
var v = x;
|
||||||
>v : number
|
>v : number
|
||||||
>x : number
|
>x : 0
|
||||||
|
|
||||||
(function() { return x + y + v });
|
(function() { return x + y + v });
|
||||||
>(function() { return x + y + v }) : () => number
|
>(function() { return x + y + v }) : () => number
|
||||||
>function() { return x + y + v } : () => number
|
>function() { return x + y + v } : () => number
|
||||||
>x + y + v : number
|
>x + y + v : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 0
|
||||||
>y : number
|
>y : 1
|
||||||
>v : number
|
>v : number
|
||||||
|
|
||||||
(() => x + y + v);
|
(() => x + y + v);
|
||||||
|
@ -649,8 +649,8 @@ function foo5_c(x) {
|
||||||
>() => x + y + v : () => number
|
>() => x + y + v : () => number
|
||||||
>x + y + v : number
|
>x + y + v : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 0
|
||||||
>y : number
|
>y : 1
|
||||||
>v : number
|
>v : number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -671,22 +671,22 @@ function foo6_c(x) {
|
||||||
>1 : 1
|
>1 : 1
|
||||||
|
|
||||||
const x = 1, y = 1;
|
const x = 1, y = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v = x;
|
var v = x;
|
||||||
>v : number
|
>v : number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
(function() { return x + y + v });
|
(function() { return x + y + v });
|
||||||
>(function() { return x + y + v }) : () => number
|
>(function() { return x + y + v }) : () => number
|
||||||
>function() { return x + y + v } : () => number
|
>function() { return x + y + v } : () => number
|
||||||
>x + y + v : number
|
>x + y + v : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>v : number
|
>v : number
|
||||||
|
|
||||||
(() => x + y + v);
|
(() => x + y + v);
|
||||||
|
@ -694,8 +694,8 @@ function foo6_c(x) {
|
||||||
>() => x + y + v : () => number
|
>() => x + y + v : () => number
|
||||||
>x + y + v : number
|
>x + y + v : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>v : number
|
>v : number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -711,22 +711,22 @@ function foo7_c(x) {
|
||||||
|
|
||||||
do {
|
do {
|
||||||
const x = 1, y = 1;
|
const x = 1, y = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v = x;
|
var v = x;
|
||||||
>v : number
|
>v : number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
(function() { return x + y + v });
|
(function() { return x + y + v });
|
||||||
>(function() { return x + y + v }) : () => number
|
>(function() { return x + y + v }) : () => number
|
||||||
>function() { return x + y + v } : () => number
|
>function() { return x + y + v } : () => number
|
||||||
>x + y + v : number
|
>x + y + v : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>v : number
|
>v : number
|
||||||
|
|
||||||
(() => x + y + v);
|
(() => x + y + v);
|
||||||
|
@ -734,8 +734,8 @@ function foo7_c(x) {
|
||||||
>() => x + y + v : () => number
|
>() => x + y + v : () => number
|
||||||
>x + y + v : number
|
>x + y + v : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>v : number
|
>v : number
|
||||||
|
|
||||||
} while (1 === 1);
|
} while (1 === 1);
|
||||||
|
@ -755,27 +755,27 @@ function foo8_c(x) {
|
||||||
>x : any
|
>x : any
|
||||||
|
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
>y : number
|
>y : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v = x;
|
var v = x;
|
||||||
>v : number
|
>v : number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
(function() { return x + y + v });
|
(function() { return x + y + v });
|
||||||
>(function() { return x + y + v }) : () => number
|
>(function() { return x + y + v }) : () => number
|
||||||
>function() { return x + y + v } : () => number
|
>function() { return x + y + v } : () => number
|
||||||
>x + y + v : number
|
>x + y + v : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 0
|
||||||
>v : number
|
>v : number
|
||||||
|
|
||||||
(() => x + y + v);
|
(() => x + y + v);
|
||||||
|
@ -783,8 +783,8 @@ function foo8_c(x) {
|
||||||
>() => x + y + v : () => number
|
>() => x + y + v : () => number
|
||||||
>x + y + v : number
|
>x + y + v : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 0
|
||||||
>v : number
|
>v : number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
|
||||||
}
|
|
||||||
|
|
|
@ -17,12 +17,12 @@ export function exportedFoo() {
|
||||||
>v0 : any
|
>v0 : any
|
||||||
>v00 : string
|
>v00 : string
|
||||||
>v1 : number
|
>v1 : number
|
||||||
>v2 : any
|
>v2 : undefined
|
||||||
>v3 : any
|
>v3 : undefined
|
||||||
>v4 : number
|
>v4 : number
|
||||||
>v5 : number
|
>v5 : number
|
||||||
>v6 : any
|
>v6 : undefined
|
||||||
>v7 : any
|
>v7 : undefined
|
||||||
>v8 : number
|
>v8 : number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,10 +70,10 @@ for (let x in []) {
|
||||||
|
|
||||||
for (let x = 0; x < 1; ++x) {
|
for (let x = 0; x < 1; ++x) {
|
||||||
>x : number
|
>x : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++x : number
|
>++x : number
|
||||||
>x : number
|
>x : number
|
||||||
|
|
||||||
|
@ -103,15 +103,15 @@ while (1 === 1) {
|
||||||
>x : any
|
>x : any
|
||||||
|
|
||||||
var v2 = x;
|
var v2 = x;
|
||||||
>v2 : any
|
>v2 : undefined
|
||||||
>x : any
|
>x : undefined
|
||||||
|
|
||||||
(function() { return x + v2});
|
(function() { return x + v2});
|
||||||
>(function() { return x + v2}) : () => any
|
>(function() { return x + v2}) : () => any
|
||||||
>function() { return x + v2} : () => any
|
>function() { return x + v2} : () => any
|
||||||
>x + v2 : any
|
>x + v2 : any
|
||||||
>x : any
|
>x : any
|
||||||
>v2 : any
|
>v2 : undefined
|
||||||
|
|
||||||
(() => x);
|
(() => x);
|
||||||
>(() => x) : () => any
|
>(() => x) : () => any
|
||||||
|
@ -124,15 +124,15 @@ do {
|
||||||
>x : any
|
>x : any
|
||||||
|
|
||||||
var v3 = x;
|
var v3 = x;
|
||||||
>v3 : any
|
>v3 : undefined
|
||||||
>x : any
|
>x : undefined
|
||||||
|
|
||||||
(function() { return x + v3});
|
(function() { return x + v3});
|
||||||
>(function() { return x + v3}) : () => any
|
>(function() { return x + v3}) : () => any
|
||||||
>function() { return x + v3} : () => any
|
>function() { return x + v3} : () => any
|
||||||
>x + v3 : any
|
>x + v3 : any
|
||||||
>x : any
|
>x : any
|
||||||
>v3 : any
|
>v3 : undefined
|
||||||
|
|
||||||
(() => x);
|
(() => x);
|
||||||
>(() => x) : () => any
|
>(() => x) : () => any
|
||||||
|
@ -146,16 +146,16 @@ do {
|
||||||
|
|
||||||
for (let y = 0; y < 1; ++y) {
|
for (let y = 0; y < 1; ++y) {
|
||||||
>y : number
|
>y : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++y : number
|
>++y : number
|
||||||
>y : number
|
>y : number
|
||||||
|
|
||||||
let x = 1;
|
let x = 1;
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v4 = x;
|
var v4 = x;
|
||||||
>v4 : number
|
>v4 : number
|
||||||
|
@ -176,12 +176,12 @@ for (let y = 0; y < 1; ++y) {
|
||||||
|
|
||||||
for (let x = 0, y = 1; x < 1; ++x) {
|
for (let x = 0, y = 1; x < 1; ++x) {
|
||||||
>x : number
|
>x : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y : number
|
>y : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++x : number
|
>++x : number
|
||||||
>x : number
|
>x : number
|
||||||
|
|
||||||
|
@ -216,8 +216,8 @@ while (1 === 1) {
|
||||||
>y : any
|
>y : any
|
||||||
|
|
||||||
var v6 = x;
|
var v6 = x;
|
||||||
>v6 : any
|
>v6 : undefined
|
||||||
>x : any
|
>x : undefined
|
||||||
|
|
||||||
(function() { return x + y + v6});
|
(function() { return x + y + v6});
|
||||||
>(function() { return x + y + v6}) : () => any
|
>(function() { return x + y + v6}) : () => any
|
||||||
|
@ -226,7 +226,7 @@ while (1 === 1) {
|
||||||
>x + y : any
|
>x + y : any
|
||||||
>x : any
|
>x : any
|
||||||
>y : any
|
>y : any
|
||||||
>v6 : any
|
>v6 : undefined
|
||||||
|
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
>(() => x + y) : () => any
|
>(() => x + y) : () => any
|
||||||
|
@ -242,8 +242,8 @@ do {
|
||||||
>y : any
|
>y : any
|
||||||
|
|
||||||
var v7 = x;
|
var v7 = x;
|
||||||
>v7 : any
|
>v7 : undefined
|
||||||
>x : any
|
>x : undefined
|
||||||
|
|
||||||
(function() { return x + y + v7});
|
(function() { return x + y + v7});
|
||||||
>(function() { return x + y + v7}) : () => any
|
>(function() { return x + y + v7}) : () => any
|
||||||
|
@ -252,7 +252,7 @@ do {
|
||||||
>x + y : any
|
>x + y : any
|
||||||
>x : any
|
>x : any
|
||||||
>y : any
|
>y : any
|
||||||
>v7 : any
|
>v7 : undefined
|
||||||
|
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
>(() => x + y) : () => any
|
>(() => x + y) : () => any
|
||||||
|
@ -268,16 +268,16 @@ do {
|
||||||
|
|
||||||
for (let y = 0; y < 1; ++y) {
|
for (let y = 0; y < 1; ++y) {
|
||||||
>y : number
|
>y : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++y : number
|
>++y : number
|
||||||
>y : number
|
>y : number
|
||||||
|
|
||||||
let x = 1;
|
let x = 1;
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v8 = x;
|
var v8 = x;
|
||||||
>v8 : number
|
>v8 : number
|
||||||
|
@ -369,27 +369,27 @@ for (const x in []) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const x = 0; x < 1;) {
|
for (const x = 0; x < 1;) {
|
||||||
>x : number
|
>x : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v1_c = x;
|
var v1_c = x;
|
||||||
>v1_c : number
|
>v1_c : number
|
||||||
>x : number
|
>x : 0
|
||||||
|
|
||||||
(function() { return x + v1_c});
|
(function() { return x + v1_c});
|
||||||
>(function() { return x + v1_c}) : () => number
|
>(function() { return x + v1_c}) : () => number
|
||||||
>function() { return x + v1_c} : () => number
|
>function() { return x + v1_c} : () => number
|
||||||
>x + v1_c : number
|
>x + v1_c : number
|
||||||
>x : number
|
>x : 0
|
||||||
>v1_c : number
|
>v1_c : number
|
||||||
|
|
||||||
(() => x);
|
(() => x);
|
||||||
>(() => x) : () => number
|
>(() => x) : () => number
|
||||||
>() => x : () => number
|
>() => x : () => number
|
||||||
>x : number
|
>x : 0
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1 === 1) {
|
while (1 === 1) {
|
||||||
|
@ -398,46 +398,46 @@ while (1 === 1) {
|
||||||
>1 : 1
|
>1 : 1
|
||||||
|
|
||||||
const x =1;
|
const x =1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v2_c = x;
|
var v2_c = x;
|
||||||
>v2_c : number
|
>v2_c : number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
(function() { return x + v2_c});
|
(function() { return x + v2_c});
|
||||||
>(function() { return x + v2_c}) : () => number
|
>(function() { return x + v2_c}) : () => number
|
||||||
>function() { return x + v2_c} : () => number
|
>function() { return x + v2_c} : () => number
|
||||||
>x + v2_c : number
|
>x + v2_c : number
|
||||||
>x : number
|
>x : 1
|
||||||
>v2_c : number
|
>v2_c : number
|
||||||
|
|
||||||
(() => x);
|
(() => x);
|
||||||
>(() => x) : () => number
|
>(() => x) : () => number
|
||||||
>() => x : () => number
|
>() => x : () => number
|
||||||
>x : number
|
>x : 1
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
const x = 1;
|
const x = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v3_c = x;
|
var v3_c = x;
|
||||||
>v3_c : number
|
>v3_c : number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
(function() { return x + v3_c});
|
(function() { return x + v3_c});
|
||||||
>(function() { return x + v3_c}) : () => number
|
>(function() { return x + v3_c}) : () => number
|
||||||
>function() { return x + v3_c} : () => number
|
>function() { return x + v3_c} : () => number
|
||||||
>x + v3_c : number
|
>x + v3_c : number
|
||||||
>x : number
|
>x : 1
|
||||||
>v3_c : number
|
>v3_c : number
|
||||||
|
|
||||||
(() => x);
|
(() => x);
|
||||||
>(() => x) : () => number
|
>(() => x) : () => number
|
||||||
>() => x : () => number
|
>() => x : () => number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
} while (1 === 1)
|
} while (1 === 1)
|
||||||
>1 === 1 : boolean
|
>1 === 1 : boolean
|
||||||
|
@ -445,61 +445,61 @@ do {
|
||||||
>1 : 1
|
>1 : 1
|
||||||
|
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
>y : number
|
>y : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v4_c = x;
|
var v4_c = x;
|
||||||
>v4_c : number
|
>v4_c : number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
(function() { return x + v4_c});
|
(function() { return x + v4_c});
|
||||||
>(function() { return x + v4_c}) : () => number
|
>(function() { return x + v4_c}) : () => number
|
||||||
>function() { return x + v4_c} : () => number
|
>function() { return x + v4_c} : () => number
|
||||||
>x + v4_c : number
|
>x + v4_c : number
|
||||||
>x : number
|
>x : 1
|
||||||
>v4_c : number
|
>v4_c : number
|
||||||
|
|
||||||
(() => x);
|
(() => x);
|
||||||
>(() => x) : () => number
|
>(() => x) : () => number
|
||||||
>() => x : () => number
|
>() => x : () => number
|
||||||
>x : number
|
>x : 1
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const x = 0, y = 1; x < 1;) {
|
for (const x = 0, y = 1; x < 1;) {
|
||||||
>x : number
|
>x : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y : number
|
>y : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v5_c = x;
|
var v5_c = x;
|
||||||
>v5_c : number
|
>v5_c : number
|
||||||
>x : number
|
>x : 0
|
||||||
|
|
||||||
(function() { return x + y + v5_c});
|
(function() { return x + y + v5_c});
|
||||||
>(function() { return x + y + v5_c}) : () => number
|
>(function() { return x + y + v5_c}) : () => number
|
||||||
>function() { return x + y + v5_c} : () => number
|
>function() { return x + y + v5_c} : () => number
|
||||||
>x + y + v5_c : number
|
>x + y + v5_c : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 0
|
||||||
>y : number
|
>y : 1
|
||||||
>v5_c : number
|
>v5_c : number
|
||||||
|
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
>(() => x + y) : () => number
|
>(() => x + y) : () => number
|
||||||
>() => x + y : () => number
|
>() => x + y : () => number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 0
|
||||||
>y : number
|
>y : 1
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1 === 1) {
|
while (1 === 1) {
|
||||||
|
@ -508,58 +508,58 @@ while (1 === 1) {
|
||||||
>1 : 1
|
>1 : 1
|
||||||
|
|
||||||
const x = 1, y = 1;
|
const x = 1, y = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v6_c = x;
|
var v6_c = x;
|
||||||
>v6_c : number
|
>v6_c : number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
(function() { return x + y + v6_c});
|
(function() { return x + y + v6_c});
|
||||||
>(function() { return x + y + v6_c}) : () => number
|
>(function() { return x + y + v6_c}) : () => number
|
||||||
>function() { return x + y + v6_c} : () => number
|
>function() { return x + y + v6_c} : () => number
|
||||||
>x + y + v6_c : number
|
>x + y + v6_c : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>v6_c : number
|
>v6_c : number
|
||||||
|
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
>(() => x + y) : () => number
|
>(() => x + y) : () => number
|
||||||
>() => x + y : () => number
|
>() => x + y : () => number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
const x = 1, y = 1;
|
const x = 1, y = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v7_c = x;
|
var v7_c = x;
|
||||||
>v7_c : number
|
>v7_c : number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
(function() { return x + y + v7_c});
|
(function() { return x + y + v7_c});
|
||||||
>(function() { return x + y + v7_c}) : () => number
|
>(function() { return x + y + v7_c}) : () => number
|
||||||
>function() { return x + y + v7_c} : () => number
|
>function() { return x + y + v7_c} : () => number
|
||||||
>x + y + v7_c : number
|
>x + y + v7_c : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>v7_c : number
|
>v7_c : number
|
||||||
|
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
>(() => x + y) : () => number
|
>(() => x + y) : () => number
|
||||||
>() => x + y : () => number
|
>() => x + y : () => number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
|
|
||||||
} while (1 === 1)
|
} while (1 === 1)
|
||||||
>1 === 1 : boolean
|
>1 === 1 : boolean
|
||||||
|
@ -567,34 +567,34 @@ do {
|
||||||
>1 : 1
|
>1 : 1
|
||||||
|
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
>y : number
|
>y : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v8_c = x;
|
var v8_c = x;
|
||||||
>v8_c : number
|
>v8_c : number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
(function() { return x + y + v8_c});
|
(function() { return x + y + v8_c});
|
||||||
>(function() { return x + y + v8_c}) : () => number
|
>(function() { return x + y + v8_c}) : () => number
|
||||||
>function() { return x + y + v8_c} : () => number
|
>function() { return x + y + v8_c} : () => number
|
||||||
>x + y + v8_c : number
|
>x + y + v8_c : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 0
|
||||||
>v8_c : number
|
>v8_c : number
|
||||||
|
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
>(() => x + y) : () => number
|
>(() => x + y) : () => number
|
||||||
>() => x + y : () => number
|
>() => x + y : () => number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
|
||||||
}
|
|
||||||
|
|
|
@ -17,12 +17,12 @@ export function exportedFoo() {
|
||||||
>v0 : any
|
>v0 : any
|
||||||
>v00 : string
|
>v00 : string
|
||||||
>v1 : number
|
>v1 : number
|
||||||
>v2 : any
|
>v2 : undefined
|
||||||
>v3 : any
|
>v3 : undefined
|
||||||
>v4 : number
|
>v4 : number
|
||||||
>v5 : number
|
>v5 : number
|
||||||
>v6 : any
|
>v6 : undefined
|
||||||
>v7 : any
|
>v7 : undefined
|
||||||
>v8 : number
|
>v8 : number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,10 +70,10 @@ for (let x in []) {
|
||||||
|
|
||||||
for (let x = 0; x < 1; ++x) {
|
for (let x = 0; x < 1; ++x) {
|
||||||
>x : number
|
>x : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++x : number
|
>++x : number
|
||||||
>x : number
|
>x : number
|
||||||
|
|
||||||
|
@ -103,15 +103,15 @@ while (1 === 1) {
|
||||||
>x : any
|
>x : any
|
||||||
|
|
||||||
var v2 = x;
|
var v2 = x;
|
||||||
>v2 : any
|
>v2 : undefined
|
||||||
>x : any
|
>x : undefined
|
||||||
|
|
||||||
(function() { return x + v2});
|
(function() { return x + v2});
|
||||||
>(function() { return x + v2}) : () => any
|
>(function() { return x + v2}) : () => any
|
||||||
>function() { return x + v2} : () => any
|
>function() { return x + v2} : () => any
|
||||||
>x + v2 : any
|
>x + v2 : any
|
||||||
>x : any
|
>x : any
|
||||||
>v2 : any
|
>v2 : undefined
|
||||||
|
|
||||||
(() => x);
|
(() => x);
|
||||||
>(() => x) : () => any
|
>(() => x) : () => any
|
||||||
|
@ -124,15 +124,15 @@ do {
|
||||||
>x : any
|
>x : any
|
||||||
|
|
||||||
var v3 = x;
|
var v3 = x;
|
||||||
>v3 : any
|
>v3 : undefined
|
||||||
>x : any
|
>x : undefined
|
||||||
|
|
||||||
(function() { return x + v3});
|
(function() { return x + v3});
|
||||||
>(function() { return x + v3}) : () => any
|
>(function() { return x + v3}) : () => any
|
||||||
>function() { return x + v3} : () => any
|
>function() { return x + v3} : () => any
|
||||||
>x + v3 : any
|
>x + v3 : any
|
||||||
>x : any
|
>x : any
|
||||||
>v3 : any
|
>v3 : undefined
|
||||||
|
|
||||||
(() => x);
|
(() => x);
|
||||||
>(() => x) : () => any
|
>(() => x) : () => any
|
||||||
|
@ -146,16 +146,16 @@ do {
|
||||||
|
|
||||||
for (let y = 0; y < 1; ++y) {
|
for (let y = 0; y < 1; ++y) {
|
||||||
>y : number
|
>y : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++y : number
|
>++y : number
|
||||||
>y : number
|
>y : number
|
||||||
|
|
||||||
let x = 1;
|
let x = 1;
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v4 = x;
|
var v4 = x;
|
||||||
>v4 : number
|
>v4 : number
|
||||||
|
@ -176,12 +176,12 @@ for (let y = 0; y < 1; ++y) {
|
||||||
|
|
||||||
for (let x = 0, y = 1; x < 1; ++x) {
|
for (let x = 0, y = 1; x < 1; ++x) {
|
||||||
>x : number
|
>x : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y : number
|
>y : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++x : number
|
>++x : number
|
||||||
>x : number
|
>x : number
|
||||||
|
|
||||||
|
@ -216,8 +216,8 @@ while (1 === 1) {
|
||||||
>y : any
|
>y : any
|
||||||
|
|
||||||
var v6 = x;
|
var v6 = x;
|
||||||
>v6 : any
|
>v6 : undefined
|
||||||
>x : any
|
>x : undefined
|
||||||
|
|
||||||
(function() { return x + y + v6});
|
(function() { return x + y + v6});
|
||||||
>(function() { return x + y + v6}) : () => any
|
>(function() { return x + y + v6}) : () => any
|
||||||
|
@ -226,7 +226,7 @@ while (1 === 1) {
|
||||||
>x + y : any
|
>x + y : any
|
||||||
>x : any
|
>x : any
|
||||||
>y : any
|
>y : any
|
||||||
>v6 : any
|
>v6 : undefined
|
||||||
|
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
>(() => x + y) : () => any
|
>(() => x + y) : () => any
|
||||||
|
@ -242,8 +242,8 @@ do {
|
||||||
>y : any
|
>y : any
|
||||||
|
|
||||||
var v7 = x;
|
var v7 = x;
|
||||||
>v7 : any
|
>v7 : undefined
|
||||||
>x : any
|
>x : undefined
|
||||||
|
|
||||||
(function() { return x + y + v7});
|
(function() { return x + y + v7});
|
||||||
>(function() { return x + y + v7}) : () => any
|
>(function() { return x + y + v7}) : () => any
|
||||||
|
@ -252,7 +252,7 @@ do {
|
||||||
>x + y : any
|
>x + y : any
|
||||||
>x : any
|
>x : any
|
||||||
>y : any
|
>y : any
|
||||||
>v7 : any
|
>v7 : undefined
|
||||||
|
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
>(() => x + y) : () => any
|
>(() => x + y) : () => any
|
||||||
|
@ -268,16 +268,16 @@ do {
|
||||||
|
|
||||||
for (let y = 0; y < 1; ++y) {
|
for (let y = 0; y < 1; ++y) {
|
||||||
>y : number
|
>y : number
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
>++y : number
|
>++y : number
|
||||||
>y : number
|
>y : number
|
||||||
|
|
||||||
let x = 1;
|
let x = 1;
|
||||||
>x : number
|
>x : number
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v8 = x;
|
var v8 = x;
|
||||||
>v8 : number
|
>v8 : number
|
||||||
|
@ -369,27 +369,27 @@ for (const x in []) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const x = 0; x < 1;) {
|
for (const x = 0; x < 1;) {
|
||||||
>x : number
|
>x : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v1_c = x;
|
var v1_c = x;
|
||||||
>v1_c : number
|
>v1_c : number
|
||||||
>x : number
|
>x : 0
|
||||||
|
|
||||||
(function() { return x + v1_c});
|
(function() { return x + v1_c});
|
||||||
>(function() { return x + v1_c}) : () => number
|
>(function() { return x + v1_c}) : () => number
|
||||||
>function() { return x + v1_c} : () => number
|
>function() { return x + v1_c} : () => number
|
||||||
>x + v1_c : number
|
>x + v1_c : number
|
||||||
>x : number
|
>x : 0
|
||||||
>v1_c : number
|
>v1_c : number
|
||||||
|
|
||||||
(() => x);
|
(() => x);
|
||||||
>(() => x) : () => number
|
>(() => x) : () => number
|
||||||
>() => x : () => number
|
>() => x : () => number
|
||||||
>x : number
|
>x : 0
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1 === 1) {
|
while (1 === 1) {
|
||||||
|
@ -398,46 +398,46 @@ while (1 === 1) {
|
||||||
>1 : 1
|
>1 : 1
|
||||||
|
|
||||||
const x =1;
|
const x =1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v2_c = x;
|
var v2_c = x;
|
||||||
>v2_c : number
|
>v2_c : number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
(function() { return x + v2_c});
|
(function() { return x + v2_c});
|
||||||
>(function() { return x + v2_c}) : () => number
|
>(function() { return x + v2_c}) : () => number
|
||||||
>function() { return x + v2_c} : () => number
|
>function() { return x + v2_c} : () => number
|
||||||
>x + v2_c : number
|
>x + v2_c : number
|
||||||
>x : number
|
>x : 1
|
||||||
>v2_c : number
|
>v2_c : number
|
||||||
|
|
||||||
(() => x);
|
(() => x);
|
||||||
>(() => x) : () => number
|
>(() => x) : () => number
|
||||||
>() => x : () => number
|
>() => x : () => number
|
||||||
>x : number
|
>x : 1
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
const x = 1;
|
const x = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v3_c = x;
|
var v3_c = x;
|
||||||
>v3_c : number
|
>v3_c : number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
(function() { return x + v3_c});
|
(function() { return x + v3_c});
|
||||||
>(function() { return x + v3_c}) : () => number
|
>(function() { return x + v3_c}) : () => number
|
||||||
>function() { return x + v3_c} : () => number
|
>function() { return x + v3_c} : () => number
|
||||||
>x + v3_c : number
|
>x + v3_c : number
|
||||||
>x : number
|
>x : 1
|
||||||
>v3_c : number
|
>v3_c : number
|
||||||
|
|
||||||
(() => x);
|
(() => x);
|
||||||
>(() => x) : () => number
|
>(() => x) : () => number
|
||||||
>() => x : () => number
|
>() => x : () => number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
} while (1 === 1)
|
} while (1 === 1)
|
||||||
>1 === 1 : boolean
|
>1 === 1 : boolean
|
||||||
|
@ -445,61 +445,61 @@ do {
|
||||||
>1 : 1
|
>1 : 1
|
||||||
|
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
>y : number
|
>y : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v4_c = x;
|
var v4_c = x;
|
||||||
>v4_c : number
|
>v4_c : number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
(function() { return x + v4_c});
|
(function() { return x + v4_c});
|
||||||
>(function() { return x + v4_c}) : () => number
|
>(function() { return x + v4_c}) : () => number
|
||||||
>function() { return x + v4_c} : () => number
|
>function() { return x + v4_c} : () => number
|
||||||
>x + v4_c : number
|
>x + v4_c : number
|
||||||
>x : number
|
>x : 1
|
||||||
>v4_c : number
|
>v4_c : number
|
||||||
|
|
||||||
(() => x);
|
(() => x);
|
||||||
>(() => x) : () => number
|
>(() => x) : () => number
|
||||||
>() => x : () => number
|
>() => x : () => number
|
||||||
>x : number
|
>x : 1
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const x = 0, y = 1; x < 1;) {
|
for (const x = 0, y = 1; x < 1;) {
|
||||||
>x : number
|
>x : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y : number
|
>y : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
>x < 1 : boolean
|
>x < 1 : boolean
|
||||||
>x : number
|
>x : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v5_c = x;
|
var v5_c = x;
|
||||||
>v5_c : number
|
>v5_c : number
|
||||||
>x : number
|
>x : 0
|
||||||
|
|
||||||
(function() { return x + y + v5_c});
|
(function() { return x + y + v5_c});
|
||||||
>(function() { return x + y + v5_c}) : () => number
|
>(function() { return x + y + v5_c}) : () => number
|
||||||
>function() { return x + y + v5_c} : () => number
|
>function() { return x + y + v5_c} : () => number
|
||||||
>x + y + v5_c : number
|
>x + y + v5_c : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 0
|
||||||
>y : number
|
>y : 1
|
||||||
>v5_c : number
|
>v5_c : number
|
||||||
|
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
>(() => x + y) : () => number
|
>(() => x + y) : () => number
|
||||||
>() => x + y : () => number
|
>() => x + y : () => number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 0
|
||||||
>y : number
|
>y : 1
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1 === 1) {
|
while (1 === 1) {
|
||||||
|
@ -508,58 +508,58 @@ while (1 === 1) {
|
||||||
>1 : 1
|
>1 : 1
|
||||||
|
|
||||||
const x = 1, y = 1;
|
const x = 1, y = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v6_c = x;
|
var v6_c = x;
|
||||||
>v6_c : number
|
>v6_c : number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
(function() { return x + y + v6_c});
|
(function() { return x + y + v6_c});
|
||||||
>(function() { return x + y + v6_c}) : () => number
|
>(function() { return x + y + v6_c}) : () => number
|
||||||
>function() { return x + y + v6_c} : () => number
|
>function() { return x + y + v6_c} : () => number
|
||||||
>x + y + v6_c : number
|
>x + y + v6_c : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>v6_c : number
|
>v6_c : number
|
||||||
|
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
>(() => x + y) : () => number
|
>(() => x + y) : () => number
|
||||||
>() => x + y : () => number
|
>() => x + y : () => number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
const x = 1, y = 1;
|
const x = 1, y = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v7_c = x;
|
var v7_c = x;
|
||||||
>v7_c : number
|
>v7_c : number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
(function() { return x + y + v7_c});
|
(function() { return x + y + v7_c});
|
||||||
>(function() { return x + y + v7_c}) : () => number
|
>(function() { return x + y + v7_c}) : () => number
|
||||||
>function() { return x + y + v7_c} : () => number
|
>function() { return x + y + v7_c} : () => number
|
||||||
>x + y + v7_c : number
|
>x + y + v7_c : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
>v7_c : number
|
>v7_c : number
|
||||||
|
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
>(() => x + y) : () => number
|
>(() => x + y) : () => number
|
||||||
>() => x + y : () => number
|
>() => x + y : () => number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 1
|
||||||
|
|
||||||
} while (1 === 1)
|
} while (1 === 1)
|
||||||
>1 === 1 : boolean
|
>1 === 1 : boolean
|
||||||
|
@ -567,34 +567,34 @@ do {
|
||||||
>1 : 1
|
>1 : 1
|
||||||
|
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
>y : number
|
>y : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>y < 1 : boolean
|
>y < 1 : boolean
|
||||||
>y : number
|
>y : 0
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
>x : number
|
>x : 1
|
||||||
>1 : number
|
>1 : 1
|
||||||
|
|
||||||
var v8_c = x;
|
var v8_c = x;
|
||||||
>v8_c : number
|
>v8_c : number
|
||||||
>x : number
|
>x : 1
|
||||||
|
|
||||||
(function() { return x + y + v8_c});
|
(function() { return x + y + v8_c});
|
||||||
>(function() { return x + y + v8_c}) : () => number
|
>(function() { return x + y + v8_c}) : () => number
|
||||||
>function() { return x + y + v8_c} : () => number
|
>function() { return x + y + v8_c} : () => number
|
||||||
>x + y + v8_c : number
|
>x + y + v8_c : number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 0
|
||||||
>v8_c : number
|
>v8_c : number
|
||||||
|
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
>(() => x + y) : () => number
|
>(() => x + y) : () => number
|
||||||
>() => x + y : () => number
|
>() => x + y : () => number
|
||||||
>x + y : number
|
>x + y : number
|
||||||
>x : number
|
>x : 1
|
||||||
>y : number
|
>y : 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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(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(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);
|
declare function use(a: any);
|
||||||
|
|
||||||
//====let
|
//====let
|
||||||
|
@ -177,8 +173,6 @@ tests/cases/compiler/capturedLetConstInLoop5.ts(268,23): error TS2365: Operator
|
||||||
|
|
||||||
function foo1_c(x) {
|
function foo1_c(x) {
|
||||||
for (const x = 0; x < 1;) {
|
for (const x = 0; x < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
var v = x;
|
var v = x;
|
||||||
(function() { return x + v });
|
(function() { return x + v });
|
||||||
(() => x + v);
|
(() => x + v);
|
||||||
|
@ -222,8 +216,6 @@ tests/cases/compiler/capturedLetConstInLoop5.ts(268,23): error TS2365: Operator
|
||||||
|
|
||||||
function foo4_c(x) {
|
function foo4_c(x) {
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
var v = y;
|
var v = y;
|
||||||
let x = 1;
|
let x = 1;
|
||||||
(function() { return x + v });
|
(function() { return x + v });
|
||||||
|
@ -238,8 +230,6 @@ tests/cases/compiler/capturedLetConstInLoop5.ts(268,23): error TS2365: Operator
|
||||||
|
|
||||||
function foo5_c(x) {
|
function foo5_c(x) {
|
||||||
for (const x = 0, y = 1; x < 1;) {
|
for (const x = 0, y = 1; x < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
var v = x;
|
var v = x;
|
||||||
(function() { return x + y + v });
|
(function() { return x + y + v });
|
||||||
(() => x + y + v);
|
(() => x + y + v);
|
||||||
|
@ -285,8 +275,6 @@ tests/cases/compiler/capturedLetConstInLoop5.ts(268,23): error TS2365: Operator
|
||||||
|
|
||||||
function foo8_c(x) {
|
function foo8_c(x) {
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
var v = x;
|
var v = x;
|
||||||
(function() { return x + y + v });
|
(function() { return x + y + v });
|
||||||
|
|
|
@ -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(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(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);
|
declare function use(a: any);
|
||||||
|
|
||||||
|
@ -178,8 +174,6 @@ tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(269,23): error TS2365: Opera
|
||||||
|
|
||||||
function foo1_c(x) {
|
function foo1_c(x) {
|
||||||
for (const x = 0; x < 1;) {
|
for (const x = 0; x < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
var v = x;
|
var v = x;
|
||||||
(function() { return x + v });
|
(function() { return x + v });
|
||||||
(() => x + v);
|
(() => x + v);
|
||||||
|
@ -223,8 +217,6 @@ tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(269,23): error TS2365: Opera
|
||||||
|
|
||||||
function foo4_c(x) {
|
function foo4_c(x) {
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
var v = y;
|
var v = y;
|
||||||
let x = 1;
|
let x = 1;
|
||||||
(function() { return x + v });
|
(function() { return x + v });
|
||||||
|
@ -239,8 +231,6 @@ tests/cases/compiler/capturedLetConstInLoop5_ES6.ts(269,23): error TS2365: Opera
|
||||||
|
|
||||||
function foo5_c(x) {
|
function foo5_c(x) {
|
||||||
for (const x = 0, y = 1; x < 1;) {
|
for (const x = 0, y = 1; x < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
var v = x;
|
var v = x;
|
||||||
(function() { return x + y + v });
|
(function() { return x + y + v });
|
||||||
(() => 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) {
|
function foo8_c(x) {
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
var v = x;
|
var v = x;
|
||||||
(function() { return x + y + v });
|
(function() { return x + y + v });
|
||||||
|
|
|
@ -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(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(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(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(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
|
// ====let
|
||||||
for (let x of []) {
|
for (let x of []) {
|
||||||
(function() { return x});
|
(function() { return x});
|
||||||
|
@ -153,8 +149,6 @@ tests/cases/compiler/capturedLetConstInLoop6.ts(226,19): error TS2365: Operator
|
||||||
|
|
||||||
|
|
||||||
for (const x = 0; x < 1;) {
|
for (const x = 0; x < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
(function() { return x});
|
(function() { return x});
|
||||||
(() => x);
|
(() => x);
|
||||||
if (x == 1) {
|
if (x == 1) {
|
||||||
|
@ -194,8 +188,6 @@ tests/cases/compiler/capturedLetConstInLoop6.ts(226,19): error TS2365: Operator
|
||||||
} while (1 === 1)
|
} while (1 === 1)
|
||||||
|
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
(function() { return x});
|
(function() { return x});
|
||||||
(() => x);
|
(() => x);
|
||||||
|
@ -208,8 +200,6 @@ tests/cases/compiler/capturedLetConstInLoop6.ts(226,19): error TS2365: Operator
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const x = 0, y = 1; x < 1;) {
|
for (const x = 0, y = 1; x < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
(function() { return x + y});
|
(function() { return x + y});
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
if (x == 1) {
|
if (x == 1) {
|
||||||
|
@ -249,8 +239,6 @@ tests/cases/compiler/capturedLetConstInLoop6.ts(226,19): error TS2365: Operator
|
||||||
} while (1 === 1)
|
} while (1 === 1)
|
||||||
|
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
(function() { return x + y});
|
(function() { return x + y});
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
|
|
|
@ -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(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(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(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(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
|
// ====let
|
||||||
for (let x of []) {
|
for (let x of []) {
|
||||||
(function() { return x});
|
(function() { return x});
|
||||||
|
@ -153,8 +149,6 @@ tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(226,19): error TS2365: Opera
|
||||||
|
|
||||||
|
|
||||||
for (const x = 0; x < 1;) {
|
for (const x = 0; x < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
(function() { return x});
|
(function() { return x});
|
||||||
(() => x);
|
(() => x);
|
||||||
if (x == 1) {
|
if (x == 1) {
|
||||||
|
@ -194,8 +188,6 @@ tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(226,19): error TS2365: Opera
|
||||||
} while (1 === 1)
|
} while (1 === 1)
|
||||||
|
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
(function() { return x});
|
(function() { return x});
|
||||||
(() => 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;) {
|
for (const x = 0, y = 1; x < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
(function() { return x + y});
|
(function() { return x + y});
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
if (x == 1) {
|
if (x == 1) {
|
||||||
|
@ -249,8 +239,6 @@ tests/cases/compiler/capturedLetConstInLoop6_ES6.ts(226,19): error TS2365: Opera
|
||||||
} while (1 === 1)
|
} while (1 === 1)
|
||||||
|
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
(function() { return x + y});
|
(function() { return x + y});
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
|
|
|
@ -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(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(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(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(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(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(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(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(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
|
//===let
|
||||||
l0:
|
l0:
|
||||||
for (let x of []) {
|
for (let x of []) {
|
||||||
|
@ -240,8 +236,6 @@ tests/cases/compiler/capturedLetConstInLoop7.ts(359,19): error TS2365: Operator
|
||||||
|
|
||||||
l1_c:
|
l1_c:
|
||||||
for (const x = 0; x < 1;) {
|
for (const x = 0; x < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
(function() { return x});
|
(function() { return x});
|
||||||
(() => x);
|
(() => x);
|
||||||
if (x == 1) {
|
if (x == 1) {
|
||||||
|
@ -306,8 +300,6 @@ tests/cases/compiler/capturedLetConstInLoop7.ts(359,19): error TS2365: Operator
|
||||||
|
|
||||||
l4_c:
|
l4_c:
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
(function() { return x});
|
(function() { return x});
|
||||||
(() => x);
|
(() => x);
|
||||||
|
@ -327,8 +319,6 @@ tests/cases/compiler/capturedLetConstInLoop7.ts(359,19): error TS2365: Operator
|
||||||
|
|
||||||
l5_c:
|
l5_c:
|
||||||
for (const x = 0, y = 1; x < 1;) {
|
for (const x = 0, y = 1; x < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
(function() { return x + y});
|
(function() { return x + y});
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
if (x == 1) {
|
if (x == 1) {
|
||||||
|
@ -394,8 +384,6 @@ tests/cases/compiler/capturedLetConstInLoop7.ts(359,19): error TS2365: Operator
|
||||||
|
|
||||||
l8_c:
|
l8_c:
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
(function() { return x + y});
|
(function() { return x + y});
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
|
|
|
@ -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(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(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(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(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(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(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(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(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
|
//===let
|
||||||
l0:
|
l0:
|
||||||
for (let x of []) {
|
for (let x of []) {
|
||||||
|
@ -240,8 +236,6 @@ tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(359,19): error TS2365: Opera
|
||||||
|
|
||||||
l1_c:
|
l1_c:
|
||||||
for (const x = 0; x < 1;) {
|
for (const x = 0; x < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
(function() { return x});
|
(function() { return x});
|
||||||
(() => x);
|
(() => x);
|
||||||
if (x == 1) {
|
if (x == 1) {
|
||||||
|
@ -306,8 +300,6 @@ tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(359,19): error TS2365: Opera
|
||||||
|
|
||||||
l4_c:
|
l4_c:
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
(function() { return x});
|
(function() { return x});
|
||||||
(() => x);
|
(() => x);
|
||||||
|
@ -327,8 +319,6 @@ tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(359,19): error TS2365: Opera
|
||||||
|
|
||||||
l5_c:
|
l5_c:
|
||||||
for (const x = 0, y = 1; x < 1;) {
|
for (const x = 0, y = 1; x < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
(function() { return x + y});
|
(function() { return x + y});
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
if (x == 1) {
|
if (x == 1) {
|
||||||
|
@ -394,8 +384,6 @@ tests/cases/compiler/capturedLetConstInLoop7_ES6.ts(359,19): error TS2365: Opera
|
||||||
|
|
||||||
l8_c:
|
l8_c:
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
const x = 1;
|
const x = 1;
|
||||||
(function() { return x + y});
|
(function() { return x + y});
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
|
|
|
@ -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(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(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'.
|
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(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() {
|
function foo() {
|
||||||
l0:
|
l0:
|
||||||
for (let z = 0; z < 1; ++z) {
|
for (let z = 0; z < 1; ++z) {
|
||||||
|
@ -86,16 +83,10 @@ tests/cases/compiler/capturedLetConstInLoop8.ts(120,17): error TS2365: Operator
|
||||||
function foo_c() {
|
function foo_c() {
|
||||||
l0:
|
l0:
|
||||||
for (const z = 0; z < 1;) {
|
for (const z = 0; z < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
l1:
|
l1:
|
||||||
for (const x = 0; x < 1;) {
|
for (const x = 0; x < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
ll1:
|
ll1:
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
(function() { return x + y });
|
(function() { return x + y });
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
if (y == 1) {
|
if (y == 1) {
|
||||||
|
|
|
@ -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(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(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'.
|
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(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() {
|
function foo() {
|
||||||
l0:
|
l0:
|
||||||
for (let z = 0; z < 1; ++z) {
|
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() {
|
function foo_c() {
|
||||||
l0:
|
l0:
|
||||||
for (const z = 0; z < 1;) {
|
for (const z = 0; z < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
l1:
|
l1:
|
||||||
for (const x = 0; x < 1;) {
|
for (const x = 0; x < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
ll1:
|
ll1:
|
||||||
for (const y = 0; y < 1;) {
|
for (const y = 0; y < 1;) {
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
||||||
(function() { return x + y });
|
(function() { return x + y });
|
||||||
(() => x + y);
|
(() => x + y);
|
||||||
if (y == 1) {
|
if (y == 1) {
|
||||||
|
|
|
@ -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 > <number>0;
|
|
||||||
x > <BrandedNum>0;
|
|
||||||
|
|
||||||
// operator <
|
|
||||||
x < 0;
|
|
||||||
~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types 'BrandedNum' and '0'.
|
|
||||||
x < <number>0;
|
|
||||||
x < <BrandedNum>0;
|
|
||||||
|
|
||||||
// operator >=
|
|
||||||
x >= 0;
|
|
||||||
~~~~~~
|
|
||||||
!!! error TS2365: Operator '>=' cannot be applied to types 'BrandedNum' and '0'.
|
|
||||||
x >= <number>0;
|
|
||||||
x >= <BrandedNum>0;
|
|
||||||
|
|
||||||
// operator <=
|
|
||||||
x <= 0;
|
|
||||||
~~~~~~
|
|
||||||
!!! error TS2365: Operator '<=' cannot be applied to types 'BrandedNum' and '0'.
|
|
||||||
x <= <number>0;
|
|
||||||
x <= <BrandedNum>0;
|
|
||||||
|
|
||||||
// operator ==
|
|
||||||
x == 0;
|
|
||||||
x == <number>0;
|
|
||||||
x == <BrandedNum>0;
|
|
||||||
|
|
||||||
// operator !=
|
|
||||||
x != 0;
|
|
||||||
x != <number>0;
|
|
||||||
x != <BrandedNum>0;
|
|
||||||
|
|
||||||
// operator ===
|
|
||||||
x === 0;
|
|
||||||
x === <number>0;
|
|
||||||
x === <BrandedNum>0;
|
|
||||||
|
|
||||||
// operator !==
|
|
||||||
x !== 0;
|
|
||||||
x !== <number>0;
|
|
||||||
x !== <BrandedNum>0;
|
|
||||||
|
|
|
@ -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 > <number>0;
|
||||||
|
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||||
|
|
||||||
|
x > <BrandedNum>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 < <number>0;
|
||||||
|
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||||
|
|
||||||
|
x < <BrandedNum>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 >= <number>0;
|
||||||
|
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||||
|
|
||||||
|
x >= <BrandedNum>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 <= <number>0;
|
||||||
|
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||||
|
|
||||||
|
x <= <BrandedNum>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 == <number>0;
|
||||||
|
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||||
|
|
||||||
|
x == <BrandedNum>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 != <number>0;
|
||||||
|
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||||
|
|
||||||
|
x != <BrandedNum>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 === <number>0;
|
||||||
|
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||||
|
|
||||||
|
x === <BrandedNum>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 !== <number>0;
|
||||||
|
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||||
|
|
||||||
|
x !== <BrandedNum>0;
|
||||||
|
>x : Symbol(x, Decl(comparisonOperatorWithNumericLiteral.ts, 1, 3))
|
||||||
|
>BrandedNum : Symbol(BrandedNum, Decl(comparisonOperatorWithNumericLiteral.ts, 0, 0))
|
||||||
|
|
|
@ -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 > <number>0;
|
||||||
|
>x > <number>0 : boolean
|
||||||
|
>x : BrandedNum
|
||||||
|
><number>0 : number
|
||||||
|
>0 : 0
|
||||||
|
|
||||||
|
x > <BrandedNum>0;
|
||||||
|
>x > <BrandedNum>0 : boolean
|
||||||
|
>x : BrandedNum
|
||||||
|
><BrandedNum>0 : BrandedNum
|
||||||
|
>BrandedNum : BrandedNum
|
||||||
|
>0 : 0
|
||||||
|
|
||||||
|
// operator <
|
||||||
|
x < 0;
|
||||||
|
>x < 0 : boolean
|
||||||
|
>x : BrandedNum
|
||||||
|
>0 : 0
|
||||||
|
|
||||||
|
x < <number>0;
|
||||||
|
>x < <number>0 : boolean
|
||||||
|
>x : BrandedNum
|
||||||
|
><number>0 : number
|
||||||
|
>0 : 0
|
||||||
|
|
||||||
|
x < <BrandedNum>0;
|
||||||
|
>x < <BrandedNum>0 : boolean
|
||||||
|
>x : BrandedNum
|
||||||
|
><BrandedNum>0 : BrandedNum
|
||||||
|
>BrandedNum : BrandedNum
|
||||||
|
>0 : 0
|
||||||
|
|
||||||
|
// operator >=
|
||||||
|
x >= 0;
|
||||||
|
>x >= 0 : boolean
|
||||||
|
>x : BrandedNum
|
||||||
|
>0 : 0
|
||||||
|
|
||||||
|
x >= <number>0;
|
||||||
|
>x >= <number>0 : boolean
|
||||||
|
>x : BrandedNum
|
||||||
|
><number>0 : number
|
||||||
|
>0 : 0
|
||||||
|
|
||||||
|
x >= <BrandedNum>0;
|
||||||
|
>x >= <BrandedNum>0 : boolean
|
||||||
|
>x : BrandedNum
|
||||||
|
><BrandedNum>0 : BrandedNum
|
||||||
|
>BrandedNum : BrandedNum
|
||||||
|
>0 : 0
|
||||||
|
|
||||||
|
// operator <=
|
||||||
|
x <= 0;
|
||||||
|
>x <= 0 : boolean
|
||||||
|
>x : BrandedNum
|
||||||
|
>0 : 0
|
||||||
|
|
||||||
|
x <= <number>0;
|
||||||
|
>x <= <number>0 : boolean
|
||||||
|
>x : BrandedNum
|
||||||
|
><number>0 : number
|
||||||
|
>0 : 0
|
||||||
|
|
||||||
|
x <= <BrandedNum>0;
|
||||||
|
>x <= <BrandedNum>0 : boolean
|
||||||
|
>x : BrandedNum
|
||||||
|
><BrandedNum>0 : BrandedNum
|
||||||
|
>BrandedNum : BrandedNum
|
||||||
|
>0 : 0
|
||||||
|
|
||||||
|
// operator ==
|
||||||
|
x == 0;
|
||||||
|
>x == 0 : boolean
|
||||||
|
>x : BrandedNum
|
||||||
|
>0 : 0
|
||||||
|
|
||||||
|
x == <number>0;
|
||||||
|
>x == <number>0 : boolean
|
||||||
|
>x : BrandedNum
|
||||||
|
><number>0 : number
|
||||||
|
>0 : 0
|
||||||
|
|
||||||
|
x == <BrandedNum>0;
|
||||||
|
>x == <BrandedNum>0 : boolean
|
||||||
|
>x : BrandedNum
|
||||||
|
><BrandedNum>0 : BrandedNum
|
||||||
|
>BrandedNum : BrandedNum
|
||||||
|
>0 : 0
|
||||||
|
|
||||||
|
// operator !=
|
||||||
|
x != 0;
|
||||||
|
>x != 0 : boolean
|
||||||
|
>x : BrandedNum
|
||||||
|
>0 : 0
|
||||||
|
|
||||||
|
x != <number>0;
|
||||||
|
>x != <number>0 : boolean
|
||||||
|
>x : BrandedNum
|
||||||
|
><number>0 : number
|
||||||
|
>0 : 0
|
||||||
|
|
||||||
|
x != <BrandedNum>0;
|
||||||
|
>x != <BrandedNum>0 : boolean
|
||||||
|
>x : BrandedNum
|
||||||
|
><BrandedNum>0 : BrandedNum
|
||||||
|
>BrandedNum : BrandedNum
|
||||||
|
>0 : 0
|
||||||
|
|
||||||
|
// operator ===
|
||||||
|
x === 0;
|
||||||
|
>x === 0 : boolean
|
||||||
|
>x : BrandedNum
|
||||||
|
>0 : 0
|
||||||
|
|
||||||
|
x === <number>0;
|
||||||
|
>x === <number>0 : boolean
|
||||||
|
>x : BrandedNum
|
||||||
|
><number>0 : number
|
||||||
|
>0 : 0
|
||||||
|
|
||||||
|
x === <BrandedNum>0;
|
||||||
|
>x === <BrandedNum>0 : boolean
|
||||||
|
>x : BrandedNum
|
||||||
|
><BrandedNum>0 : BrandedNum
|
||||||
|
>BrandedNum : BrandedNum
|
||||||
|
>0 : 0
|
||||||
|
|
||||||
|
// operator !==
|
||||||
|
x !== 0;
|
||||||
|
>x !== 0 : boolean
|
||||||
|
>x : BrandedNum
|
||||||
|
>0 : 0
|
||||||
|
|
||||||
|
x !== <number>0;
|
||||||
|
>x !== <number>0 : boolean
|
||||||
|
>x : BrandedNum
|
||||||
|
><number>0 : number
|
||||||
|
>0 : 0
|
||||||
|
|
||||||
|
x !== <BrandedNum>0;
|
||||||
|
>x !== <BrandedNum>0 : boolean
|
||||||
|
>x : BrandedNum
|
||||||
|
><BrandedNum>0 : BrandedNum
|
||||||
|
>BrandedNum : BrandedNum
|
||||||
|
>0 : 0
|
||||||
|
|
|
@ -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
|
|
||||||
|
|
|
@ -75,37 +75,37 @@ condBoolean ? exprString1 : exprBoolean1; // union
|
||||||
//Cond is a boolean type literal
|
//Cond is a boolean type literal
|
||||||
true ? exprAny1 : exprAny2;
|
true ? exprAny1 : exprAny2;
|
||||||
>true ? exprAny1 : exprAny2 : any
|
>true ? exprAny1 : exprAny2 : any
|
||||||
>true : boolean
|
>true : true
|
||||||
>exprAny1 : any
|
>exprAny1 : any
|
||||||
>exprAny2 : any
|
>exprAny2 : any
|
||||||
|
|
||||||
false ? exprBoolean1 : exprBoolean2;
|
false ? exprBoolean1 : exprBoolean2;
|
||||||
>false ? exprBoolean1 : exprBoolean2 : boolean
|
>false ? exprBoolean1 : exprBoolean2 : boolean
|
||||||
>false : boolean
|
>false : false
|
||||||
>exprBoolean1 : boolean
|
>exprBoolean1 : boolean
|
||||||
>exprBoolean2 : boolean
|
>exprBoolean2 : boolean
|
||||||
|
|
||||||
true ? exprNumber1 : exprNumber2;
|
true ? exprNumber1 : exprNumber2;
|
||||||
>true ? exprNumber1 : exprNumber2 : number
|
>true ? exprNumber1 : exprNumber2 : number
|
||||||
>true : boolean
|
>true : true
|
||||||
>exprNumber1 : number
|
>exprNumber1 : number
|
||||||
>exprNumber2 : number
|
>exprNumber2 : number
|
||||||
|
|
||||||
false ? exprString1 : exprString2;
|
false ? exprString1 : exprString2;
|
||||||
>false ? exprString1 : exprString2 : string
|
>false ? exprString1 : exprString2 : string
|
||||||
>false : boolean
|
>false : false
|
||||||
>exprString1 : string
|
>exprString1 : string
|
||||||
>exprString2 : string
|
>exprString2 : string
|
||||||
|
|
||||||
true ? exprIsObject1 : exprIsObject2;
|
true ? exprIsObject1 : exprIsObject2;
|
||||||
>true ? exprIsObject1 : exprIsObject2 : Object
|
>true ? exprIsObject1 : exprIsObject2 : Object
|
||||||
>true : boolean
|
>true : true
|
||||||
>exprIsObject1 : Object
|
>exprIsObject1 : Object
|
||||||
>exprIsObject2 : Object
|
>exprIsObject2 : Object
|
||||||
|
|
||||||
true ? exprString1 : exprBoolean1; // union
|
true ? exprString1 : exprBoolean1; // union
|
||||||
>true ? exprString1 : exprBoolean1 : string | boolean
|
>true ? exprString1 : exprBoolean1 : string | boolean
|
||||||
>true : boolean
|
>true : true
|
||||||
>exprString1 : string
|
>exprString1 : string
|
||||||
>exprBoolean1 : boolean
|
>exprBoolean1 : boolean
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ true ? exprString1 : exprBoolean1; // union
|
||||||
!true ? exprAny1 : exprAny2;
|
!true ? exprAny1 : exprAny2;
|
||||||
>!true ? exprAny1 : exprAny2 : any
|
>!true ? exprAny1 : exprAny2 : any
|
||||||
>!true : boolean
|
>!true : boolean
|
||||||
>true : boolean
|
>true : true
|
||||||
>exprAny1 : any
|
>exprAny1 : any
|
||||||
>exprAny2 : any
|
>exprAny2 : any
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ typeof "123" == "string" ? exprBoolean1 : exprBoolean2;
|
||||||
>typeof "123" == "string" ? exprBoolean1 : exprBoolean2 : boolean
|
>typeof "123" == "string" ? exprBoolean1 : exprBoolean2 : boolean
|
||||||
>typeof "123" == "string" : boolean
|
>typeof "123" == "string" : boolean
|
||||||
>typeof "123" : string
|
>typeof "123" : string
|
||||||
>"123" : string
|
>"123" : "123"
|
||||||
>"string" : "string"
|
>"string" : "string"
|
||||||
>exprBoolean1 : boolean
|
>exprBoolean1 : boolean
|
||||||
>exprBoolean2 : boolean
|
>exprBoolean2 : boolean
|
||||||
|
@ -129,8 +129,8 @@ typeof "123" == "string" ? exprBoolean1 : exprBoolean2;
|
||||||
2 > 1 ? exprNumber1 : exprNumber2;
|
2 > 1 ? exprNumber1 : exprNumber2;
|
||||||
>2 > 1 ? exprNumber1 : exprNumber2 : number
|
>2 > 1 ? exprNumber1 : exprNumber2 : number
|
||||||
>2 > 1 : boolean
|
>2 > 1 : boolean
|
||||||
>2 : number
|
>2 : 2
|
||||||
>1 : number
|
>1 : 1
|
||||||
>exprNumber1 : number
|
>exprNumber1 : number
|
||||||
>exprNumber2 : number
|
>exprNumber2 : number
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ null === undefined ? exprString1 : exprString2;
|
||||||
true || false ? exprIsObject1 : exprIsObject2;
|
true || false ? exprIsObject1 : exprIsObject2;
|
||||||
>true || false ? exprIsObject1 : exprIsObject2 : Object
|
>true || false ? exprIsObject1 : exprIsObject2 : Object
|
||||||
>true || false : boolean
|
>true || false : boolean
|
||||||
>true : boolean
|
>true : true
|
||||||
>false : false
|
>false : false
|
||||||
>exprIsObject1 : Object
|
>exprIsObject1 : Object
|
||||||
>exprIsObject2 : Object
|
>exprIsObject2 : Object
|
||||||
|
@ -204,49 +204,49 @@ var resultIsStringOrBoolean1 = condBoolean ? exprString1 : exprBoolean1; // unio
|
||||||
var resultIsAny2 = true ? exprAny1 : exprAny2;
|
var resultIsAny2 = true ? exprAny1 : exprAny2;
|
||||||
>resultIsAny2 : any
|
>resultIsAny2 : any
|
||||||
>true ? exprAny1 : exprAny2 : any
|
>true ? exprAny1 : exprAny2 : any
|
||||||
>true : boolean
|
>true : true
|
||||||
>exprAny1 : any
|
>exprAny1 : any
|
||||||
>exprAny2 : any
|
>exprAny2 : any
|
||||||
|
|
||||||
var resultIsBoolean2 = false ? exprBoolean1 : exprBoolean2;
|
var resultIsBoolean2 = false ? exprBoolean1 : exprBoolean2;
|
||||||
>resultIsBoolean2 : boolean
|
>resultIsBoolean2 : boolean
|
||||||
>false ? exprBoolean1 : exprBoolean2 : boolean
|
>false ? exprBoolean1 : exprBoolean2 : boolean
|
||||||
>false : boolean
|
>false : false
|
||||||
>exprBoolean1 : boolean
|
>exprBoolean1 : boolean
|
||||||
>exprBoolean2 : boolean
|
>exprBoolean2 : boolean
|
||||||
|
|
||||||
var resultIsNumber2 = true ? exprNumber1 : exprNumber2;
|
var resultIsNumber2 = true ? exprNumber1 : exprNumber2;
|
||||||
>resultIsNumber2 : number
|
>resultIsNumber2 : number
|
||||||
>true ? exprNumber1 : exprNumber2 : number
|
>true ? exprNumber1 : exprNumber2 : number
|
||||||
>true : boolean
|
>true : true
|
||||||
>exprNumber1 : number
|
>exprNumber1 : number
|
||||||
>exprNumber2 : number
|
>exprNumber2 : number
|
||||||
|
|
||||||
var resultIsString2 = false ? exprString1 : exprString2;
|
var resultIsString2 = false ? exprString1 : exprString2;
|
||||||
>resultIsString2 : string
|
>resultIsString2 : string
|
||||||
>false ? exprString1 : exprString2 : string
|
>false ? exprString1 : exprString2 : string
|
||||||
>false : boolean
|
>false : false
|
||||||
>exprString1 : string
|
>exprString1 : string
|
||||||
>exprString2 : string
|
>exprString2 : string
|
||||||
|
|
||||||
var resultIsObject2 = true ? exprIsObject1 : exprIsObject2;
|
var resultIsObject2 = true ? exprIsObject1 : exprIsObject2;
|
||||||
>resultIsObject2 : Object
|
>resultIsObject2 : Object
|
||||||
>true ? exprIsObject1 : exprIsObject2 : Object
|
>true ? exprIsObject1 : exprIsObject2 : Object
|
||||||
>true : boolean
|
>true : true
|
||||||
>exprIsObject1 : Object
|
>exprIsObject1 : Object
|
||||||
>exprIsObject2 : Object
|
>exprIsObject2 : Object
|
||||||
|
|
||||||
var resultIsStringOrBoolean2 = true ? exprString1 : exprBoolean1; // union
|
var resultIsStringOrBoolean2 = true ? exprString1 : exprBoolean1; // union
|
||||||
>resultIsStringOrBoolean2 : string | boolean
|
>resultIsStringOrBoolean2 : string | boolean
|
||||||
>true ? exprString1 : exprBoolean1 : string | boolean
|
>true ? exprString1 : exprBoolean1 : string | boolean
|
||||||
>true : boolean
|
>true : true
|
||||||
>exprString1 : string
|
>exprString1 : string
|
||||||
>exprBoolean1 : boolean
|
>exprBoolean1 : boolean
|
||||||
|
|
||||||
var resultIsStringOrBoolean3 = false ? exprString1 : exprBoolean1; // union
|
var resultIsStringOrBoolean3 = false ? exprString1 : exprBoolean1; // union
|
||||||
>resultIsStringOrBoolean3 : string | boolean
|
>resultIsStringOrBoolean3 : string | boolean
|
||||||
>false ? exprString1 : exprBoolean1 : string | boolean
|
>false ? exprString1 : exprBoolean1 : string | boolean
|
||||||
>false : boolean
|
>false : false
|
||||||
>exprString1 : string
|
>exprString1 : string
|
||||||
>exprBoolean1 : boolean
|
>exprBoolean1 : boolean
|
||||||
|
|
||||||
|
@ -254,7 +254,7 @@ var resultIsAny3 = !true ? exprAny1 : exprAny2;
|
||||||
>resultIsAny3 : any
|
>resultIsAny3 : any
|
||||||
>!true ? exprAny1 : exprAny2 : any
|
>!true ? exprAny1 : exprAny2 : any
|
||||||
>!true : boolean
|
>!true : boolean
|
||||||
>true : boolean
|
>true : true
|
||||||
>exprAny1 : any
|
>exprAny1 : any
|
||||||
>exprAny2 : any
|
>exprAny2 : any
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ var resultIsBoolean3 = typeof "123" == "string" ? exprBoolean1 : exprBoolean2;
|
||||||
>typeof "123" == "string" ? exprBoolean1 : exprBoolean2 : boolean
|
>typeof "123" == "string" ? exprBoolean1 : exprBoolean2 : boolean
|
||||||
>typeof "123" == "string" : boolean
|
>typeof "123" == "string" : boolean
|
||||||
>typeof "123" : string
|
>typeof "123" : string
|
||||||
>"123" : string
|
>"123" : "123"
|
||||||
>"string" : "string"
|
>"string" : "string"
|
||||||
>exprBoolean1 : boolean
|
>exprBoolean1 : boolean
|
||||||
>exprBoolean2 : boolean
|
>exprBoolean2 : boolean
|
||||||
|
@ -272,8 +272,8 @@ var resultIsNumber3 = 2 > 1 ? exprNumber1 : exprNumber2;
|
||||||
>resultIsNumber3 : number
|
>resultIsNumber3 : number
|
||||||
>2 > 1 ? exprNumber1 : exprNumber2 : number
|
>2 > 1 ? exprNumber1 : exprNumber2 : number
|
||||||
>2 > 1 : boolean
|
>2 > 1 : boolean
|
||||||
>2 : number
|
>2 : 2
|
||||||
>1 : number
|
>1 : 1
|
||||||
>exprNumber1 : number
|
>exprNumber1 : number
|
||||||
>exprNumber2 : number
|
>exprNumber2 : number
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ var resultIsObject3 = true || false ? exprIsObject1 : exprIsObject2;
|
||||||
>resultIsObject3 : Object
|
>resultIsObject3 : Object
|
||||||
>true || false ? exprIsObject1 : exprIsObject2 : Object
|
>true || false ? exprIsObject1 : exprIsObject2 : Object
|
||||||
>true || false : boolean
|
>true || false : boolean
|
||||||
>true : boolean
|
>true : true
|
||||||
>false : false
|
>false : false
|
||||||
>exprIsObject1 : Object
|
>exprIsObject1 : Object
|
||||||
>exprIsObject2 : Object
|
>exprIsObject2 : Object
|
||||||
|
@ -300,7 +300,7 @@ var resultIsStringOrBoolean4 = typeof "123" === "string" ? exprString1 : exprBoo
|
||||||
>typeof "123" === "string" ? exprString1 : exprBoolean1 : string | boolean
|
>typeof "123" === "string" ? exprString1 : exprBoolean1 : string | boolean
|
||||||
>typeof "123" === "string" : boolean
|
>typeof "123" === "string" : boolean
|
||||||
>typeof "123" : string
|
>typeof "123" : string
|
||||||
>"123" : string
|
>"123" : "123"
|
||||||
>"string" : "string"
|
>"string" : "string"
|
||||||
>exprString1 : string
|
>exprString1 : string
|
||||||
>exprBoolean1 : boolean
|
>exprBoolean1 : boolean
|
||||||
|
|
|
@ -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,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,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(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(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(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,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
|
// error, missing intialicer
|
||||||
const c1;
|
const c1;
|
||||||
|
@ -34,8 +32,6 @@ tests/cases/compiler/constDeclarations-errors.ts(16,25): error TS2365: Operator
|
||||||
|
|
||||||
// error, assigning to a const
|
// error, assigning to a const
|
||||||
for(const c8 = 0; c8 < 1; c8++) { }
|
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.
|
!!! 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
|
// error, can not be unintalized
|
||||||
for(const c10 = 0, c11; c10 < 1;) { }
|
for(const c10 = 0, c11; c10 < 1;) { }
|
||||||
~~~
|
~~~
|
||||||
!!! error TS1155: 'const' declarations must be initialized
|
!!! error TS1155: 'const' declarations must be initialized
|
||||||
~~~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '0' and '1'.
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
// global
|
// global
|
||||||
const c = "string";
|
const c = "string";
|
||||||
>c : string
|
>c : "string"
|
||||||
>"string" : string
|
>"string" : "string"
|
||||||
|
|
||||||
var n: number;
|
var n: number;
|
||||||
>n : number
|
>n : number
|
||||||
|
@ -13,24 +13,24 @@ var b: boolean;
|
||||||
|
|
||||||
// for scope
|
// for scope
|
||||||
for (const c = 0; c < 10; n = c ) {
|
for (const c = 0; c < 10; n = c ) {
|
||||||
>c : number
|
>c : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>c < 10 : boolean
|
>c < 10 : boolean
|
||||||
>c : number
|
>c : 0
|
||||||
>10 : number
|
>10 : 10
|
||||||
>n = c : number
|
>n = c : 0
|
||||||
>n : number
|
>n : number
|
||||||
>c : number
|
>c : 0
|
||||||
|
|
||||||
// for block
|
// for block
|
||||||
const c = false;
|
const c = false;
|
||||||
>c : boolean
|
>c : false
|
||||||
>false : boolean
|
>false : false
|
||||||
|
|
||||||
b = c;
|
b = c;
|
||||||
>b = c : boolean
|
>b = c : false
|
||||||
>b : boolean
|
>b : boolean
|
||||||
>c : boolean
|
>c : false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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; }
|
|
|
@ -2,36 +2,36 @@
|
||||||
|
|
||||||
// No error
|
// No error
|
||||||
const c1 = false;
|
const c1 = false;
|
||||||
>c1 : boolean
|
>c1 : false
|
||||||
>false : boolean
|
>false : false
|
||||||
|
|
||||||
const c2: number = 23;
|
const c2: number = 23;
|
||||||
>c2 : number
|
>c2 : number
|
||||||
>23 : number
|
>23 : 23
|
||||||
|
|
||||||
const c3 = 0, c4 :string = "", c5 = null;
|
const c3 = 0, c4 :string = "", c5 = null;
|
||||||
>c3 : number
|
>c3 : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>c4 : string
|
>c4 : string
|
||||||
>"" : string
|
>"" : ""
|
||||||
>c5 : any
|
>c5 : any
|
||||||
>null : null
|
>null : null
|
||||||
|
|
||||||
|
|
||||||
for(const c4 = 0; c4 < 9; ) { break; }
|
for(const c4 = 0; c4 < 9; ) { break; }
|
||||||
>c4 : number
|
>c4 : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>c4 < 9 : boolean
|
>c4 < 9 : boolean
|
||||||
>c4 : number
|
>c4 : 0
|
||||||
>9 : number
|
>9 : 9
|
||||||
|
|
||||||
|
|
||||||
for(const c5 = 0, c6 = 0; c5 < c6; ) { break; }
|
for(const c5 = 0, c6 = 0; c5 < c6; ) { break; }
|
||||||
>c5 : number
|
>c5 : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>c6 : number
|
>c6 : 0
|
||||||
>0 : number
|
>0 : 0
|
||||||
>c5 < c6 : boolean
|
>c5 < c6 : boolean
|
||||||
>c5 : number
|
>c5 : 0
|
||||||
>c6 : number
|
>c6 : 0
|
||||||
|
|
||||||
|
|
|
@ -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,11): error TS1146: Declaration expected.
|
||||||
tests/cases/compiler/duplicateLocalVariable1.ts(2,13): error TS2304: Cannot find name 'commonjs'.
|
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,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.
|
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 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.
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
||||||
bytes.push(fb.readByte());
|
bytes.push(fb.readByte());
|
||||||
|
|
|
@ -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,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.
|
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 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.
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
||||||
bytes.push(fb.readByte());
|
bytes.push(fb.readByte());
|
||||||
|
|
|
@ -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,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 '<T, U>(x: any) => any' and 'typeof A'.
|
tests/cases/compiler/grammarAmbiguities1.ts(8,3): error TS2365: Operator '<' cannot be applied to types '<T, U>(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,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 '<T, U>(x: any) => any' and 'typeof A'.
|
tests/cases/compiler/grammarAmbiguities1.ts(9,3): error TS2365: Operator '<' cannot be applied to types '<T, U>(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'.
|
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 '<T, U>(x: any) => any' and 'typeof A'.
|
!!! error TS2365: Operator '<' cannot be applied to types '<T, U>(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));
|
f(g < A, B > +(7));
|
||||||
~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~
|
||||||
!!! error TS2346: Supplied parameters do not match any signature of call target.
|
!!! error TS2346: Supplied parameters do not match any signature of call target.
|
||||||
|
|
|
@ -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(1,5): error TS1109: Expression expected.
|
||||||
|
|
||||||
|
|
||||||
==== tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity2.ts (2 errors) ====
|
==== tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity2.ts (2 errors) ====
|
||||||
1 > > 2;
|
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.
|
!!! error TS1109: Expression expected.
|
|
@ -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(1,8): error TS1109: Expression expected.
|
||||||
|
|
||||||
|
|
||||||
==== tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity3.ts (2 errors) ====
|
==== tests/cases/conformance/parser/ecmascript5/Generics/parserGreaterThanTokenAmbiguity3.ts (2 errors) ====
|
||||||
1 >/**/> 2;
|
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.
|
!!! error TS1109: Expression expected.
|
|
@ -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.
|
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;
|
> 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.
|
!!! error TS1109: Expression expected.
|
|
@ -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
|
||||||
|
}
|
||||||
|
|
34
tests/baselines/reference/relationalOperatorComparable.js
Normal file
34
tests/baselines/reference/relationalOperatorComparable.js
Normal file
|
@ -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
|
||||||
|
}
|
|
@ -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(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(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(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(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(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 abc: "ABC" = "ABC";
|
||||||
let xyz: "XYZ" = "XYZ";
|
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.
|
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||||
let j = abc < xyz;
|
let j = abc < xyz;
|
||||||
~~~~~~~~~
|
|
||||||
!!! error TS2365: Operator '<' cannot be applied to types '"ABC"' and '"XYZ"'.
|
|
||||||
let k = abc === xyz;
|
let k = abc === xyz;
|
||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
!!! error TS2365: Operator '===' cannot be applied to types '"ABC"' and '"XYZ"'.
|
!!! error TS2365: Operator '===' cannot be applied to types '"ABC"' and '"XYZ"'.
|
||||||
|
|
15
tests/cases/compiler/relationalOperatorComparable.ts
Normal file
15
tests/cases/compiler/relationalOperatorComparable.ts
Normal file
|
@ -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
|
||||||
|
}
|
Loading…
Reference in a new issue