Bug Report
Using None | t instead of t | None prompts an error when used as a value (not a type hint).
https://peps.python.org/pep-0604/#proposal
To Reproduce
a: None | int
b = None | int # error: Unsupported left operand type for | ("None") [operator]
Expected Behavior
Mypy does not complain about the second line.
Your Environment
- Mypy version used: 90.940
- Mypy command-line flags:
- Mypy configuration options from
mypy.ini (and other config files):
pretty = true
namespace_packages = true
warn_redundant_casts = true
warn_no_return = true
warn_unreachable = true
show_error_context = true
show_error_codes = true
check_untyped_defs = true
- Python version used: 3.10.2
- Operating system and version: Ubuntu 20.04 WSL
Bug Report
Using
None | tinstead oft | Noneprompts an error when used as a value (not a type hint).https://peps.python.org/pep-0604/#proposal
To Reproduce
Expected Behavior
Mypy does not complain about the second line.
Your Environment
mypy.ini(and other config files):