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

Follow-up from unpacked tuple assignment work #13773

Open
4 tasks
dhruvmanila opened this issue Oct 16, 2024 · 0 comments
Open
4 tasks

Follow-up from unpacked tuple assignment work #13773

dhruvmanila opened this issue Oct 16, 2024 · 0 comments
Labels
red-knot Multi-file analysis & type inference

Comments

@dhruvmanila
Copy link
Member

dhruvmanila commented Oct 16, 2024

As #13316 is merged, there are some follow-up work that needs to be done. The following is a list in the order of priority where the highest priority work is on the top:

  • Avoiding duplicate diagnostics. Considering (a, b) = (1, 2), as the inference runs for each symbol, if there are any diagnostics that's raised during that part (like "too many values to unpack"), then there will be multiple diagnostics added to the builder one for each symbol. Refer [red-knot] Infer target types for unpacked tuple assignment #13316 (comment)
  • Use the unpacking logic in other places where it's relevant like for loops, with statements. For example, in for (x, y) in [(1, 2), (3, 4)]: ...
  • Combine starred element types. For example, in (a, *b, c) = (1, 2, 3, 4), the Literal[2] and Literal[3] type should be combined into list[int] to be assigned to *b. (Requires generic support over list)
    // TODO: Combine the types into a list type. If the
    // starred_element_types is empty, then it should be `List[Any]`.
    // combine_types(starred_element_types);
    element_types.push(Type::Todo);
  • Additional diagnostics when the number of targets is not equal to the number of elements on the RHS
@dhruvmanila dhruvmanila added the red-knot Multi-file analysis & type inference label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
red-knot Multi-file analysis & type inference
Projects
None yet
Development

No branches or pull requests

1 participant