Closed
Description
While working on HypothesisWorks/hypothesis#858, I've found that decorated functions are mis-detected as already defined in another branch, if either both functions or only the second are decorated. I've simplified this to the following example:
def decor(func):
return func
if True: # or False, or any other condition
def f(arg):
yield
else:
@decor # not detected as duplicate if this decorator is removed
def f(arg):
yield
$ python -m mypy example.py
a.py:8: error: Name 'f' already defined
This bug is still present as of mypy 0.610