ruff
ab1e16d2 - [ty] Preserve short-circuit bindings in all condition consumers (#25160)

Commit
12 days ago
[ty] Preserve short-circuit bindings in all condition consumers (#25160) ## Summary We already compute precise truthy and falsy flow snapshots for short-circuiting boolean expressions, so walrus bindings are only visible on paths where the right-hand side actually ran. Prior to this change, we mostly used those snapshots for `if` conditions, and not (e.g.) in the following case: ```python def f(flag: bool): assert flag and (x := 1) reveal_type(x) ``` This PR generalizes that logic into condition-flow snapshots and applies it anywhere we evaluate a condition before continuing under its truthy or falsy outcome: `assert`, `while`, `match` guards, conditional expressions, and comprehension filters.
Author
Parents
Loading