-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[ty] Complete support for ParamSpec
#21445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+2,406
−435
Merged
Changes from all commits
Commits
Show all changes
79 commits
Select commit
Hold shift + click to select a range
97dd83d
Add support for `P.args` and `P.kwargs`
dhruvmanila c32615a
Avoid raising error when `P` is used in invalid context
dhruvmanila ddedf20
Small docs tweak
dhruvmanila e422952
Update `CallableType` to recode as ParamSpec value
dhruvmanila b6d20ee
Merge branch 'main' into dhruv/paramspec-args-kwargs
dhruvmanila 0f1dddc
Remove debug logs
dhruvmanila e34532c
Initial attempt to add to generic infra
dhruvmanila 46a45b7
simplify generic code
dhruvmanila 3b7cc3d
Merge branch 'main' into dhruv/paramspec-args-kwargs
dhruvmanila 336edc4
Naively apply type mapping
dhruvmanila 4697fcb
Update mdtest
dhruvmanila d0b846a
Restrict callable upcast during specialization
dhruvmanila 683e8b7
Consider `(*args: P.args, **kwargs: P.kwargs)` equivalent to `(**P)`
dhruvmanila 87cb422
Fix constraint set to represent `P1 = P2`
dhruvmanila 6270f82
Raise invalid argument type when `P.args` is matched against `P.kwargs`
dhruvmanila 06e3737
Merge branch 'main' into dhruv/paramspec-args-kwargs
dhruvmanila 8af8194
Display paramspec parameter list on single line
dhruvmanila ecb4b84
Merge two branches of callable in specialization builder
dhruvmanila 1dca873
wip
dhruvmanila 014d5bc
Merge branch 'main' into dhruv/paramspec-args-kwargs
dhruvmanila 31438c0
Fix merge errors
dhruvmanila c6e247e
Merge branch 'main' into dhruv/paramspec-args-kwargs
dhruvmanila 3680d94
Try using a sub-call to evaluate paramspec
dhruvmanila a81b550
Merge branch 'main' into dhruv/paramspec-args-kwargs
dhruvmanila 4984259
Support `ParamSpec` in explicit specialization
dhruvmanila 9032d07
Update `paramspec_value` to take parameters instead of signature
dhruvmanila b37f5ce
Correctly implement the paramspec type / value inference
dhruvmanila b051197
Avoid replacing paramspec variable itself for default type
dhruvmanila b11331f
Run pre-commit
dhruvmanila 454ce6f
Merge branch 'main' into dhruv/paramspec-args-kwargs
dhruvmanila 6fd1c21
Fix after merging latest main
dhruvmanila 0f9f117
Merge branch 'main' into dhruv/paramspec-args-kwargs
dhruvmanila f19ca40
Merge branch 'main' into dhruv/paramspec-args-kwargs
dhruvmanila c5c2e70
Remove implicit type alias TODO related to ParamSpec
dhruvmanila 2eab441
Merge branch 'main' into dhruv/paramspec-args-kwargs
dhruvmanila af5f5e7
Merge branch 'main' into dhruv/paramspec-args-kwargs
dhruvmanila 12d2fa4
Fix default specialization for paramspec
dhruvmanila 3056776
Apply type mapping for return type while specializing paramspec
dhruvmanila f1f79ba
Avoid creating union when `P` is mapped multiple times
dhruvmanila bf90833
Remove paramspec special casing
dhruvmanila 427966a
Update existing mdtest
dhruvmanila b5efe3c
Add paramspec test cases
dhruvmanila e11d8d7
Relation checks for `P.args`/`P.kwargs`
dhruvmanila a57874c
Merge branch 'main' into dhruv/paramspec-args-kwargs
dhruvmanila dfeec73
Add more assignability check
dhruvmanila 6c57028
Avoid bound typevar for an unbounded paramspec
dhruvmanila ed9b4c2
Update mdtest
dhruvmanila 75e18a4
Revert method rename
dhruvmanila 198099a
Fix fuzzer panics
dhruvmanila 106253f
Fix ide tests
dhruvmanila a67e53f
Display gradual parameters on single line
dhruvmanila 0eeb3b1
Merge branch 'main' into dhruv/paramspec-args-kwargs
dhruvmanila b358231
Correctly pass around the ParamSpec type variable
dhruvmanila 75c850c
Merge branch 'main' into dhruv/paramspec-args-kwargs
dhruvmanila 0db8bd6
Pass generic context during paramspec specialization
dhruvmanila 80b6a73
Merge branch 'main' into dhruv/paramspec-args-kwargs
dhruvmanila 86b4fe2
Merge branch 'main' into dhruv/paramspec-args-kwargs
dhruvmanila cb4aa2d
Add upper bound for `P.args` and `P.kwargs`
dhruvmanila 0a1a26d
Allow `ParamSpec` as annotation (revert)
dhruvmanila ca5ecc8
Allow passing `Any` to specialize a `ParamSpec`
dhruvmanila 4c86300
Merge branch 'main' into dhruv/paramspec-args-kwargs
dhruvmanila 6cfc7b9
Add test for operations on `P.args` / `P.kwargs`
dhruvmanila 774389b
Add tests with overloads
dhruvmanila 9767d9e
Remove leftover code from using the new solver
dhruvmanila 5c87085
Run pre-commit
dhruvmanila cd2b7a8
Merge branch 'main' into dhruv/paramspec-args-kwargs
dhruvmanila cffe40f
Address Alex's review comment on mdtests
dhruvmanila bffdffe
Address Alex's review comments on code changes
dhruvmanila d81f15d
Apply type mapping for `PartialSpecialization` as well
dhruvmanila a1749e0
Merge branch 'main' into dhruv/paramspec-args-kwargs
dhruvmanila c1ef796
Expand documentation
dhruvmanila 423fda2
Add regression test for the cycle
dhruvmanila edb26d2
Merge branch 'main' into dhruv/paramspec-args-kwargs
dhruvmanila 9a578a3
Add explanation about allowing `Any` to specialize `ParamSpec`
dhruvmanila a48ac5e
Add test cases around instance attributes and `Final`
dhruvmanila 0dc2492
Use `assert!`
dhruvmanila 7213020
Fix TODO comment
dhruvmanila 18167b1
Run pre-commit
dhruvmanila e5a4f59
Add TODO about variance
dhruvmanila File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.