ruff
fbb06fe0 - [red-knot] Small simplifications to `Type::is_subtype_of` and `Type::is_disjoint_from` (#15622)

Commit
241 days ago
[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.
Author
Parents
Loading