Bug Report
Static methods decorated with staticmethod that return None do not result in a [func-returns-value] error being reported.
To Reproduce
https://mypy-play.net/?mypy=latest&python=3.11&gist=519f480fe4f8840e0043c2555f951f2f
class Example:
def no_op0(self) -> None:
return None
@staticmethod
def no_op0s() -> None:
return None
def no_op1(self) -> None:
return
@staticmethod
def no_op1s() -> None:
return
ex = Example()
# error: "no_op0" of "Example" does not return a value [func-returns-value]
assert ex.no_op0() is None
# Decorated version is fine
assert ex.no_op0s() is None
# error: "no_op1" of "Example" does not return a value [func-returns-value]
assert ex.no_op1() is None
# Decorated version is fine
assert ex.no_op1s() is None
Expected Behavior
A static method is just another callable and it makes sense for the behavior of the [func-returns-value] error to be the same for it as for other callables.
Actual Behavior
The behavior of the [func-returns-value] error for decorated static methods is different from that for other callables. No error is reported.
Your Environment
- Mypy version used: 0.991
- Mypy command-line flags: None
- Mypy configuration options from
mypy.ini (and other config files): None
- Python version used: 3.11
Bug Report
Static methods decorated with
staticmethodthat returnNonedo not result in a[func-returns-value]error being reported.To Reproduce
https://mypy-play.net/?mypy=latest&python=3.11&gist=519f480fe4f8840e0043c2555f951f2f
Expected Behavior
A static method is just another callable and it makes sense for the behavior of the
[func-returns-value]error to be the same for it as for other callables.Actual Behavior
The behavior of the
[func-returns-value]error for decorated static methods is different from that for other callables. No error is reported.Your Environment
mypy.ini(and other config files): None