Skip to content
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

Infer rest type without using assignContextualParameterTypes #49740

Merged
merged 4 commits into from
Jul 6, 2022

Conversation

jakebailey
Copy link
Member

@jakebailey jakebailey commented Jun 29, 2022

Fixes #49383

It was suspicious to me that assignContextualParameterTypes was being called here when inferFromAnnotatedParameters's only caller will always immediately call assignContextualParameterTypes again, which means you're pretty much guaranteed to hit the debug assert for a duplicate assignParameterType.

It looks like all that this was doing was assigning the rest type to the signature, then picking it back out again to pass to inferTypes, so just don't do that, instead obtaining the type directly. The caller will call assignContextualParameterTypes to eventually assign it, and the code surrounding this manages just fine without assignContextualParameterTypes.

Move the code entirely out of inferFromAnnotatedParameters and don't call assignContextualParameterTypes; the code that was added in #30114 has nothing to do with annotated parameters.

@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Jun 29, 2022
@jakebailey
Copy link
Member Author

Huh, fails in ci for some reason

@jakebailey
Copy link
Member Author

Oh, because it's wrong and I didn't notice because I was debugging one test and forgot to run the whole suite :(

@jakebailey jakebailey marked this pull request as draft June 30, 2022 02:14
@jakebailey jakebailey marked this pull request as ready for review June 30, 2022 02:26
@jakebailey
Copy link
Member Author

Okay, I think it's better now; all of the other changes disappeared.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Debug Failure. Parameter symbol already has a cached type which differs from newly assigned type.
4 participants