Skip to content

Reapply contextual type when recalculating array literals as tuples #37071

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

Merged
merged 1 commit into from
Feb 27, 2020

Conversation

weswigham
Copy link
Member

Fixes #37037

In elaborateArrayLiteral, we called checkArrayLiteral with a flag to get the tuple type for the expression, so we can dive into it and elaborate on each member. The differing error message was caused by the contextual type for that expression check not being the same as the one used during the original expression resolution (namely, we didn't apply one, so we did our fallback oif walking up the tree, which, in the case of the call, eventually returns any, while in the case of the assignment, eventually returns the declared type). With this change, we reapply the context (the target type) to the expression when recalculate it.

@weswigham weswigham merged commit e7c578a into microsoft:master Feb 27, 2020
@weswigham weswigham deleted the fix-elaboration-literalyness branch February 27, 2020 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Poor error message for string literals properties in argument positions
3 participants