[ty] Consolidate retained narrowing constraints by charliermarsh · Pull Request #25660 · astral-sh/ruff (original) (raw)

Summary

Reachability always requests both positive and negative narrowing constraints for an expression predicate. We currently retain each polarity in a separate Salsa query, even though both queries load the same expression and traverse the same predicate.

This change computes both polarities in one tracked query and returns the pair together to reachability. The positive and negative constraints remain separate, but we avoid retaining duplicate query metadata and arguments.