-
Notifications
You must be signed in to change notification settings - Fork 35
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
Support overloaded functions #182
Comments
#317 adds an internal
|
More notes:
|
#321 improved the overload matching algorithm to one I'm happy with. Remaining work:
|
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Pyanalyze currently doesn't support overloaded functions at all. It should. Some thoughts in no particular order:
pyanalyze.extensions.overload
decorator that somehow does register the overloads at runtime. It could be an alias offrom typing import overload
underif TYPE_CHECKING
for compatibility with other type checkers. We could add an@overload_implementation
decorator that collects the other overloads and stores them in the function dict or something.implementation.py
. It might require changes to typeshed-client though.pyanalyze.signature.Signature
. It would hold all of the overloaded signatures in an attribute.I would want this to return
Literal[1, 2]
, but naively looping over the overloads would not work for that; it would require special handling for Union. Interestingly, though, TypeScript doesn't let you do this. You have to write a separate overload for the Union instead.list.append
etc.), for which there are currently complicated impl functions. These overloads would require being able to dispatch on whether a value is annotated with WeakExtension.The text was updated successfully, but these errors were encountered: