-
-
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
Invalid type inference for zip in a generic class #12588
Comments
I think that this is caused by confusion between type variables of different classes ( This would probably also imply updating the type to string conversion logic to not include type variable ids (currently shown as |
FWIW, the approach I adopted in pyright for distinguishing between type variables in error messages is to use the form |
The numeric suffix has only really been useful for debugging type inference bugs by mypy developers. The |
#11657 is probably related |
#12610 looks similar too, though it involves |
This avoids confusion between type variables of two classes, which can happen at least in some edge cases. Type variables are only the same if both the numeric id and namespace match (plus meta level). Fixes #12588 (though the textual presentation of type variables doesn't take the namespace into consideration yet).
This avoids confusion between type variables of two classes, which can happen at least in some edge cases. Type variables are only the same if both the numeric id and namespace match (plus meta level). Fixes #12588 (though the textual presentation of type variables doesn't take the namespace into consideration yet).
The inferred type is wrong here, after the recent typeshed sync:
The correct type would be
Tuple[T, builtins.str]
.Here's a self-contained example that doesn't depend on typeshed:
The behavior is correct if we avoid using a self type with
__iter__
:This happens with some frequency in an internal codebase so this seems important to fix.
The text was updated successfully, but these errors were encountered: