ruff
fce9727c - [ty] Fix panic from mismatched OR-pattern bindings (#27533)

Commit
61 days ago
[ty] Fix panic from mismatched OR-pattern bindings (#27533) ## Summary https://github.com/astral-sh/ruff/pull/27438 modeled OR-pattern alternatives as distinct control-flow paths rather than linear control flow. This is correct, but the implementation was inadequate; it effectively treated all of these branches simultaneously as "definitely taken", which becomes a problem in the (invalid syntax) case where not all branches bind the same name(s). That caused a panic. Fix this by introducing reachability predicates to explicitly model that only one of these "branches" can be taken. Closes astral-sh/ty#4194. ## Test plan Added mdtests covering distinct and overlapping captures, alternatives without bindings in either order, three-way alternatives, previously bound names, nested mismatches, guard references, and the original malformed-case panic.
Author
Parents
Loading