mirror of https://github.com/astral-sh/ruff
## Summary Closes https://github.com/astral-sh/ty/issues/957 As explained in https://github.com/astral-sh/ty/issues/957, literal union types for recursively defined values can be widened early to speed up the convergence of fixed-point iterations. This PR achieves this by embedding a marker in `UnionType` that distinguishes whether a value is recursively defined. This also allows us to identify values that are not recursively defined, so I've increased the limit on the number of elements in a literal union type for such values. Edit: while this PR doesn't provide the significant performance improvement initially hoped for, it does have the benefit of allowing the number of elements in a literal union to be raised above the salsa limit, and indeed mypy_primer results revealed that a literal union of 220 elements was actually being used. ## Test Plan `call/union.md` has been updated |
||
|---|---|---|
| .. | ||
| resources | ||
| src | ||
| tests | ||
| Cargo.toml | ||
| build.rs | ||
| mdtest.py | ||
| mdtest.py.lock | ||