-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Fix disallow-any errors for Instance types (PEP 696) #16832
Fix disallow-any errors for Instance types (PEP 696) #16832
Conversation
This comment has been minimized.
This comment has been minimized.
2b21ed3
to
308e87a
Compare
/CC @JelleZijlstra |
@@ -315,7 +318,7 @@ def func_c3( | |||
class ClassC4(Generic[T1, Unpack[Ts1], T3]): ... | |||
|
|||
def func_c4( | |||
a: ClassC4, | |||
a: ClassC4, # E: Missing type parameters for generic type "ClassC4[()]" |
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.
Why the [()]
part?
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.
Adjusted the type formatting to better handle this case. It was just checking if the instance has a TypeVarTuple
and assumed that it's the only TypeVar -> thus printing ()
for an empty tuple.
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.
Thanks!
This comment has been minimized.
This comment has been minimized.
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
Similar to TypeAlias types
Missing type parameters for generic type
should not be emitted if too many arguments are given. There is a separate error message for that.Ref: #14851