Douglas Creager
d5089ccd4d
estimate size of distributed upper bound
2026-01-08 09:30:43 -05:00
Douglas Creager
1c247af1cf
don't hard-code the threshold
2026-01-08 09:00:18 -05:00
Douglas Creager
f735222ed6
punt on very large union upper bounds for now
2026-01-07 11:34:26 -05:00
Douglas Creager
f1188c74b1
fix merge conflicts
2026-01-06 21:19:19 -05:00
Douglas Creager
e5533da00f
prune types when intersecting into upper bound
2026-01-06 20:59:41 -05:00
Carl Meyer
f97da18267
[ty] improve typevar solving from constraint sets ( #22411 )
...
## Summary
Fixes https://github.com/astral-sh/ty/issues/2292
When solving a bounded typevar, we preferred the upper bound over the
actual type seen in the call. This change fixes that.
## Test Plan
Added mdtest, existing tests pass.
2026-01-06 13:10:51 -08:00
Alex Waygood
bc191f59b9
Convert more ty snapshots to the new format ( #22424 )
2026-01-06 20:01:41 +00:00
Alex Waygood
2ec29b7418
[ty] Optimize Type::negate() ( #22402 )
2026-01-06 19:17:59 +00:00
Jack O'Connor
ab1ac254d9
[ty] fix comparisons and arithmetic with NewTypes of float ( #22105 )
...
Fixes https://github.com/astral-sh/ty/issues/2077 .
2026-01-06 09:32:22 -08:00
Charlie Marsh
01de8bef3e
[ty] Add named fields for Place enum ( #22172 )
...
## Summary
Mechanical refactor to migrate this enum to named fields. No functional
changes.
See:
https://github.com/astral-sh/ruff/pull/22093#discussion_r2636050127 .
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com >
2026-01-06 17:24:51 +00:00
Charlie Marsh
b59f6eb5e9
[ty] Support comparisons between variable-length tuples ( #21824 )
...
## Summary
Closes https://github.com/astral-sh/ty/issues/1741 .
2026-01-06 12:09:40 -05:00
Charlie Marsh
d65542c05e
[ty] Make tuple intersection a fallible operation ( #22094 )
...
## Summary
This PR attempts to address a TODO in
https://github.com/astral-sh/ruff/pull/21965#discussion_r2635378498 .
2026-01-06 10:47:04 -05:00
Charlie Marsh
8b8b174e4f
[ty] Add a diagnostic for @functools.total_ordering without a defined comparison method ( #22183 )
...
## Summary
This raises a `ValueError` at runtime:
```python
from functools import total_ordering
@total_ordering
class NoOrdering:
def __eq__(self, other: object) -> bool:
return True
```
Specifically:
```
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/functools.py", line 193, in total_ordering
raise ValueError('must define at least one ordering operation: < > <= >=')
ValueError: must define at least one ordering operation: < > <= >=
```
See: https://github.com/astral-sh/ty/issues/1202 .
2026-01-06 04:14:06 +00:00
Charlie Marsh
28fa02129b
[ty] Add support for @total_ordering ( #22181 )
...
## Summary
We have some suppressions in the pyx codebase related to this, so wanted
to resolve.
Closes https://github.com/astral-sh/ty/issues/1202 .
2026-01-05 22:47:03 -05:00
Douglas Creager
138bf79857
paramspec args/kwargs don't have a bound
2026-01-05 21:24:51 -05:00
Douglas Creager
e39f4654cb
materialize the bounds too
2026-01-05 21:13:26 -05:00
Douglas Creager
2c95befaff
clippy
2026-01-05 21:13:26 -05:00
Douglas Creager
61aafffab5
prefer informative upper bound again
2026-01-05 21:13:26 -05:00
Douglas Creager
47840fdd0c
constrain with bounds/constraints as post-processing step
2026-01-05 21:13:26 -05:00
Jack O'Connor
922d964bcb
[ty] emit diagnostics for method definitions and other invalid statements in TypedDict class bodies ( #22351 )
...
Fixes https://github.com/astral-sh/ty/issues/2277 .
2026-01-05 11:28:04 -08:00
Douglas Creager
acd1e6c466
don't overwrite source_order
2026-01-05 13:52:11 -05:00
Douglas Creager
9ca1207667
no duplicate errors anymore
2026-01-05 13:52:11 -05:00
Douglas Creager
83378f01b1
only error when there are typevars
2026-01-05 13:52:10 -05:00
Douglas Creager
be4e7e773d
check protocols nominally, too
2026-01-05 13:52:10 -05:00
Douglas Creager
6df88e8fd2
fix test expectations and TODOs
2026-01-05 13:52:07 -05:00
Douglas Creager
8888c3ce1d
add todos
2026-01-05 13:41:45 -05:00
Douglas Creager
b6ca2d9050
error message
2026-01-05 13:41:45 -05:00
Douglas Creager
2fa8636a2e
make these tests consistent
2026-01-05 13:41:45 -05:00
Douglas Creager
c8664f68bb
add TODO for Never/Unknown
2026-01-05 13:41:45 -05:00
Douglas Creager
4ff828d996
these are legit
2026-01-05 13:41:45 -05:00
Douglas Creager
517566a8ca
use csa for instance checks
2026-01-05 13:41:45 -05:00
Jack O'Connor
4712503c6d
[ty] cargo insta test --force-update-snapshots ( #22313 )
...
Snapshot tests recently started reporting this warning:
> Snapshot test passes but the existing value is in a legacy format.
> Please run cargo insta test --force-update-snapshots to update to a
> newer format.
This PR is the result of that forced update.
One file (crates/ruff_db/src/diagnostic/render/full.rs) seems to get
corrupted, because it contains strings with unprintable characters that
trigger some bug in cargo-insta. I've manually reverted that file, and
also manually reverted the `input_file:` lines, which we like.
2026-01-05 07:55:47 -08:00
Alex Waygood
f3dea6e5c9
[ty] Optimize IntersectionType for the common case of a single negated element ( #22344 )
...
Co-authored-by: Micha Reiser <micha@reiser.io >
2026-01-05 13:41:50 +00:00
Micha Reiser
24dd149e03
[ty] Extract relation module from types.rs ( #22232 )
2026-01-05 13:16:49 +00:00
Alex Waygood
b8d527ff46
[ty] Optimize and simplify UnionElement::try_reduce ( #22339 )
2026-01-05 12:54:44 +00:00
Charlie Marsh
92a2f2c992
[ty] Apply class decorators via try_call() ( #22375 )
...
## Summary
Decorators are now called with the class as an argument, and the return
type becomes the class's type. This mirrors how function decorators
already work.
Closes https://github.com/astral-sh/ty/issues/2313 .
2026-01-04 17:11:00 -05:00
Micha Reiser
b85c0190c5
[ty] Use upstream GetSize implementation for OrderMap and OrderSet ( #22374 )
2026-01-04 19:54:03 +00:00
Micha Reiser
46a4bfc478
[ty] Use default HashSet for TypeCollector ( #22368 )
2026-01-04 18:58:30 +00:00
Alex Waygood
e1439beab2
[ty] Use UnionType helper methods more consistently ( #22357 )
2026-01-03 14:19:06 +00:00
Felix Scherz
fd86e699b5
[ty] narrow TypedDict unions with not in ( #22349 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com >
2026-01-03 13:12:57 +00:00
Alex Waygood
10a417aaf6
[ty] Specify heap_size for SynthesizedTypedDictType ( #22345 )
2026-01-02 20:09:35 +00:00
Matthew Mckee
a2e0ff57c3
Run cargo sort ( #22310 )
2026-01-02 19:58:15 +00:00
Alex Waygood
26230b1ed3
[ty] Use IntersectionType::from_elements more ( #22329 )
2026-01-01 15:01:00 +00:00
github-actions[bot]
8e45bac3c1
[ty] Sync vendored typeshed stubs ( #22321 )
...
Co-authored-by: typeshedbot <>
Co-authored-by: Alex Waygood <alex.waygood@gmail.com >
2026-01-01 01:29:12 +00:00
Charlie Marsh
f619783066
[ty] Treat __setattr__ as fallback-only ( #22014 )
...
## Summary
Closes https://github.com/astral-sh/ty/issues/1460 .
2025-12-30 19:01:10 -05:00
Ibraheem Ahmed
ff05428ce6
[ty] Subtyping for bidirectional inference ( #21930 )
...
## Summary
Supersedes https://github.com/astral-sh/ruff/pull/21747 . This version
uses the constraint solver directly, which means we should benefit from
constraint solver improvements for free.
Resolves https://github.com/astral-sh/ty/issues/1576 .
2025-12-30 17:03:20 -05:00
Charlie Marsh
12dd27da52
[ty] Support narrowing for tuple matches with literal elements ( #22303 )
...
## Summary
See:
https://github.com/astral-sh/ruff/pull/22299#issuecomment-3699913849 .
2025-12-30 13:45:07 -05:00
github-actions[bot]
7173c7ea3f
[ty] Sync vendored typeshed stubs ( #22302 )
...
Co-authored-by: typeshedbot <>
Co-authored-by: Alex Waygood <alex.waygood@gmail.com >
2025-12-30 17:24:13 +00:00
Charlie Marsh
57218753be
[ty] Narrow TypedDict literal access in match statements ( #22299 )
...
## Summary
Closes https://github.com/astral-sh/ty/issues/2279 .
2025-12-30 11:29:09 -05:00
RasmusNygren
0edd97dd41
[ty] Add autocomplete suggestions for class arguments ( #22110 )
2025-12-30 13:10:56 +00:00