[ty] Rewrite equality-based narrowing logic
by AlexWaygood
·
Feb 06, 2026 at 19:14 UTC
·
scan-3457da71d969ad19
Get this automatically on every PR
Install the Axiomo GitHub App to get Signals as check runs and PR comments on every pull request.
Risk level: Critical (80%)
Rewrite equality-based narrowing logic in type inference.
Reduced lines in narrow.rs (+25/-137).
New file src/types/equality.rs added with 859 lines.
Issue 2732 mentioned, but no specific references in the diff.
Issue 1454 mentioned, but no specific references in the diff.
Tests failing are noted in the PR description.
Trusted contributor with 907 merged PRs. maintains 69 public repositories. has 506 followers. unfamiliar with 4 files being modified.
Focus on 1 critical file(s)
crates/ty_python_semantic/src/types/equality.rs
+859
859 lines changed; New file; Source code
crates/ty_python_semantic/src/types/narrow.rs
+162
162 lines changed; Source code
crates/ty_python_semantic/src/types.rs
+12
Source code
crates/ty_python_semantic/src/types/enums.rs
+2
Source code
crates/ty_python_semantic/resources/mdtest/narrow/conditionals/eq.md
+48
Standard file
crates/ty_python_semantic/resources/mdtest/narrow/conditionals/elif_else.md
+8
Standard file
crates/ty_python_semantic/resources/mdtest/narrow/conditionals/nested.md
+8
Standard file
crates/ty_python_semantic/resources/mdtest/narrow/match.md
+6
Standard file
129
minutes to review
extensive
effort level
none
staleness risk
Schedule dedicated review time; consider pair review
Critical risk level requires changes before approval
Consider breaking into smaller PRs
Why is lint_passing missing? Consider adding this check.
Why is security_scan_clean missing? Consider adding this check.
crates/ty_python_semantic/src/types/equality.rs
Critical file: 859 lines changed; New file; Source code