ruff
a928da0b - [ty] Use TDD-based narrowing constraints and support NoReturn narrowing (#23109)

Commit
2 days ago
[ty] Use TDD-based narrowing constraints and support NoReturn narrowing (#23109) Replace sorted-list-based narrowing constraints (AND-only) with TDD (Ternary Decision Diagram) nodes that support AND, OR, and NOT. This changes the merge operation from intersection to OR, so narrowing from non-terminal branches is properly preserved after if/elif/else. Additionally, when a branch contains a NoReturn call (e.g. sys.exit()), gate the narrowing constraints by the ReturnsNever predicate. During the narrowing TDD walk, non-narrowing predicates are evaluated to determine reachability, so NoReturn branches contribute Never (absorbed by union) rather than polluting the merged type. Fixes https://github.com/astral-sh/ty/issues/690 Fixes https://github.com/astral-sh/ty/issues/685 --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Author
Parents
Loading