-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrongtopic-match-statementPython 3.10's match statementPython 3.10's match statement
Description
Bug Report
mypy reports a missing return statement despite all cases of a Python 3.10 match statement return something.
To Reproduce
Try this piece of code:
def token_is_start_of_value(self) -> bool:
"""Check whether the current token is the start of a value.
Returns:
bool: True if the current token is the start of a value.
"""
match self.token_type:
case TokenType.DELIMITER if self.token in ("[", "{"):
return True
case TokenType.STRING | TokenType.NUMBER | TokenType.SYMBOL:
return True
case _:
return False
Expected Behavior
mypy should not report a missing return statement.
Actual Behavior
mypy reports a missing return statement, see here:
Your Environment
- Mypy version used: current master (0.940+dev.99f4d5af147d364eda1d4b99e79770c171896f13 99f4d5a)
- Mypy command-line flags:
- Mypy configuration options from
mypy.ini
(and other config files): - Python version used: Python 3.10.1
- Operating system and version: macOS Monterey 12.0.1 (21A559)
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongtopic-match-statementPython 3.10's match statementPython 3.10's match statement