Skip to content

Fix duplicate unpack diagnostics#14125

Merged
MichaReiser merged 2 commits intomainfrom
micha/fix-unpack-duplicate-diagnostics
Nov 6, 2024
Merged

Fix duplicate unpack diagnostics#14125
MichaReiser merged 2 commits intomainfrom
micha/fix-unpack-duplicate-diagnostics

Conversation

@MichaReiser
Copy link
Member

@MichaReiser MichaReiser commented Nov 6, 2024

Summary

Fixes the issue where we emitted duplicated diagnostics for unpack assignments.

The solution is fairly simple. All we need is a deterministic way to know when we should add the
diagnostics. The approach I used here is only to add the diagnostics for the first unpacking.

This works because check_types pulls all types.

What about accumulators. We may still want to use accumulators in the future, e.g. if other, non type checking queries start emitting diagnostics. However, we have to solve the performance regression first. I have an idea on how that could be done. See the zulip discussion

Test Plan

See updated mdtest

@MichaReiser MichaReiser added the ty Multi-file analysis & type inference label Nov 6, 2024
@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Nice!

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
@MichaReiser MichaReiser enabled auto-merge (squash) November 6, 2024 11:24
@MichaReiser MichaReiser merged commit 31681f6 into main Nov 6, 2024
@MichaReiser MichaReiser deleted the micha/fix-unpack-duplicate-diagnostics branch November 6, 2024 11:28
@dhruvmanila dhruvmanila linked an issue Dec 17, 2024 that may be closed by this pull request
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[red-knot] Follow-up from unpacked tuple assignment work

3 participants