Skip to content

Out of stack space while compiling #16853

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
jovdb opened this issue Jun 30, 2017 · 6 comments
Closed

Out of stack space while compiling #16853

jovdb opened this issue Jun 30, 2017 · 6 comments
Labels
Bug A bug in TypeScript

Comments

@jovdb
Copy link

jovdb commented Jun 30, 2017

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)

@jovdb jovdb changed the title Out fo stack space while compiling Out of stack space while compiling Jun 30, 2017
@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Jun 30, 2017
@mceachen
Copy link

mceachen commented Jul 1, 2017

Just got hit by this as well. FWIW, tsc v2.3.4 and v2.4.0 have no problem compiling the same project.

Run tsc in this directory: https://github.com/Vincit/objection.js/tree/master/examples/express-ts

@mceachen
Copy link

@RyanCavanaugh is there anything else I can provide to help debug?

@clownwilleatme
Copy link

@mceachen I had a similar issue which went away after installing the v2.5 nightly (typescript@next) - maybe give that a try?

@mceachen
Copy link

2.5.0-dev.20170712 and 2.5.0-dev.20170707 behave the same as 2.4.1 for the abovementioned repository, but thanks for the suggestion, @clownwilleatme .

@mceachen
Copy link

I've found a workaround: #17097 (comment)

@sandersn
Copy link
Member

This no longer repros with typescript@latest.

@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript
Projects
None yet
Development

No branches or pull requests

5 participants