<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=""><blockquote type="cite" class="">On Nov 6, 2017, at 5:47 AM, Dennis Weissmann <<a href="mailto:dennis@dennisweissmann.me" class="">dennis@dennisweissmann.me</a>> wrote:<br class=""></blockquote><div><blockquote type="cite" class=""><br class="Apple-interchange-newline"><div class=""><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="">Hey Charles,</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;">Thanks for going through this with me :)</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;">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="" 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;">Funnily enough, the following code shows 3 compiler warnings which are incorrect:</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;"><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);"><div class="" style="margin: 0px; font-stretch: normal; line-height: normal;"><span class="" style="color: rgb(186, 45, 162);">private</span><span class="Apple-converted-space"> </span><span class="" style="color: rgb(186, 45, 162);">func</span><span class="Apple-converted-space"> </span>handleLocalAuthenticationError(<span class="" style="color: rgb(186, 45, 162);">_</span><span class="Apple-converted-space"> </span>error:<span class="Apple-converted-space"> </span><span class="" style="color: rgb(112, 61, 170);">LAError</span>) {</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal;"> <span class="Apple-converted-space"> </span><span class="" style="color: rgb(186, 45, 162);">switch</span><span class="Apple-converted-space"> </span>error.<span class="" style="color: rgb(112, 61, 170);">code</span><span class="Apple-converted-space"> </span>{</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(62, 30, 129);"><span class="" style=""> <span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(186, 45, 162);">case</span><span class="" style=""><span class="Apple-converted-space"> </span>.</span>userCancel<span class="" style="">, .</span>appCancel<span class="" style="">, .</span>systemCancel<span class="" style="">:</span></div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(209, 47, 27);"><span class="" style=""> <span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(62, 30, 129);">print</span><span class="" style="">(</span>".userCancel, .appCancel, .systemCancel"<span class="" style="">)</span></div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(62, 30, 129);"><span class="" style=""> <span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(186, 45, 162);">case</span><span class="" style=""><span class="Apple-converted-space"> </span>.</span>authenticationFailed<span class="" style="">:</span></div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(209, 47, 27);"><span class="" style=""> <span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(62, 30, 129);">print</span><span class="" style="">(</span>".authenticationFailed"<span class="" style="">)</span></div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(62, 30, 129);"><span class="" style=""> <span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(186, 45, 162);">case</span><span class="" style=""><span class="Apple-converted-space"> </span>.</span>passcodeNotSet<span class="" style="">:</span></div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(209, 47, 27);"><span class="" style=""> <span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(62, 30, 129);">print</span><span class="" style="">(</span>".passcodeNotSet"<span class="" style="">)</span></div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(62, 30, 129);"><span class="" style=""> <span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(186, 45, 162);">case</span><span class="" style=""><span class="Apple-converted-space"> </span>.</span>biometryNotEnrolled<span class="" style="">, .</span>touchIDNotEnrolled<span class="" style="">: <span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(0, 132, 0);">// Compiler: Case will never be executed</span></div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(209, 47, 27);"><span class="" style=""> <span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(62, 30, 129);">print</span><span class="" style="">(</span>".biometryNotEnrolled, .touchIDNotEnrolled"<span class="" style="">)</span></div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(62, 30, 129);"><span class="" style=""> <span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(186, 45, 162);">case</span><span class="" style=""><span class="Apple-converted-space"> </span>.</span>biometryNotAvailable<span class="" style="">, .</span>touchIDNotAvailable<span class="" style="">: <span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(0, 132, 0);">// </span><span class="" style="color: rgb(0, 132, 0);">Compiler:</span><span class="" style="color: rgb(0, 132, 0);"> </span><span class="" style="color: rgb(0, 132, 0);">Case will never be executed</span></div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(209, 47, 27);"><span class="" style=""> <span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(62, 30, 129);">print</span><span class="" style="">(</span>".biometryNotAvailable, .touchIDNotAvailable"<span class="" style="">)</span></div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal;"> <span class="Apple-converted-space"> </span><span class="" style="color: rgb(186, 45, 162);">case</span><span class="Apple-converted-space"> </span>.<span class="" style="color: rgb(62, 30, 129);">biometryLockout</span>, .<span class="" style="color: rgb(62, 30, 129);">touchIDLockout</span>: <span class="Apple-converted-space"> </span><span class="" style="color: rgb(0, 132, 0);">// </span><span class="" style="color: rgb(0, 132, 0);">Compiler:</span><span class="" style="color: rgb(0, 132, 0);"> </span><span class="" style="color: rgb(0, 132, 0);">Case will never be executed</span></div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(209, 47, 27);"><span class="" style=""> <span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(62, 30, 129);">print</span><span class="" style="">(</span>".biometryLockout, .touchIDLockout"<span class="" style="">)</span></div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(62, 30, 129);"><span class="" style=""> <span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(186, 45, 162);">case</span><span class="" style=""><span class="Apple-converted-space"> </span>.</span>userFallback<span class="" style="">:</span></div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(209, 47, 27);"><span class="" style=""> <span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(62, 30, 129);">print</span><span class="" style="">(</span>".userFallback"<span class="" style="">)</span></div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(62, 30, 129);"><span class="" style=""> <span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(186, 45, 162);">case</span><span class="" style=""><span class="Apple-converted-space"> </span>.</span>invalidContext<span class="" style="">:</span></div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(209, 47, 27);"><span class="" style=""> <span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(62, 30, 129);">print</span><span class="" style="">(</span>".invalidContext"<span class="" style="">)</span></div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(62, 30, 129);"><span class="" style=""> <span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(186, 45, 162);">case</span><span class="" style=""><span class="Apple-converted-space"> </span>.</span>notInteractive<span class="" style="">:</span></div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(209, 47, 27);"><span class="" style=""> <span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(62, 30, 129);">print</span><span class="" style="">(</span>".notInteractive"<span class="" style="">)</span></div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal;"> }</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal;">}</div><div class=""><br class=""></div></div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(62, 30, 129); background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(186, 45, 162);">let</span><span class="" style=""><span class="Apple-converted-space"> </span>error =<span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(112, 61, 170);">LAError</span><span class="" style="">(.</span><span class="" style="text-decoration: underline;">t</span>ouchIDLockout<span class="" style="">)</span></div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(49, 89, 93); background-color: rgb(255, 255, 255);">handleLocalAuthenticationError<span class="" style="">(</span><span class="" style="color: rgb(79, 129, 135);">error</span><span class="" style="">)</span></div></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;">When you run it in a playground, you can see that the case *gets* executed.</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></blockquote><br class=""></div><div>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 <a href="http://bugs.swift.org" class="">bugs.swift.org</a> and hopefully it will get fixed.</div><div><br class=""></div><div>Charles</div><br class=""></body></html>