-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[red-knot] function signature representation #14304
Conversation
|
6e23b8f
to
26afa43
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
26afa43
to
5f7d74f
Compare
5f7d74f
to
c044e84
Compare
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.