swiftlang/swift

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

Open

#53.696 aperta il 12 ago 2019

Vedi su GitHub
 (7 commenti) (0 reazioni) (0 assegnatari)Swift (10.719 fork)batch import
compilergood first issueimprovement

Metriche repository

Star
 (69.989 star)
Metriche merge PR
 (Merge medio 8g 17h) (510 PR mergiate in 30 g)

Descrizione

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"

Guida contributor