Repository navigation
Conversation
|
Diff from mypy_primer, showing the effect of this PR on open source code: steam.py (https://github.com/Gobot1234/steam.py)
+ steam/abc.py:217: error: Need type annotation for "comments" [var-annotated]
|
The primer issue is expected. |
|
Unsolicited opinion: I don't really like this. If someone removes anything but the last typevar, then this might cause more errors (because the typevars are now mis-ordered, meaning that specific actions get the wrong types meaning more errors for valid code, where the only error would be the typevars). On the other hand, although typevars aren't always removed from the end (at least I see no reason why they would be), typevars are normally added to the end IMO. Maybe that specifically could be special cased for better errors? |
|
There hasn't been much interest in this change. Going to close the PR. |
Fill invalid generic instances with existing args if possible instead of adding
Anyfor TypeVar. This matches the pyright behavior. There is already an error for the invalid arg count. By reusing the existing args, mypy can at least provide some type checking. That's especially useful if a TypeVar is removed from a class and now there is one to many.