[ty] support for typing.Concatenate#23119
[ty] support for typing.Concatenate#23119choucavalier wants to merge 1 commit intoastral-sh:mainfrom
typing.Concatenate#23119Conversation
Typing conformance results improved 🎉The percentage of diagnostics emitted that were expected errors increased from 83.87% to 84.21%. The percentage of expected errors that received a diagnostic increased from 74.82% to 75.67%. Summary
True positives addedDetails
False positives removedDetails
False positives addedDetails
|
|
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
invalid-argument-type |
219 | 114 | 8 |
missing-argument |
49 | 31 | 0 |
unresolved-attribute |
5 | 1 | 65 |
invalid-return-type |
47 | 2 | 6 |
no-matching-overload |
24 | 10 | 0 |
invalid-context-manager |
0 | 0 | 32 |
type-assertion-failure |
3 | 18 | 11 |
invalid-type-arguments |
0 | 24 | 0 |
invalid-assignment |
3 | 8 | 9 |
unused-type-ignore-comment |
0 | 17 | 0 |
too-many-positional-arguments |
4 | 0 | 0 |
unused-ignore-comment |
1 | 0 | 0 |
| Total | 355 | 225 | 131 |
2e6c807 to
f1e5800
Compare
|
@sharkdp can you re-run the workflows please 🙏 |
|
The two new false positives being added on the typing conformance suite look related to astral-sh/ty#1257. And on net this now improves our conformance score, which is great! |
|
@AlexWaygood just rebased on |
|
@dhruvmanila thanks for reviewing ❤️ let me know if you need some changes |
|
Hi! I'm not a maintainer, so take this with a grain of salt, but I independently explored The main difference in my approach was adding an enum variant on I also ran into the same regression you did, tried working around but it felt VERY monkey-patchy to me. More complete Concatenate support will eventually make it go away entirely. |
|
@Hugo-Polloli done, can you review? |
Memory usage reportSummary
Significant changesClick to expand detailed breakdownprefect
sphinx
trio
|
|
(Apologies for the delay, planning to review this tomorrow.) |
|
no worries @dhruvmanila thanks for taking the time! |
|
@dhruvmanila i just resolved the conflicts with |
|
It seems like I can't push to this branch, I'm going to re-create this PR to continue making progress on this feature. |
|
Closing this in favor of #23689 |
## Summary This PR adds a comprehensive test suite for `typing.Concatenate` in preparation for astral-sh/ty#1535 and to help the review process in #23119. ## Test Plan Run mdtest.
Summary
Implements basic
Concatenate[T, P]support in ty, replacing threetodo_type!()/Parameters::todo()stubs with real parameter extraction. This eliminates false positivemissing-argumentandinvalid-return-typeerrors when decorators useConcatenateto strip prefix parameters.Changes
type_expression.rs,builder.rs): Extract prefix types fromConcatenate[...]as positional-only parameters, with the last argument handled as either...(gradual form) or aParamSpec. Applied in bothinfer_callable_parameter_typesandinfer_paramspec_explicit_specialization_value.signatures.rs): Detect Concatenate-style parameter lists ([prefix..., *P.args, **P.kwargs]) viafind_paramspec_from_args_kwargs, match prefix types, and bind theParamSpecto remaining parameters. AddedParameters::into_gradual()for theConcatenate[T, ...]form.display.rs): Show prefix parameters in gradual Concatenate forms instead of collapsing to(...).builder.rs): Remove theCallable[<subscript>, ...]→UnknownGenericshort-circuit.Known regression
abstractclassmethod.__init__usesCallable[Concatenate[type[_T], _P], _R_co]in typeshed. With Concatenate now producing real types, this surfaces a pre-existing false positive (tracked with a TODO infinal.md).Test Plan
generics/concatenate.mdwith tests for gradual form, ParamSpec form, decorator stripping, and multiple prefix parameterscallable.md,paramspec.md,pep613_type_aliases.md, andfinal.md