Improve error messages for `super` checks and add more tests by sobolevn · Pull Request #16393 · python/mypy
| @staticmethod | ||
| def st() -> int: | ||
| reveal_type(super(B, B).st()) # N: Revealed type is "builtins.int" | ||
| super().st() # E: "super" requires one or more positional arguments in enclosing function |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here again, it's specifically the zero-argument form of super() that we're complaining about (the reveal_type() call in the line immediately above this one works fine for the two-argument form of super()). So I'd keep the () here as well, personally
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And it should be "one or two" not "one or more" 👍
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters