mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 13:51:37 +00:00
![]() ## Summary This PR adds more features to #16468. * Adds a new error rule `invalid-type-checking-constant`, which occurs when we try to assign a value other than `False` to a user-defined `TYPE_CHECKING` variable (it is possible to assign `...` in a stub file). * Allows annotated assignment to `TYPE_CHECKING`. Only types that `False` can be assigned to are allowed. However, the type of `TYPE_CHECKING` will be inferred to be `Literal[True]` regardless of what the type is specified. ## Test plan I ran the tests with `cargo test -p red_knot_python_semantic` and confirmed that all tests passed. --------- 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.