mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-17 05:47:37 +00:00
![]() ## Summary Fixes [astral-sh/ty#1307](https://github.com/astral-sh/ty/issues/1307) Unions with length <= 5 are unaffected to minimize test churn Unions with length > 5 will only display the first 3 elements + "... omitted x union elements" Here "length" is defined as the number of elements after condensation to literals Edit: we no longer truncate in revel case. Before: > info: Attempted to call union type `(def f1() -> int) | (def f2(name: str) -> int) | (def f3(a: int, b: int) -> int) | (def f4[T](x: T@f4) -> int) | Literal[5] | (Overload[() -> None, (x: str) -> str]) | (Overload[() -> None, (x: str, y: str) -> str]) | PossiblyNotCallable` After: > info: Attempted to call union type `(def f1() -> int) | (def f2(name: str) -> int) | (def f3(a: int, b: int) -> int) | ... omitted 5 union elements` The below comparisons are outdated, but left here as a reference. Before: ```reveal_type(x) # revealed: Literal[1, 2] | A | B | C | D | E | F | G``` ```reveal_type(x) # revealed: Result1A | Result1B | Result2A | Result2B | Result3 | Result4``` After: ```reveal_type(x) # revealed: Literal[1, 2] | A | B | ... omitted 5 union elements``` ```reveal_type(x) # revealed: Result1A | Result1B | Result2A | ... omitted 3 union elements``` This formatting is consistent with `crates/ty_python_semantic/src/types/call/bind.rs` line 2992 ## Test Plan Cosmetic only, covered and verified by changes in mdtest |
||
---|---|---|
.. | ||
resources | ||
src | ||
tests | ||
build.rs | ||
Cargo.toml | ||
mdtest.py | ||
mdtest.py.lock |