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
> On Nov 5, 2017, at 7:13 PM, Charles Srstka <[email protected]> wrote:
>
>> On Nov 5, 2017, at 10:39 AM, Dennis Weissmann <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>>> You can delete the default case here, and your switch will still be
>>> exhaustive
>> That's exactly my problem! It is *not*.
>>
>> When I delete the default clause, the compiler warns that the switch is not
>> exhaustive and fixits suggest to add the "missing" deprecated cases.
>>
>> - Dennis
>
> Hi Dennis,
>
> Ah, I see—although the switch should be considered exhaustive since you have
> covered all the possible cases, the compiler is claiming that it is not. I
> would probably consider this to be a compiler bug. Have you considered filing
> a report at bugs.swift.org <http://bugs.swift.org/>?
>
> Charles
>
_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users