Closed
Description
Consider the following mixed Python 2 and 3 stub:
import sys
if sys.version_info < (3,):
class X:
def foo(self) -> int: ...
class Y(X):
def foo(self) -> str: ... # type: ignore
Using mypy 0.641 and Python 3.6.7 when running this with mypy --warn-unused-ignores
mypy wll complain:
foo.pyi:7: note: unused 'type: ignore' comment
As expected it will not complain when running in --py2
mode. I believe mypy should not complain about ignores in branches that are not checked.
See also #2961, which is more generic.