Bug Report
Python code
FOO = frozenset("abc")
BAR = FOO and next(iter(FOO))
Mypy reports and error
wtf.py:2: error: Argument 1 to "iter" has incompatible type "FrozenSet[str]"; expected "Iterable[FrozenSet[str]]"
Expected Behavior
Ideally, mypy should infer that type of BAR is "falsey or string".
If not that, then "empty set or string".
if not that, then "set or string".
Actual Behavior
mypy seems to be tripped by X op func(X), gets confused 😖
mypy complains about the argument to iter 🤷🏿
Note that expression like BAR = next(iter(FOO)) is understood correctly.
Your Environment
- Mypy version used: 0.910
- Mypy command-line flags: none
- Mypy configuration options from
mypy.ini (and other config files): none
- Python version used: 3.9.5
- Operating system and version: macos, universal2
Bug Report
Python code
Mypy reports and error
Expected Behavior
Ideally,
mypyshould infer that type ofBARis "falsey or string".If not that, then "empty set or string".
if not that, then "set or string".
Actual Behavior
mypyseems to be tripped byX op func(X), gets confused 😖mypycomplains about the argument to iter 🤷🏿Note that expression like
BAR = next(iter(FOO))is understood correctly.Your Environment
mypy.ini(and other config files): none