ruff/crates/red_knot_python_semantic
Carl Meyer ac31b26a0e
[red-knot] type[] is disjoint from None, LiteralString (#14967)
## Summary

Teach red-knot that `type[...]` is always disjoint from `None` and from
`LiteralString`. Fixes #14925.

This should properly be generalized to "all instances of final types
which are not subclasses of `type`", but until we support finality,
hardcoding `None` (which is known to be final) allows us to fix the
subtype transitivity property test.

## Test Plan

Existing tests pass, added new unit tests for `is_disjoint_from` and
`is_subtype_of`.

`QUICKCHECK_TESTS=100000 cargo test -p red_knot_python_semantic --
--ignored types::property_tests::stable` fails only the "assignability
is reflexive" test, which is known to fail on `main` (#14899).

The same command, with `property_tests.rs` edited to prevent generating
intersection tests (the cause of #14899), passes all quickcheck tests.
2024-12-14 11:02:49 +01:00
..
resources [red-knot] Use type[Unknown] rather than Unknown as the fallback metaclass for invalid classes (#14961) 2024-12-13 19:48:51 +00:00
src [red-knot] type[] is disjoint from None, LiteralString (#14967) 2024-12-14 11:02:49 +01: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 Add tracing support to mdtest (#14935) 2024-12-13 09:10:01 +00:00