ruff
f463fa7b - [red-knot] Narrowing For Truthiness Checks (`if x` or `if not x`) (#14687)

Commit
357 days ago
[red-knot] Narrowing For Truthiness Checks (`if x` or `if not x`) (#14687) ## Summary Fixes #14550. Add `AlwaysTruthy` and `AlwaysFalsy` types, representing the set of objects whose `__bool__` method can only ever return `True` or `False`, respectively, and narrow `if x` and `if not x` accordingly. ## Test Plan - New Markdown test for truthiness narrowing `narrow/truthiness.md` - unit tests in `types.rs` and `builders.rs` (`cargo test --package red_knot_python_semantic --lib -- types`)
Author
Parents
Loading