ruff
a8fe5660 - [ty] Propagate deletions through nested loop headers (#28044)

Commit
13 days ago
[ty] Propagate deletions through nested loop headers (#28044) An inner loop can delete a variable on one iteration and then exit through `break` on a later iteration. The variable can remain unbound after the inner loop and on subsequent outer iterations, but ty did not propagate deletions carried by nested loop headers into the enclosing loop's boundness analysis. Include nested headers' deletion reachability when computing an enclosing header's reachability. Keep the loop-back bindings intact for type inference, and memoize the structural traversal used during Salsa cycle initialization so shared descendant headers are only visited once. Related to #28009. ## Test plan - Add `while` and `for` mdtests for deletions that survive an inner-loop iteration and a later `break`, including an explicit `continue` and a `for`-`else` that returns. - Verify that reassignment after the inner loop restores boundness on subsequent outer iterations. - Verify that statically unreachable deletions preserve boundness and literal types through several nested loops.
Author
Parents
Loading