[red-knot] function signature representation#14304
Merged
Conversation
Contributor
|
6e23b8f to
26afa43
Compare
MichaReiser
approved these changes
Nov 13, 2024
Member
MichaReiser
left a comment
There was a problem hiding this comment.
Looks good. My main feedback is whether its worth having separate fields for the different parameter kinds or if we instead want to store all parameters in a single slice and only distinguish them by a kind (which I think is what pyright does and we at least considered for the AST because concatenating parameters and always remembering the right order is awkward)
AlexWaygood
approved these changes
Nov 13, 2024
26afa43 to
5f7d74f
Compare
5f7d74f to
c044e84
Compare
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
Add a typed representation of function signatures (parameters and return type) and infer it correctly from a function.
Convert existing usage of function return types to use the signature representation.
This does not yet add inferred types for parameters within function body scopes based on the annotations, but it should be easy to add as a next step.
Part of #14161 and #13693.
Test Plan
Added tests.