mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 12:55:05 +00:00
![]() ## Summary Closes https://github.com/astral-sh/ruff/issues/15508 For any two instance types `T` and `S`, we know they are disjoint if either `T` is final and `T` is not a subclass of `S` or `S` is final and `S` is not a subclass of `T`. Correspondingly, for any two types `type[T]` and `S` where `S` is an instance type, `type[T]` can be said to be disjoint from `S` if `S` is disjoint from `U`, where `U` is the type that represents all instances of `T`'s metaclass. And a heterogeneous tuple type can be said to be disjoint from an instance type if the instance type is disjoint from `tuple` (a type representing all instances of the `tuple` class at runtime). ## Test Plan - A new mdtest added. Most of our `is_disjoint_from()` tests are not written as mdtests just yet, but it's pretty hard to test some of these edge cases from a Rust unit test! - Ran `QUICKCHECK_TESTS=1000000 cargo test --release -p red_knot_python_semantic -- --ignored types::property_tests::stable` --------- Co-authored-by: Carl Meyer <carl@astral.sh> |
||
---|---|---|
.. | ||
mdtest | ||
README.md |
Markdown files within the mdtest/
subdirectory are tests of type inference and type checking;
executed by the tests/mdtest.rs
integration test.
See crates/red_knot_test/README.md
for documentation of this test format.