Skip to content

Conversation

AlexWaygood
Copy link
Member

Summary

Even disambiguating classes using their fully qualified names is not enough for some diagnostics. We've seen real-world examples in the ecosystem (and #20368 introduces some more!) where two types can be different, but can still have the same fully qualified name. In these cases, our disambiguation machinery needs to print the file path and line number of the class in order to disambiguate classes with similar names in our diagnostics.

Helps with astral-sh/ty#1306

Test Plan

Mdtests

@AlexWaygood AlexWaygood added ty Multi-file analysis & type inference diagnostics Related to reporting of diagnostics. labels Oct 7, 2025
Copy link
Contributor

github-actions bot commented Oct 7, 2025

Diagnostic diff on typing conformance tests

No changes detected when running ty on typing conformance tests ✅

Copy link
Contributor

github-actions bot commented Oct 7, 2025

mypy_primer results

Changes were detected when running on open source projects
bokeh (https://github.com/bokeh/bokeh)
- src/bokeh/model/model.py:496:16: error[invalid-return-type] Return type does not match returned value: expected `set[bokeh.model.model.Model]`, found `set[bokeh.model.model.Model]`
+ src/bokeh/model/model.py:496:16: error[invalid-return-type] Return type does not match returned value: expected `set[bokeh.model.model.Model @ src/bokeh/model/model.py:79]`, found `set[bokeh.model.model.Model @ src/bokeh/model/model.pyi:40]`
No memory usage changes detected ✅

Copy link
Contributor

github-actions bot commented Oct 8, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

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

Lovely :)

@sharkdp sharkdp removed their request for review October 8, 2025 06:55
@AlexWaygood AlexWaygood force-pushed the alex/even-more-class-disambiguation branch from 6f16583 to fbb9309 Compare October 8, 2025 12:35
@AlexWaygood AlexWaygood merged commit b9c84ad into main Oct 8, 2025
39 checks passed
@AlexWaygood AlexWaygood deleted the alex/even-more-class-disambiguation branch October 8, 2025 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

diagnostics Related to reporting of diagnostics. ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants