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
{{ message }}
Repository navigation
Type narrowing an enum shouldn't narrow to a literal #19753
Activity
A5rocks commentedon Aug 28, 2025
Interestingly, if there's only 1 enum member, then the
reveal_typebecomes unreachable? No matter what the enum member is.sterliakov commentedon Aug 29, 2025
with #19594 it's handled better: still
Literal['b']ifbis among enum values, unreachable otherwise.Also this problem does not exist for
StrEnum, only(str, Enum)/(int, Enum)subclasses are affected.Improve narrowing logic for Enum int and str subclasses (#20609)