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

Originator:me
Number:rdar://21028920 Date Originated:19-May-2015 05:24 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode-beta (6E14)
Classification:Enhancement Reproducible:Always
 
This is a duplicate of rdar://21001503

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!