Bug Report
Minimal example python code is attached below. mypy output is:
main.py:4: error: X | Y syntax for unions requires Python 3.10 [syntax]
main.py:12: error: X | Y syntax for unions requires Python 3.10 [syntax]
Found 2 errors in 1 file (checked 1 source file)
To Reproduce
https://mypy-play.net/?mypy=latest&python=3.9&gist=03da1f2a4b60eb95088e81958066deb5
just in case, here a copy of the gist
#!/usr/bin/env python3
class C3:
futureDef: 'C2'
two: 'str|None'
class C2:
pass
class C1:
ONE = None # type: str|None
def begin(self) -> None:
C1.ONE = 'a'
Expected Behavior
This file should produce no errors
Actual Behavior
Both errors are incorrect, as both types are provided in a 3.8 safe way (encased in a string or as a comment)
Your Environment
- Mypy version used: 1.17.1 (latest)
- Python version used: 3.9
Bug Report
Minimal example python code is attached below. mypy output is:
To Reproduce
https://mypy-play.net/?mypy=latest&python=3.9&gist=03da1f2a4b60eb95088e81958066deb5
just in case, here a copy of the gist
Expected Behavior
This file should produce no errors
Actual Behavior
Both errors are incorrect, as both types are provided in a 3.8 safe way (encased in a string or as a comment)
Your Environment