ruff
2fd90afc - [ty] Track narrowing unions to prevent exponential blowup

Commit
34 days ago
[ty] Track narrowing unions to prevent exponential blowup When inferring a call expression with a union type context, we try narrowing to each element of the union. If nested calls have the same union as their parameter type, this would lead to exponential blowup. By tracking which unions we're already narrowing against, we skip redundant nested narrowing. On a synthetic benchmark with nested `list_schema()` calls: - 4-level nesting: >120s → 0.13s
Author
Committer
Parents
Loading