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
IntEnum/StrEnum values compare equal to the corresponding int/str values,
which breaks the logic we use for narrowing based on equality to a
literal value. Special case IntEnum/StrEnum to avoid the incorrect
behavior.
Fix#17860.
The revealed narrowed type is unexpected, and there is a false negative:
I'd expect the revealed type to be
int
, since that's the correct runtime type. IntEnum values are equal to the correspondingint
objects:Also,
x.value
should be flagged as an error, since it fails at runtime.If this needs special casing for IntEnums, it's fine. We already special case enums in various ways.
The text was updated successfully, but these errors were encountered: