-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Description
Bug Report
If the "dummy" variable _ is used several times in assignments as shown in the following code snippet, we get an error, because different expressions return different types.
IMHO, this _ variable shouldn't be checked for typing in assignments, because it is freely used to throw away all types of returned results.
To Reproduce
def f1() -> int:
return 5
def f2() -> str:
return "5"
_ = f1()
_ = f2()
Expected Behavior
No error message.
Actual Behavior
mypy-test.py:8: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]
Found 1 error in 1 file (checked 1 source file)
Your Environment
- Mypy version used: 1.17.0
- Python version used: 3.10.5