You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
x: str|None=NoneifxisNone:
fromosimportsepasx# revealed type is Optional[str]print(x+"a") # mypy false positive
Expected Behavior
No error.
Actual Behavior
% mypy test.pymain.py:5: error: Unsupported left operand type for + ("None") [operator]main.py:5: note: Left operand is of type "Optional[str]"Found 1 error in 1 file (checked 1 source file)
% python test.py/a
Your Environment
Mypy version used: 1.1.1
Mypy command-line flags: none
Python version used: 3.11
The text was updated successfully, but these errors were encountered:
Bug Report
I would expect a variable that gets imported narrow the type.
To Reproduce
https://mypy-play.net/?mypy=latest&python=3.11&gist=11a4883cf29edd47fd1aff15302ead30
Expected Behavior
No error.
Actual Behavior
Your Environment
The text was updated successfully, but these errors were encountered: