Bug Report
Type-checking a match on a large enum becomes very slow when the variable was first narrowed by an == check with an early exit:
from enum import StrEnum class E(StrEnum): M0 = "m0" M1 = "m1" # ... 1,200 members def f(x: E) -> None: if x == E.M0: return match x: case E.M1: pass # ... through case E.M7
Removing the x == E.M0 block makes this much faster (~1.5s vs 22s locally).
To Reproduce
Your Environment
Speed up narrowing of large literal unions
Activity
Speed up narrowing of large literal unions