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 |
||
|---|---|---|
| .. | ||
| annotation.md | ||
| builtins.md | ||
| callable_instance.md | ||
| callables_as_descriptors.md | ||
| constructor.md | ||
| dunder.md | ||
| dunder_import.md | ||
| function.md | ||
| getattr_static.md | ||
| invalid_syntax.md | ||
| methods.md | ||
| never.md | ||
| open.md | ||
| overloads.md | ||
| replace.md | ||
| str_startswith.md | ||
| subclass_of.md | ||
| union.md | ||