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

[red-knot] Duplicate diagnostics in unpacking targets #16514

Open
dhruvmanila opened this issue Mar 5, 2025 · 0 comments
Open

[red-knot] Duplicate diagnostics in unpacking targets #16514

dhruvmanila opened this issue Mar 5, 2025 · 0 comments
Assignees
Labels
bug Something isn't working red-knot Multi-file analysis & type inference

Comments

@dhruvmanila
Copy link
Member

Summary

Consider the following code:

class Foo():
    pass

a, b = Foo().nonexistant

Here, the RHS of the assignment has an error unresolved-attribute which is being shown 3 times (2 + 1 where 2 is the number of variables involved in the unpacking):

Image

This is because the standalone expression is being inferred outside the unpacking in infer_assignment_definition (and similarly in infer_for_statement_definition). This inference should only be done for non-unpack targets.

Fixing this would lead to another bug which is that the diagnostics raised during the unpacking query isn't being merged into the outer type inference builder.

Version

No response

@dhruvmanila dhruvmanila added bug Something isn't working red-knot Multi-file analysis & type inference labels Mar 5, 2025
@dhruvmanila dhruvmanila changed the title [red-knot] Duplicate diagnostics in unpacking assignment [red-knot] Duplicate diagnostics in unpacking targets Mar 5, 2025
@dhruvmanila dhruvmanila self-assigned this Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working red-knot Multi-file analysis & type inference
Projects
None yet
Development

No branches or pull requests

1 participant