Skip to content

Conversation

@ahejlsberg
Copy link
Member

Fixes #38198.

@ahejlsberg
Copy link
Member Author

@typescript-bot test this
@typescript-bot user test this
@typescript-bot run dt

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 27, 2020

Heya @ahejlsberg, I've started to run the extended test suite on this PR at 8648986. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 27, 2020

Heya @ahejlsberg, I've started to run the parallelized community code test suite on this PR at 8648986. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 27, 2020

Heya @ahejlsberg, I've started to run the parallelized Definitely Typed test suite on this PR at 8648986. You can monitor the build here.

@ahejlsberg
Copy link
Member Author

Test runs all appear to be clean (issues are preexisting conditions).

*/
function inferTypeForHomomorphicMappedType(source: Type, target: MappedType, constraint: IndexType): Type | undefined {
if (inInferTypeForHomomorphicMappedType) {
return undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to cache this inference failure, as in invokeOnce, so if it's attempted again on the same types outside the same recursive context (but during the same traversal) we still refuse to perform the secondary inference?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. In the general case this function is never recursive. The only code paths that could recur are special cases for array and tuple types, so we're talking something that happens very rarely. I think this simple solution is fine.

@ahejlsberg ahejlsberg merged commit a0ebd2c into master Apr 28, 2020
@ahejlsberg ahejlsberg deleted the fix38198 branch April 28, 2020 23:56
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
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.

recursive type crashes tsc with RangeError: Maximum call stack size exceeded

4 participants