> On Nov 6, 2017, at 5:47 AM, Dennis Weissmann <den...@dennisweissmann.me> 
> wrote:
> 
> Hey Charles,
> 
> Thanks for going through this with me :)
> 
> I'm not sure whether or not this is a compiler bug (that's partially why I 
> posted it here), although I have the feeling that *something* is definitely 
> wrong.
> 
> Funnily enough, the following code shows 3 compiler warnings which are 
> incorrect:
> 
> private func handleLocalAuthenticationError(_ error: LAError) {
>     switch error.code {
>     case .userCancel, .appCancel, .systemCancel:
>         print(".userCancel, .appCancel, .systemCancel")
>     case .authenticationFailed:
>         print(".authenticationFailed")
>     case .passcodeNotSet:
>         print(".passcodeNotSet")
>     case .biometryNotEnrolled, .touchIDNotEnrolled:             // Compiler: 
> Case will never be executed
>         print(".biometryNotEnrolled, .touchIDNotEnrolled")
>     case .biometryNotAvailable, .touchIDNotAvailable:           // Compiler: 
> Case will never be executed
>         print(".biometryNotAvailable, .touchIDNotAvailable")
>     case .biometryLockout, .touchIDLockout:                     // Compiler: 
> Case will never be executed
>         print(".biometryLockout, .touchIDLockout")
>     case .userFallback:
>         print(".userFallback")
>     case .invalidContext:
>         print(".invalidContext")
>     case .notInteractive:
>         print(".notInteractive")
>     }
> }
> 
> let error = LAError(.touchIDLockout)
> handleLocalAuthenticationError(error)
> 
> When you run it in a playground, you can see that the case *gets* executed.
> 
> - Dennis

I’d say that this sort of damned-if-you-do-damned-if-you-don’t behavior that 
emits a warning no matter what you do has to be a compiler bug. Post it on 
bugs.swift.org <http://bugs.swift.org/> and hopefully it will get fixed.

Charles

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to