-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Description
It seems when you have assert False, the rest of the function isn't checked.
x = 0
def foo_bad1(): # type: () -> str
assert False
return x
def foo_good(): # type: () -> str
assert x
return x
def foo_bad2(): # type: () -> str
assert 0
return x- What is the actual behavior/output?
$ mypy foo2.py
foo2.py:7: error: Incompatible return value type (got "int", expected "str")
- What is the behavior/output you expect?
$ mypy foo2.py
foo2.py:4: error: Incompatible return value type (got "int", expected "str")
foo2.py:7: error: Incompatible return value type (got "int", expected "str")
foo2.py:10: error: Incompatible return value type (got "int", expected "str")
-
What are the versions of mypy and Python you are using?
I tried with mypy 0.501, all the way up to 0.720, and also from git master.
python 3.7.4 from Fedora 30. -
What are the mypy flags you are using? (For example --strict-optional)
none
Metadata
Metadata
Assignees
Labels
No labels