Skip to content

Comments

[ty] Fix is_disjoint_from with @final classes#21167

Merged
ibraheemdev merged 1 commit intomainfrom
ibraheem/disjoint-final
Oct 31, 2025
Merged

[ty] Fix is_disjoint_from with @final classes#21167
ibraheemdev merged 1 commit intomainfrom
ibraheem/disjoint-final

Conversation

@ibraheemdev
Copy link
Member

@ibraheemdev ibraheemdev commented Oct 31, 2025

Summary

We currently perform a subtyping check instead of the intended subclass check (and the subtyping check is confusingly named is_subclass_of). This showed up in #21070.

@ibraheemdev ibraheemdev added the ty Multi-file analysis & type inference label Oct 31, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 31, 2025

Diagnostic diff on typing conformance tests

No changes detected when running ty on typing conformance tests ✅

@github-actions
Copy link
Contributor

github-actions bot commented Oct 31, 2025

mypy_primer results

No ecosystem changes detected ✅
No memory usage changes detected ✅

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.

Thanks!

@ibraheemdev ibraheemdev force-pushed the ibraheem/disjoint-final branch from 4c4587d to 7a40153 Compare October 31, 2025 14:45
@ibraheemdev ibraheemdev enabled auto-merge (squash) October 31, 2025 14:46
@ibraheemdev ibraheemdev merged commit 1baf98a into main Oct 31, 2025
40 checks passed
@ibraheemdev ibraheemdev deleted the ibraheem/disjoint-final branch October 31, 2025 14:50
ibraheemdev added a commit that referenced this pull request Dec 10, 2025
## Summary

This was left unfinished in
#21167. This is required to fix
our disjointness checks with type-of a final class, which is currently
broken, and blocking astral-sh/ty#159.
ibraheemdev added a commit that referenced this pull request Dec 10, 2025
## Summary

We currently perform a subtyping check, similar to what we were doing
for `@final` instances before
#21167, which is incorrect, e.g.
we currently consider `type[X[Any]]` and `type[X[T]]]` disjoint (where
`X` is `@final`).
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.

2 participants