-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Type variables of generic returned Protocol
s not resolved/leaking
#1720
Comments
Type variables in the Python type system have well-defined scopes, and they must be resolved within those scopes. The expression I'll note that mypy issues the same errors in this instance. While I was able to justify adding special-case logic for a |
Continuation of #1703
As mentioned in the above issue, the fix for
Callable
s works flawlessly.The issue with unresolved type variables still surfaces when using subclasses of
Protocol
to describe function types.Motivation
I am using
Protocol
s to be able to give a name to an overloaded function type.In my use case, I'm trying to annotate a function that returns a
Protocol
with an overloaded generic__call__
method.Minimal reproducible example
Actual behavior
Expected behavior
The provided code should typecheck without issues.
Even when
ArityOne
's__call__
method is@overload
ed.The text was updated successfully, but these errors were encountered: