Skip to content

[SR-11295] There should be a warning for unnecessary casts #53696

@swift-ci

Description

@swift-ci
Previous ID SR-11295
Radar None
Original Reporter cukier (JIRA User)
Type Improvement
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Improvement, StarterBug
Assignee None
Priority Medium

md5: 134fdcf76ae60512bbc5e443ad8390d7

Issue Description:

Swift should warn you if you're performing a cast to a type that the thing is already

        let a = "Hello"
        _ = a as String

I would expect something like "casting expression to `String` doesn't change the type" with a fixit of removing "as String"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions