ruff
b3ab2aa6 - [ty] Narrow walrus expression values (#26949)

Commit
90 days ago
[ty] Narrow walrus expression values (#26949) ## Summary Fixes astral-sh/ty#4020. Narrowing predicates on the right-hand side of a walrus expression were evaluated only as simple expressions, so checks such as `if result := isinstance(value, int):`, `TypeGuard`/`TypeIs` predicates, comparisons, and aliased conditions failed to narrow `value`. This recursively evaluates the walrus value as a predicate, preserves the target's truthiness constraint, and discards constraints on the rebound target and its member places. ## Test plan Added focused mdtests for `isinstance`, `TypeGuard`/`TypeIs`, equality/identity comparisons, and aliased predicates.
Author
Parents
Loading