[SR-1313] Switch statement exhaustiveness not inferred with wildcards and enums #43921
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
type checker
Area → compiler: Semantic analysis
Environment
Xcode 7.3 using the stock Swift compiler.
Additional Detail from JIRA
md5: 4696a655d484ce39b6ced05a61d40374
duplicates:
Issue Description:
Bit of a weird issue, let's say we have a two-case enum called Result.
And then I have a tuple of two Results. If I switch on the tuple using the following cases, the Swift compiler gives me an error that the switch is not exhaustive.
In this simple example it doesn't really matter because I could use a default case, but often I'll have an ErrorType instance associated with the Error case, and I need either one or the other extracted using the case statements. I've solved this in my own code by just using an exhaustive, explicit switch, but as mentioned on Twitter ( https://twitter.com/jckarter/status/724665175018606592 ) this is a bug, as Swift should be able to infer the exhaustiveness.
The text was updated successfully, but these errors were encountered: