Skip to content

compiler exception: "Too many nodes written to output" #12961

@dkent600

Description

@dkent600

TypeScript Version: 2.1.4

Code

// A *self-contained* demonstration of the problem follows...
export class Test  {
    constructor() {

        let outerArray: Array<number> = [1, 2, 3];
        let innerArray: Array<number> = [1, 2, 3];

        for (let outer of outerArray)
            for (let inner of innerArray) {
                this.aFunction((newValue, oldValue) => {
                    console.log(`${outer} ${inner} ${newValue}`);
                });
            }
    }

    public aFunction(func: (newValue: any, oldValue: any) => void): void {
    }
}

tsconfig looks like this:

{
  "compilerOptions": {
    "moduleResolution": "node",
    "target": "es5"
  },
  "files": [ "test.ts" ]
}

Expected behavior:
Should compile

Actual behavior:
The typescript compiler (tsc.exe) fails on an assertion, throwing the following exception:

Error: Debug Failure. False expression: Too many nodes written to output.
    at Object.assert (...\npm\node_modules\typescript\lib\tsc.js:1794:23)
    at extractSingleNode (...\npm\node_modules\typescript\lib\tsc.js:37059:15)
    at Object.visitNode (...\npm\node_modules\typescript\lib\tsc.js:36736:54)
    at convertIterationStatementBodyIfNecessary (...\npm\node_modules\typescript\lib\tsc.js:41071:31)
    at visitForOfStatement (...\npm\node_modules\typescript\lib\tsc.js:40912:20)
    at visitJavaScript (...\npm\node_modules\typescript\lib\tsc.js:40185:28)
    at visitorWorker (...\npm\node_modules\typescript\lib\tsc.js:40113:24)
    at dispatcher (...\npm\node_modules\typescript\lib\tsc.js:40034:19)
    at saveStateAndInvoke (...\npm\node_modules\typescript\lib\tsc.js:40052:27)
    at visitor (...\npm\node_modules\typescript\lib\tsc.js:40029:20)

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions