Odd/inconsistent compile warning for optional of enum

Interesting, though, I think you're onto something in terms of a discrepancy:

var sign: FloatingPointSign? = .plus

switch sign {
case .none: fallthrough
case .minus: fallthrough
case .plus: print("Hi")
default: fatalError() // warning: default will never be executed
}

switch sign {
case .none: fallthrough
case .minus: fallthrough
case .plus: print("Hi")
case .some(_): fatalError() // no warning, hmm...
}
2 Likes