> On Apr 10, 2017, at 9:18 AM, Josh Parmenter via swift-evolution 
> <[email protected]> wrote:
> 
> case .none isn’t handled.

It shouldn’t need to be handled in the second switch because it’s impossible. 
Not just developer thinks “impossible” but easily provable by static analysis 
the compiler is doing it anyway—I wouldn’t be surprised if including the case 
resulted in an “unreachable code” warning (in fact, it probably should).

> This should probably be on the swift-users list though, no?

File a bug, IMO. 

> Best,
> Josh
> 
> 
> 
> On Apr 8, 2017, at 11:29 AM, Drew Crawford via swift-evolution 
> <[email protected] 
> <mailto:[email protected]><mailto:[email protected] 
> <mailto:[email protected]>>> wrote:
> 
> 
> 
> Is there a good reason we do not compile this:
> 
> import UIKit
> 
> func foo(operation: UINavigationControllerOperation) {
>    switch(operation) {
>    case .push: /* snip */ break
>    case .pop: /* snip */ break
>    default:
>        preconditionFailure("This is a silly operation")
>    }
>    switch(operation) {
>        case .push: /* snip */ break
>        case .pop: /* snip */ break
>         //error: Switch must be exhaustive, consider adding a default clause
>    }
> }
> 
> The switch *is* exhaustive, because the default case is unreachable.  The 
> compiler could infer as much from branch analysis.
> 
> _______________________________________________
> swift-evolution mailing list
> [email protected] 
> <mailto:[email protected]><mailto:[email protected] 
> <mailto:[email protected]>>
> https://lists.swift.org/mailman/listinfo/swift-evolution 
> <https://lists.swift.org/mailman/listinfo/swift-evolution>
> 
> 
> Joshua Parmenter | Engineering Lead, Apple Technologies
> 
> T 248 777 7777
> C 206 437 1551
> F 248 616 1980
> www.vectorform.com <http://www.vectorform.com/><http://www.vectorform.com/ 
> <http://www.vectorform.com/>>
> 
> Vectorform
> 2107 Elliott Ave Suite 303
> Seattle, WA  98121 USA
> 
> Think Tank. Lab. Studio.
> We invent digital products and experiences.
> 
> SEATTLE | DETROIT | NEW YORK | MUNICH | HYDERABAD
> _______________________________________________
> swift-evolution mailing list
> [email protected] <mailto:[email protected]>
> https://lists.swift.org/mailman/listinfo/swift-evolution 
> <https://lists.swift.org/mailman/listinfo/swift-evolution>
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to