flake8-pyi
flake8-pyi copied to clipboard
`Y062` doesn't account for nested literals
According to spec, Literal[X, Y] should be treated as Union[Literal[X], Literal[Y], which means nested Literals should be supported by type checkers.
Hence raising Y062 for cases like Literal[1, Literal[2, 1]] would make sense I believe.
Seems like we also don't have a lint rule against Literal[A, Literal[B, C]], which should be replaced with Literal[A, B, C].
One special case to consider (though an unlikely one) is Literal[1, Literal[1, 1]] where both inner 1s are considered duplicates for the parent Literal and the last 1 is a duplicate within the inner Literal as well