swiftlang/swift

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

Open

#53,696 opened on Aug 12, 2019

View on GitHub
 (7 comments) (0 reactions) (0 assignees)Swift (10,719 forks)batch import
compilergood first issueimprovement

Repository metrics

Stars
 (69,989 stars)
PR merge metrics
 (Avg merge 8d 17h) (510 merged PRs in 30d)

Description

Previous ID SR-11295
Radar None
Original Reporter cukier (JIRA User)
Type Improvement
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"

Contributor guide