Open
Description
Bug Report
In some situations, mypy can report that there was an incompatible type X, but then say that the expected type was also X. Regardless of whether or not the program is correct or not, this error message is bad.
To Reproduce
from typing import Any
class Linear:
def __init__(self, **kwargs) -> None:
pass
class QatLinear(Linear):
def __init__(self, qconfig=None):
pass
def f(x: Any):
if type(x) in [Linear, QatLinear]:
pass
Expected Behavior mypy gives me a good error message
Actual Behavior
(base) ezyang-mbp:~ ezyang$ mypy t.py
t.py:12: error: List item 0 has incompatible type "Type[Linear]"; expected "Type[Linear]"
Found 1 error in 1 file (checked 1 source file)
Your Environment
- Mypy version used: mypy 0.780
- Mypy command-line flags: none
- Mypy configuration options from
mypy.ini
(and other config files): none - Python version used: Python 3.7
- Operating system and version: OS X