Skip to content

Fix crash in recursive declared type resolution#23950

Merged
sandersn merged 1 commit into
masterfrom
fix-crash-in-recursive-declared-type-resolution
May 9, 2018
Merged

Fix crash in recursive declared type resolution#23950
sandersn merged 1 commit into
masterfrom
fix-crash-in-recursive-declared-type-resolution

Conversation

@sandersn
Copy link
Copy Markdown
Member

@sandersn sandersn commented May 7, 2018

... when one type has a type parameter with a default.

This occurs because declaredCallSignatures and declaredConstructSignatures are undefined before getSignaturesOfSymbol returns, which can be observed if these properties are read during the execution of getSignaturesOfSymbol. This happens with the following example, which has mutually recursive interfaces, one of which has a type parameter with a default.

interface F { (): E }
interface D<T extends F = F> {}
type E = D

The simplest fix for the above program is to check whether we are in a javascript file immediately in fillMissingTypeArguments. But this doesn't work when the type alias is in a Javascript file (as shown in the test case for this PR), and in any case the recursive type resolution might fail in other ways in the future.

Fixes #23025

When one type has a type parameter with a default
@sandersn sandersn merged commit e27fb06 into master May 9, 2018
@sandersn sandersn deleted the fix-crash-in-recursive-declared-type-resolution branch May 9, 2018 16:25
@microsoft microsoft locked and limited conversation to collaborators Jul 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compiler throws unhandled exception

2 participants