Skip to content

Out of stack space while compiling #16853

Closed
@jovdb

Description

@jovdb

When I run this piece of nonsense code, the compiler crashes.
I know this code is completely invalid but maybe this can somehow stabilize the compiler.

TypeScript Version: 2.4.1 (No compiler flags used)

Code

class Animal {}

interface IAnimal extends Animal {
	foo(): IAnimal[];
	bar<TAnimal extends IAnimal>(): TAnimal;
}

interface IBird extends IAnimal {
	foo(): IPigeon[];
}

interface IPigeon extends IBird {
	bar(): IPigeon;
}

Expected behavior:
Compiler error(s), no stack overflow
Didn't test if in 'watch mode' this stops the watching.

Actual behavior:
Script failed with error: 'JsErrorScriptException (0x30001)'.
Out of stack space
Error: Out of stack space
at runWithCancellationToken (Unknown script code:55776:17)
at getSemanticDiagnosticsForFileNoCache (Unknown script code:55783:13)
at getAndCacheDiagnostics (Unknown script code:55989:13)
at getSemanticDiagnosticsForFile (Unknown script code:55780:13)
at Anonymous function (Unknown script code:55737:17)
at flatMap (Unknown script code:527:17)
at getDiagnosticsHelper (Unknown script code:55733:13)
at getSemanticDiagnostics (Unknown script code:55744:13)
at compileProgram (Unknown script code:58304:21)
at compile (Unknown script code:58261:9)

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions