[ty] Simple subtyping support for bidirectional inference#21747
Closed
ibraheemdev wants to merge 7 commits intomainfrom
Closed
[ty] Simple subtyping support for bidirectional inference#21747ibraheemdev wants to merge 7 commits intomainfrom
ibraheemdev wants to merge 7 commits intomainfrom
Conversation
51d8ef8 to
0e577a3
Compare
Diagnostic diff on typing conformance testsChanges were detected when running ty on typing conformance tests--- old-output.txt 2025-12-11 15:23:42.591717927 +0000
+++ new-output.txt 2025-12-11 15:23:46.361715453 +0000
@@ -808,7 +808,7 @@
overloads_evaluation.py:291:33: error[invalid-return-type] Function always implicitly returns `None`, which is not assignable to return type `T@example6`
protocols_class_objects.py:58:16: error[invalid-assignment] Object of type `<class 'ConcreteA'>` is not assignable to `ProtoA1`
protocols_class_objects.py:59:16: error[invalid-assignment] Object of type `<class 'ConcreteA'>` is not assignable to `ProtoA2`
-protocols_definition.py:30:11: error[invalid-argument-type] Argument to function `close_all` is incorrect: Expected `Iterable[SupportsClose]`, found `list[Unknown | int]`
+protocols_definition.py:30:11: error[invalid-argument-type] Argument to function `close_all` is incorrect: Expected `Iterable[SupportsClose]`, found `list[SupportsClose | int]`
protocols_definition.py:114:22: error[invalid-assignment] Object of type `Concrete2_Bad1` is not assignable to `Template2`
protocols_definition.py:115:22: error[invalid-assignment] Object of type `Concrete2_Bad2` is not assignable to `Template2`
protocols_definition.py:116:22: error[invalid-assignment] Object of type `Concrete2_Bad3` is not assignable to `Template2`
|
|
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
invalid-argument-type |
41 | 71 | 164 |
type-assertion-failure |
53 | 17 | 131 |
invalid-assignment |
5 | 27 | 58 |
unused-ignore-comment |
20 | 16 | 0 |
invalid-return-type |
1 | 4 | 11 |
possibly-missing-attribute |
2 | 11 | 2 |
no-matching-overload |
11 | 3 | 0 |
unresolved-attribute |
14 | 0 | 0 |
non-subscriptable |
8 | 4 | 0 |
not-iterable |
0 | 2 | 0 |
unsupported-operator |
0 | 0 | 2 |
| Total | 155 | 155 | 368 |
ibraheemdev
commented
Dec 2, 2025
crates/ty_python_semantic/resources/mdtest/type_compendium/tuple.md
Outdated
Show resolved
Hide resolved
CodSpeed Performance ReportMerging #21747 will degrade performances by 7.08%Comparing Summary
Benchmarks breakdown
Footnotes
|
ibraheemdev
commented
Dec 2, 2025
ceff10e to
83ba34d
Compare
83ba34d to
19c5cd8
Compare
AlexWaygood
approved these changes
Dec 2, 2025
crates/ty_python_semantic/resources/mdtest/dataclasses/fields.md
Outdated
Show resolved
Hide resolved
Member
|
(this will also help with #21499, where I'm currently trying (not very successfully) to do some awkward workarounds due to this missing feature 😆) |
57cc640 to
531ca7e
Compare
AlexWaygood
approved these changes
Dec 11, 2025
Member
Author
|
Closing in favor of #21930. |
ibraheemdev
added a commit
that referenced
this pull request
Dec 30, 2025
## Summary Supersedes #21747. This version uses the constraint solver directly, which means we should benefit from constraint solver improvements for free. Resolves astral-sh/ty#1576.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This solves most of astral-sh/ty#1576. More advanced cases likely require the new constraint solver.