Skip to content

Compiler / language service hang #7081

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
mburnell opened this issue Feb 15, 2016 · 3 comments · Fixed by #7373
Closed

Compiler / language service hang #7081

mburnell opened this issue Feb 15, 2016 · 3 comments · Fixed by #7373
Labels
Bug A bug in TypeScript High Priority

Comments

@mburnell
Copy link

I've come across code that will hang tsc.exe (v1.7.5) (and anything that uses the language service, such as Visual Studio, which is where I initially encountered it). I'm sorry I can't narrow this down to more specific language constructs, but you can reproduce this with two popular libraries and three lines of code.

Using rxjs' rx.all.d.ts (4.0.7) file and immutablejs' Immutable.d.ts (3.7.6), the following three lines will cause a hang when compiled using tsc.exe:

var a = new Rx.Subject<string>();
var b = new Rx.Subject<Immutable.Set<number>>();
var c = a.withLatestFrom(b, x => x);

The third line is impossible to key into an editor running the TS language service; it will hang when attempting to type the lambda. My guess is that there's a problem attempting to infer the type of x. I have found that manually specifying the type works around the issue, i.e.:

var c = a.withLatestFrom<Immutable.Set<number>, string>(b, x => x);

works correctly, but manually specifying types that (normally) can be inferred makes me sad. I'm aware of issue #5849, and thought it might just be that, but I see that was ironed out in 1.7.5. I've also tried to compile using the 1.8 beta and I get the same result. To clarify, when I say "hang", I mean I've given tsc.exe 30+ minutes to complete and it hasn't.

@sandersn
Copy link
Member

After talking with @vladima more about this, the root cause is trying to relate lots of nearly-similar types (mostly collection types, according to Vlad). Unlike #7097 and #5695, they are not types that are incorrectly not identical -- they legitimately are similar-but-different.

Unfortunately, that means that #7097 and #5695 can have ad-hoc fixes: make the identical types actually identical. But this bug needs a faster way to relate nearly-identical types in a union.

@vladima
Copy link
Contributor

vladima commented Mar 3, 2016

This fix should be available in today's nightly build (typescript@next on npm). Can you give it a try and check if issue still exists?

@mburnell
Copy link
Author

mburnell commented Mar 4, 2016

Thanks - the fix works perfectly.

@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 High Priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants