Skip to content

TypeError: Cannot read property 'kind' of undefined #6497

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
andy-hanson opened this issue Jan 15, 2016 · 0 comments · Fixed by #6498
Closed

TypeError: Cannot read property 'kind' of undefined #6497

andy-hanson opened this issue Jan 15, 2016 · 0 comments · Fixed by #6498
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@andy-hanson
Copy link

The following code causes the compiler to crash:

function foo() {
    for (;;) {
        const a = 0
        switch (a) {
            case 0:
                return b => b(a)
        }
    }
}

The error is:

TypeError: Cannot read property 'kind' of undefined
    at convertLoopBody (/home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:27811:45)
    at emitLoop (/home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:27797:32)
    at emitForStatement (/home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:28011:17)
    at emitJavaScriptWorker (/home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:31428:32)
    at emitNodeWithoutSourceMap (/home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:31265:21)
    at emitNodeWithSourceMap (/home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:31259:21)
    at emitNodeConsideringCommentsOption (/home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:31250:21)
    at emit (/home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:31233:17)
    at emitLinesStartingAt (/home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:26271:21)
    at emitBlockFunctionBody (/home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:29114:21)

Tested on typescript 1.8.0-dev.20160114.

@vladima vladima self-assigned this Jan 15, 2016
@vladima vladima added this to the TypeScript 1.8 milestone Jan 15, 2016
@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Jan 15, 2016
@vladima vladima added the Fixed A PR has been merged for this issue label Jan 15, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants