astral-sh
ruff
BlogDocsChangelog

[ty] Improve typevar solving when encountering unions of generic types

#21818
Comparing
suleymanozkeskin:main
(
1b8c186
) with
main
(
ef45c97
)
CodSpeed Performance Gauge
0%
Untouched
22
Skipped
30

Benchmarks

Skipped (30)

Passed

ty_micro[complex_constrained_attributes_1]
crates/ruff_benchmark/benches/ty.rs::micro::benchmark_complex_constrained_attributes_1
CodSpeed Performance Gauge
+1%
68.1 ms67.3 ms
ty_micro[many_string_assignments]
crates/ruff_benchmark/benches/ty.rs::micro::benchmark_many_string_assignments
CodSpeed Performance Gauge
+1%
85.8 ms84.8 ms
DateType
crates/ruff_benchmark/benches/ty.rs::project::datetype::project
CodSpeed Performance Gauge
+1%
254.3 ms251.4 ms
attrs
crates/ruff_benchmark/benches/ty.rs::project::attrs::project
CodSpeed Performance Gauge
+1%
454.4 ms449.5 ms
ty_micro[complex_constrained_attributes_2]
crates/ruff_benchmark/benches/ty.rs::micro::benchmark_complex_constrained_attributes_2
CodSpeed Performance Gauge
+1%
67.7 ms67.1 ms
anyio
crates/ruff_benchmark/benches/ty.rs::project::anyio::project
CodSpeed Performance Gauge
+1%
1.4 s1.4 s
ty_micro[many_tuple_assignments]
crates/ruff_benchmark/benches/ty.rs::micro::benchmark_many_tuple_assignments
CodSpeed Performance Gauge
+1%
66.6 ms66 ms
ty_micro[many_tuple_assignments]
crates/ruff_benchmark/benches/ty.rs::micro::benchmark_tuple_implicit_instance_attributes
CodSpeed Performance Gauge
+1%
67.9 ms67.3 ms
ty_micro[complex_constrained_attributes_3]
crates/ruff_benchmark/benches/ty.rs::micro::benchmark_complex_constrained_attributes_3
CodSpeed Performance Gauge
+1%
71.7 ms71.1 ms
ty_check_file[cold]
crates/ruff_benchmark/benches/ty.rs::check_file::benchmark_cold
CodSpeed Performance Gauge
+1%
138.2 ms137.3 ms
hydra-zen
crates/ruff_benchmark/benches/ty.rs::project::hydra::project
CodSpeed Performance Gauge
+1%
1.2 s1.2 s
ty_micro[many_enum_members]
crates/ruff_benchmark/benches/ty.rs::micro::benchmark_many_enum_members
CodSpeed Performance Gauge
+1%
126.4 ms125.7 ms
ty_check_file[incremental]
crates/ruff_benchmark/benches/ty.rs::check_file::benchmark_incremental
CodSpeed Performance Gauge
0%
6.9 ms6.9 ms
medium[colour-science]
crates/ruff_benchmark/benches/ty_walltime.rs
CodSpeed Performance Gauge
0%
96.6 s96.8 s
large[sympy]
crates/ruff_benchmark/benches/ty_walltime.rs
CodSpeed Performance Gauge
0%
56 s56.2 s
small[tanjun]
crates/ruff_benchmark/benches/ty_walltime.rs
CodSpeed Performance Gauge
-1%
2.8 s2.8 s
medium[static-frame]
crates/ruff_benchmark/benches/ty_walltime.rs
CodSpeed Performance Gauge
-1%
20.3 s20.4 s
multithreaded[altair]
crates/ruff_benchmark/benches/ty_walltime.rs
CodSpeed Performance Gauge
-1%
1.6 s1.6 s
medium[pandas]
crates/ruff_benchmark/benches/ty_walltime.rs
CodSpeed Performance Gauge
-1%
69.3 s69.8 s
small[freqtrade]
crates/ruff_benchmark/benches/ty_walltime.rs
CodSpeed Performance Gauge
-1%
8.3 s8.4 s
small[altair]
crates/ruff_benchmark/benches/ty_walltime.rs
CodSpeed Performance Gauge
-1%
5.5 s5.6 s
large[pydantic]
crates/ruff_benchmark/benches/ty_walltime.rs
CodSpeed Performance Gauge
-3%
199.9 s206.9 s

Commits

Click on a commit to change the comparison range
Base
main
ef45c97
+0.15%
Fixes https://github.com/astral-sh/ty/issues/1703 Improves type inference for union types with multiple generic parameters like Ok[T] | Err[E] by adding union-pairing logic to the constraint solver. Changes: - Added union element pairing with typevar confinement checks in generics.rs - Added 3 tests to type_guards.md
1b8c186
2 hours ago
by suleymanozkeskin
© 2025 CodSpeed Technology
Home Terms Privacy Docs