Skip to content

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.

@jakebailey jakebailey requested review from sandersn and weswigham June 29, 2022 23:02
@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 jakebailey requested a review from weswigham June 30, 2022 02:26
@jakebailey
Copy link
Member Author

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

@jakebailey jakebailey merged commit 641ab8e into microsoft:main Jul 6, 2022
@jakebailey jakebailey deleted the fix-49383 branch July 6, 2022 15:27
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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