Skip to content

Fix 46457: Improve autocomplete for union of tuples #51421

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

Closed
wants to merge 6 commits into from

Conversation

rynobax
Copy link

@rynobax rynobax commented Nov 6, 2022

Fixes #46457

tbh I have no idea if this is the "right" way to go about fixing this, I used a lot of trial and error to get to these changes. I'm assuming since all the tests pass it makes some sort of sense, but lmk if there's something fundamentally wrong with this approach.

@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Nov 6, 2022
@rynobax
Copy link
Author

rynobax commented Nov 6, 2022

@rynobax please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.

Contributor License Agreement

@microsoft-github-policy-service agree

Copy link
Member

@andrewbranch andrewbranch left a comment

Choose a reason for hiding this comment

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

This is pretty tricky. I don’t think this is the right place to do any filtering, because conceptually, it doesn’t make sense for a contextually typed literal to be able to change its own contextual type. The contextual type exists because of some higher level context, and the literal just sits in a position affected by that context. It should be a one-way relationship. (It’s also usually a bit of a red flag to change general type checker code for a completions-specific purpose.) You can probably use similar logic to this, but perform it in completions.ts.

@sandersn
Copy link
Member

Do you want to keep working on this? Otherwise I'd like to close it to reduce the number of open PRs.

@rynobax
Copy link
Author

rynobax commented Mar 10, 2023

I might circle back to this at some point, but feel free to close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Backlog Bug PRs that fix a backlog bug
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Code hint not narrowed properly on union of literal tuple
5 participants