<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hey Charles,<div class=""><br class=""></div><div class="">Thanks for going through this with me :)</div><div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class="">Funnily enough, the following code shows 3 compiler warnings which are incorrect:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="color: #ba2da2" class="">private</span> <span style="color: #ba2da2" class="">func</span> handleLocalAuthenticationError(<span style="color: #ba2da2" class="">_</span> error: <span style="color: #703daa" class="">LAError</span>) {</div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">&nbsp; &nbsp; <span style="color: #ba2da2" class="">switch</span> error.<span style="color: #703daa" class="">code</span> {</div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(62, 30, 129);" class=""><span style="color: #000000" class="">&nbsp; &nbsp; </span><span style="color: #ba2da2" class="">case</span><span style="color: #000000" class=""> .</span>userCancel<span style="color: #000000" class="">, .</span>appCancel<span style="color: #000000" class="">, .</span>systemCancel<span style="color: #000000" class="">:</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(209, 47, 27);" class=""><span style="color: #000000" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #3e1e81" class="">print</span><span style="color: #000000" class="">(</span>".userCancel, .appCancel, .systemCancel"<span style="color: #000000" class="">)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(62, 30, 129);" class=""><span style="color: #000000" class="">&nbsp; &nbsp; </span><span style="color: #ba2da2" class="">case</span><span style="color: #000000" class=""> .</span>authenticationFailed<span style="color: #000000" class="">:</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(209, 47, 27);" class=""><span style="color: #000000" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #3e1e81" class="">print</span><span style="color: #000000" class="">(</span>".authenticationFailed"<span style="color: #000000" class="">)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(62, 30, 129);" class=""><span style="color: #000000" class="">&nbsp; &nbsp; </span><span style="color: #ba2da2" class="">case</span><span style="color: #000000" class=""> .</span>passcodeNotSet<span style="color: #000000" class="">:</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(209, 47, 27);" class=""><span style="color: #000000" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #3e1e81" class="">print</span><span style="color: #000000" class="">(</span>".passcodeNotSet"<span style="color: #000000" class="">)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(62, 30, 129);" class=""><span style="color: #000000" class="">&nbsp; &nbsp; </span><span style="color: #ba2da2" class="">case</span><span style="color: #000000" class=""> .</span>biometryNotEnrolled<span style="color: #000000" class="">, .</span>touchIDNotEnrolled<span style="color: #000000" class="">: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #008400" class="">// Compiler: Case will never be executed</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(209, 47, 27);" class=""><span style="color: #000000" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #3e1e81" class="">print</span><span style="color: #000000" class="">(</span>".biometryNotEnrolled, .touchIDNotEnrolled"<span style="color: #000000" class="">)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(62, 30, 129);" class=""><span style="color: #000000" class="">&nbsp; &nbsp; </span><span style="color: #ba2da2" class="">case</span><span style="color: #000000" class=""> .</span>biometryNotAvailable<span style="color: #000000" class="">, .</span>touchIDNotAvailable<span style="color: #000000" class="">: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #008400" class="">//&nbsp;</span><span style="color: rgb(0, 132, 0);" class="">Compiler:</span><span style="color: rgb(0, 132, 0);" class="">&nbsp;</span><span style="color: rgb(0, 132, 0);" class="">Case will never be executed</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(209, 47, 27);" class=""><span style="color: #000000" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #3e1e81" class="">print</span><span style="color: #000000" class="">(</span>".biometryNotAvailable, .touchIDNotAvailable"<span style="color: #000000" class="">)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">&nbsp; &nbsp; <span style="color: #ba2da2" class="">case</span> .<span style="color: #3e1e81" class="">biometryLockout</span>, .<span style="color: #3e1e81" class="">touchIDLockout</span>: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008400" class="">//&nbsp;</span><span style="color: rgb(0, 132, 0);" class="">Compiler:</span><span style="color: rgb(0, 132, 0);" class="">&nbsp;</span><span style="color: rgb(0, 132, 0);" class="">Case will never be executed</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(209, 47, 27);" class=""><span style="color: #000000" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #3e1e81" class="">print</span><span style="color: #000000" class="">(</span>".biometryLockout, .touchIDLockout"<span style="color: #000000" class="">)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(62, 30, 129);" class=""><span style="color: #000000" class="">&nbsp; &nbsp; </span><span style="color: #ba2da2" class="">case</span><span style="color: #000000" class=""> .</span>userFallback<span style="color: #000000" class="">:</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(209, 47, 27);" class=""><span style="color: #000000" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #3e1e81" class="">print</span><span style="color: #000000" class="">(</span>".userFallback"<span style="color: #000000" class="">)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(62, 30, 129);" class=""><span style="color: #000000" class="">&nbsp; &nbsp; </span><span style="color: #ba2da2" class="">case</span><span style="color: #000000" class=""> .</span>invalidContext<span style="color: #000000" class="">:</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(209, 47, 27);" class=""><span style="color: #000000" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #3e1e81" class="">print</span><span style="color: #000000" class="">(</span>".invalidContext"<span style="color: #000000" class="">)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(62, 30, 129);" class=""><span style="color: #000000" class="">&nbsp; &nbsp; </span><span style="color: #ba2da2" class="">case</span><span style="color: #000000" class=""> .</span>notInteractive<span style="color: #000000" class="">:</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(209, 47, 27);" class=""><span style="color: #000000" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #3e1e81" class="">print</span><span style="color: #000000" class="">(</span>".notInteractive"<span style="color: #000000" class="">)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">&nbsp; &nbsp; }</div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">}</div><div class=""><br class=""></div></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(62, 30, 129); background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">let</span><span style="color: #000000" class=""> error = </span><span style="color: #703daa" class="">LAError</span><span style="color: #000000" class="">(.</span><span style="text-decoration: underline" class="">t</span>ouchIDLockout<span style="color: #000000" class="">)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(49, 89, 93); background-color: rgb(255, 255, 255);" class="">handleLocalAuthenticationError<span style="color: #000000" class="">(</span><span style="color: #4f8187" class="">error</span><span style="color: #000000" class="">)</span></div></div><div class=""><br class=""></div><div class="">When you run it in a playground, you can see that the case *gets* executed.</div><div class=""><br class=""></div><div class="">- Dennis<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Nov 5, 2017, at 7:13 PM, Charles Srstka &lt;<a href="mailto:cocoadev@charlessoft.com" class="">cocoadev@charlessoft.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><blockquote type="cite" class="">On Nov 5, 2017, at 10:39 AM, Dennis Weissmann &lt;<a href="mailto:dennis@dennisweissmann.me" class="">dennis@dennisweissmann.me</a>&gt; wrote:<br class=""></blockquote><div class=""><blockquote type="cite" class=""><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div class="">You can delete the default case here, and your switch will still be exhaustive</div></div></blockquote><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">That's exactly my problem! It is *not*.</span><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">When I delete the default clause, the compiler warns that the switch is not exhaustive and fixits suggest to add the "missing" deprecated cases.</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">- Dennis</div></div></div></blockquote></div><br class=""><div class="">Hi Dennis,</div><div class=""><br class=""></div><div class="">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 <a href="http://bugs.swift.org/" class="">bugs.swift.org</a>?</div><div class=""><br class=""></div><div class="">Charles</div><div class=""><br class=""></div></div></div></blockquote></div><br class=""></div></div></body></html>