8000 Generate warnings for redundant casts · Issue #958 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content
Generate warnings for redundant casts #958
Closed
@jhance

Description

@jhance

If we visit cast(x, T) and the inferred type of x is a subtype of T then we should emit a warning. Unnecessary casts are bad casts.

There should also be a way to make this an error instead of a warning (for example, so we can enforce that we don't have any unnecessary casts in the mypy codebase).

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0