Closed
Description
Bug Report
Using this feature:
https://mypy.readthedocs.io/en/stable/common_issues.html#python-version-and-system-platform-checks
Expecting to be able to # type: ignore
conditionally by python version.
To Reproduce
import sys
from typing import Text
x = "hi" # type: str
y = "hi" # type: Text
if sys.version_info[0] >= 3:
x = y
else:
x = y # type: ignore
https://mypy-play.net/?mypy=latest&python=3.10&flags=strict&gist=831f7b62f21f6c34b2ef4b490b22e0a0
Expected Behavior
Expected no errors when run targeting both python 3.10 and 2.7
Actual Behavior
Under targeting python 3.10, we see
main.py:8: error: unused "type: ignore" comment
Found 1 error in 1 file (checked 1 source file)