After upgrading Pyrefly to 0.55.0 in optype, a new invalid-literal error was reported in a test (src), that the four other four type-checkers seem to have no issue with.
The test is a bit convoluted, so I tried minimizing the repro, and
from typing import Annotated, Literal, TypeAlias
One: TypeAlias = Literal[1]
Two: TypeAlias = Annotated[Literal[2], "irrelevant"]
OneOrTwo: TypeAlias = One | Two
Spam1: TypeAlias = Literal[One, Two] # no problem
Spam2: TypeAlias = Literal[One, Two, OneOrTwo] # E: invalid-literal
sandbox
OneOrTwo is supposed to be equivalent to Literal[1, 2]. But Pyrefly does not seem to recognize it as a Literal type, because there's an Annotated involved -- replace the Two definiens with Literal[2] (i.e. unwrap the Annotated), and the error disappears.