Bug Report
After upgrading from 1.19.x to 1.20.x, I'm seeing a false positive with reachability checking for dicts with single-variant Enum keys.
To Reproduce
https://mypy-play.net/?mypy=latest&python=3.12&flags=warn-unreachable&gist=3ba2a6f89ea69ebf0ce78f0d91fb0e7f
importenumclassColor(enum.Enum):
RED=enum.auto()
deffoo(colors: list[Color]) ->None:
counts: dict[Color, int] = {}
forcolorincolors:
ifcolornotincounts:
counts[color] =0# error: Statement is unreachable [unreachable]counts[color] +=1If I add a second Enum variant, the error goes away.
Interestingly, the error also goes away if I remove the explicit type annotation.
Expected Behavior
With v1.19.1, I get no errors.
Bug Report
After upgrading from 1.19.x to 1.20.x, I'm seeing a false positive with reachability checking for
dicts with single-variantEnumkeys.To Reproduce
https://mypy-play.net/?mypy=latest&python=3.12&flags=warn-unreachable&gist=3ba2a6f89ea69ebf0ce78f0d91fb0e7f
If I add a second
Enumvariant, the error goes away.Interestingly, the error also goes away if I remove the explicit type annotation.
Expected Behavior
With v1.19.1, I get no errors.