TypeScript Version: 2.1.5
Code
declare let doSomething;
for (let a1 of [])
for (let a2 of a1.someArray)
doSomething(() => a2);
tsconfig looks like this:
{
"compilerOptions": {
"moduleResolution": "node",
"target": "es5"
},
"files": [
"test.ts"
]
}
Expected behavior:
Should compile.
Actual behavior:
Typescript compiler fails on an assertion, throwing the following exception:
Error: Debug Failure. False expression: Too many nodes written to output.
at Object.assert (...\built\local\tsc.js:2707:23)
at extractSingleNode (...\built\local\tsc.js:38414:15)
at Object.visitNode (...\built\local\tsc.js:38091:54)
at convertForOfToFor (...\built\local\tsc.js:42367:36)
at convertIterationStatementBodyIfNecessary (...\built\local\tsc.js:42440:40)
at visitForOfStatement (...\built\local\tsc.js:42320:20)
at visitJavaScript (...\built\local\tsc.js:41590:28)
at visitorWorker (...\built\local\tsc.js:41518:24)
at dispatcher (...\built\local\tsc.js:41439:19)
at saveStateAndInvoke (...\built\local\tsc.js:41457:27)
The problem goes away if the first loop is written with curly brackets.
declare let doSomething;
for (let a1 of []) {
for (let a2 of a1.someArray)
doSomething(() => a2);
}
TypeScript Version: 2.1.5
Code
tsconfig looks like this:
Expected behavior:
Should compile.
Actual behavior:
Typescript compiler fails on an assertion, throwing the following exception:
The problem goes away if the first loop is written with curly brackets.