Closed
Description
mypy 0.990 (python 3.8) reports an error for the following source code
def foo() -> int:
...
$ mypy foo.py
/tmp/foo.py:1: error: Missing return statement [empty-body]
Found 1 error in 1 file (checked 1 source file)
mypy 0.981 would let the same code pass. Was that an intended change in between, or a regression?
By default, mypy will generate errors when a function is missing return statements in some execution paths. The only exceptions are when:
- The function has a None or Any return type
- The function has an empty body or a body that is just ellipsis (...). Empty functions are often used for abstract methods.
I'd expect Success for the given example, because the 2nd exception ("body that is just ellipsis") applies.