-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Fix compiler crash on generics overload resolution failure #62790
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: moznion <[email protected]>
|
@microsoft-github-policy-service agree |
0d05479 to
b9e3434
Compare
…microsoft#61524 Replace `Debug.fail()` calls with proper error generation to prevent TypeScript compiler crashes when overload resolution fails for complex generic constraints, for example JSX elements. Problem -- The TypeScript compiler crashes with "Debug Failure. No error for last overload signature" when resolving certain complex generic constraints, e.g., JSX element types. This regression has existed since TypeScript 3.6 and affects many React/JSX projects. Root Cause -- When `getSignatureApplicabilityError()` returns no diagnostics for overload candidates, the compiler calls `Debug.fail()` instead of handling the edge case gracefully, causing an immediate crash. Solution -- - Replace `Debug.fail()` calls with fallback diagnostic generation - Generate appropriate error messages for unhandled overload resolution cases - Ensure compiler continues execution without crashing Related to microsoft#61524, microsoft#60229, microsoft#48636, microsoft#33133 Signed-off-by: moznion <[email protected]>
b9e3434 to
56578c5
Compare
|
I think this is just papering over a bug somewhere else. IIRC the intent of these debug fails are to assert that the previous steps added an error. |
|
@jakebailey |
|
If it's a regression, I would consider bisecting with https://www.npmjs.com/package/every-ts |
|
I don't think this is a regression. It appears that the problem still occurs on the latest main branch. |
|
But you said it wasn't broken in 5.5, so there is a commit in between where this broke. |
|
But, #61524 (comment) seems to imply there's already a PR for this? |
Fixes #61524
Replace
Debug.fail()calls with proper error generation to prevent TypeScript compiler crashes when overload resolution fails for complex generic constraints, for example JSX elements.Problem
The TypeScript compiler crashes with "Debug Failure. No error for last overload signature" when resolving certain complex generic constraints, e.g., JSX element types. This regression has existed since TypeScript 3.6 and affects many React/JSX projects.
Root Cause
When
getSignatureApplicabilityError()returns no diagnostics for overload candidates, the compiler callsDebug.fail()instead of handling the edge case gracefully, causing an immediate crash.Solution
Debug.fail()calls with fallback diagnostic generationNote
This change doesn’t fix the core logic of type inference. Ideally, that core should be fixed, but this pull request only addresses the compiler crash.
Related to #61524, #60229, #48636, #33133