[ty] Support partially specialized type context#22748
Conversation
369f185 to
1f98abe
Compare
Typing conformance resultsNo changes detected ✅ |
|
1f98abe to
5d8943e
Compare
CodSpeed Performance ReportMerging this PR will degrade performance by 6.14%Comparing Summary
Performance Changes
Footnotes
|
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
unsupported-operator |
84 | 1 | 50 |
not-subscriptable |
96 | 1 | 0 |
possibly-missing-attribute |
5 | 29 | 36 |
invalid-argument-type |
20 | 9 | 11 |
no-matching-overload |
1 | 21 | 0 |
invalid-assignment |
0 | 1 | 6 |
invalid-parameter-default |
0 | 0 | 7 |
type-assertion-failure |
0 | 2 | 3 |
invalid-return-type |
0 | 1 | 3 |
invalid-await |
0 | 2 | 0 |
invalid-key |
2 | 0 | 0 |
missing-typed-dict-key |
2 | 0 | 0 |
not-iterable |
0 | 0 | 2 |
unresolved-attribute |
0 | 0 | 2 |
unused-type-ignore-comment |
1 | 1 | 0 |
| Total | 211 | 68 | 120 |
31b6cfb to
a00f795
Compare
carljm
left a comment
There was a problem hiding this comment.
The effect on the tests here looks great!
Have you done any analysis of ecosystem hits?
I do have some questions about the approach in this PR, mentioned inline. if it's easier, we could discuss on a call tomorrow.
05523ec to
1cb2a56
Compare
92188b5 to
b8cb109
Compare
b8cb109 to
4164dfb
Compare
|
I updated the PR to use a unique marker type to represent unspecialized type variables. This should never end up in any inferred types because of the |
|
Looks like there is a performance regression across a number of projects. Have you looked into that at all? Any sense of whether it's because we get better/more types, or if there's something expensive we are doing here? |
carljm
left a comment
There was a problem hiding this comment.
Looks good! Just curious if there's any way we can reduce the perf impact.
|
colour-science and freqtrade seem to be affected by +/-5% in just about every PR I have made that touches generic call inference, I don't really understand why. I'm not sure there's much actionable here. |
Summary
We currently ignore type context that contains inferable type variables. Instead, we can specialize these to a special marker type which is ignored when inferring from the type context, while still using the rest of the type.
Part of astral-sh/ty#2521.