Skip to content

Check for duplication in union type annotations #7636

Closed
@mbyrnepr2

Description

@mbyrnepr2

Current problem

Currently we emit nothing about the following pattern, which can be simplified:

ANSWER: int | int = 42

Desired solution

Emit a warning when this pattern is detected. A union typehint containing the same type multiple times can be simplified. Potential name: typehint-duplicate-union-type.

Additional context

This is the same issue as reported in python/mypy#13448 although it doesn't look like it will be implemented by the type-checker.

Metadata

Metadata

Assignees

Labels

CheckersRelated to a checkerEnhancement ✨Improvement to a componentHacktoberfestNeeds specification 🔐Accepted as a potential improvement, and needs to specify edge cases, message names, etc.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions