Skip to content

Duplicate diagnostics in unpacking targets #185

@dhruvmanila

Description

@dhruvmanila

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdiagnosticsRelated to reporting of diagnostics.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions