`Y062` doesn't account for nested literals
Open
Nobody has claimed this yet.
type-bug
- Dominant language
- Python
- Stars
- 83
- Forks
- 22
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the implementation and tests for Y062, then read how the rule processes Literal arguments. Add coverage for nested Literal values such as Literal[1, Literal[2, 1]] and verify that valid nested forms no longer produce Y062 while the rule's existing checks still behave as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100