[ty] Fix disjointness checks with type-of @final classes#21770
[ty] Fix disjointness checks with type-of @final classes#21770ibraheemdev merged 2 commits intomainfrom
@final classes#21770Conversation
964fc95 to
38334c8
Compare
Diagnostic diff on typing conformance testsNo changes detected when running ty on typing conformance tests ✅ |
1a0174d to
394be60
Compare
|
CodSpeed Performance ReportMerging #21770 will not alter performanceComparing Summary
Footnotes
|
b7a9f44 to
05560fb
Compare
| static_assert(not is_subtype_of(type[InvSub[bool]], type[InvSub[int]])) | ||
| static_assert(not is_subtype_of(type[InvSub[int]], type[InvSub[bool]])) | ||
| static_assert(is_disjoint_from(type[InvSub[int]], type[InvSub[str]])) | ||
| static_assert(not is_disjoint_from(type[InvSub[bool]], type[InvSub[int]])) |
There was a problem hiding this comment.
There are a couple false negatives here, including this one (see #21769 (comment)).
38334c8 to
8ad0e50
Compare
05560fb to
a7521b1
Compare
a7521b1 to
2b923ed
Compare
2b923ed to
7dfe6e0
Compare
|
Oh, it looks like you're solving some some tests with TODOs that I added earlier today (astral-sh/ty#1842) |
6e8ce19 to
e4e1ff2
Compare
|
@sharkdp I think I've fixed those by delegating to the default specialization, now that we have an implementation for disjointness between generic aliases. |
…-cycle * origin/main: [ty] Support implicit type of `cls` in signatures (#21771) [ty] add `SyntheticTypedDictType` and implement `normalized` and `is_equivalent_to` (#21784) [ty] Fix disjointness checks with type-of `@final` classes (#21770) [ty] Fix negation upper bounds in constraint sets (#21897)
Summary
We currently perform a subtyping check, similar to what we were doing for
@finalinstances before #21167, which is incorrect, e.g. we currently considertype[X[Any]]andtype[X[T]]]disjoint (whereXis@final).Stacked on #21769.