I have the following in test.py:
def f(x: int) -> float:
pass
if __name__=="__main__":
f(4)
When I run mypy --strict test.py, I get no errors.
I expected mypy would be able to infer that there is a problem with my definition f. It obviously has no return statement and can never return a float.
I feel like there is something fundamental which I do not understand here. The presence (or not) of a return statement is something that can be checked statically. Why does mypy miss it?