ruff/crates/red_knot_python_semantic
Alex Waygood fbb06fe0ac
[red-knot] Small simplifications to Type::is_subtype_of and Type::is_disjoint_from (#15622)
## Summary

This PR generalizes some of the logic we have in `Type::is_subtype_of`
and `Type::is_disjoint_from` so that we fallback to the instance type of
the metaclass more often in `Type::ClassLiteral` and `Type::SubclassOf`
branches. This simplifies the code (we end up with one less branch in
`is_subtype_of`, and we can remove a helper method that's no longer
used), makes the code more robust (any fixes made to subtyping or
disjointness of instance types will automatically improve our
understanding of subtyping/disjointness for class-literal types and
`type[]` types) and more elegantly expresses the type-system invariants
encoded in these branches.

## Test Plan

No new tests added (it's a pure refactor, adding no new functionality).
All existing tests pass, however, including the property tests.
2025-01-22 00:31:55 +00:00
..
resources [red-knot] Heterogeneous tuple types with differently ordered (but equivalent) unions at the same index should be considered equivalent (#15637) 2025-01-21 12:51:20 +00:00
src [red-knot] Small simplifications to Type::is_subtype_of and Type::is_disjoint_from (#15622) 2025-01-22 00:31:55 +00:00
tests mdtest: include test name in printed rerun command (#14684) 2024-11-30 11:01:06 +00:00
build.rs Modernize build scripts (#13837) 2024-10-20 22:35:35 +01:00
Cargo.toml type: ignore[codes] and knot: ignore (#15078) 2024-12-23 10:52:43 +01:00
mdtest.py [red-knot] mdtest runner: include stderr for crashing tests (#15644) 2025-01-21 14:59:36 +00:00
mdtest.py.lock [red-knot] Markdown test runner (#15632) 2025-01-21 14:06:35 +01:00