Switch statemant is not exhaustive with where clause

Originator:konstantin.koval1
Number:rdar://18982840 Date Originated:14-Nov-2014 02:30 PM
Status:Open Resolved:
Product:Developer Tools Product Version:
Classification:UI/Usability Reproducible:Always
 
Summary:
I have a switch statement on simple enum. When I add where expression, if says that my switch is not exhaustive, but actually it is

Steps to Reproduce:

enum ABC : String {
  case A = "A"
  case B = "B"
  case C = "C"
}

let a = ABC.B

// this works fine
switch a {
case .A:
  println("a")
case .B:
  println("b")
case .C:
  println("c")
}


switch a {
case let a where a == .A:
  println("\(a.rawValue)")
//this handle .A case
case .B:
  println("b")
case .C:
  println("c")
}

Expected Results:
I would switch to understand what values will be handled by case with where expression and if all cases are covered don’t require to add default handler

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!