Xcode-beta (6E14): Swift - switch statements should warn

Originator:owensd
Number:rdar://21001503 Date Originated:18-May-2015 10:57 AM
Status:Closed Resolved:Fixed
Product:Developer Tools Product Version:Xcode-beta (6E14)
Classification:Enhancement Reproducible:Always
 
Summary:
It would probably be good to have a warning when switch cases are not reachable:

let x = 5, y = 10

switch (x, y) {
case (_, _):
    println("_, _")
    
case (5, _):
    println("5, _")

case (_, 10):
    println("_, 10")
    
case (5, 10):
    println("5, 10")
}

All of the cases after _,_ are unreachable. This can lead to some subtle bugs if not careful.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!