<div dir="ltr">Oh, wow, the reported bug is quite similar but not exactly.<div><br></div><div>Anyway, I reported the problem here <a href="https://bugs.swift.org/browse/SR-4248">https://bugs.swift.org/browse/SR-4248</a>. I guess the discussion will continue in there.</div><div><br></div><div>Thanks again!</div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, 15 Mar 2017 at 12:51 Kim Burgestrand <<a href="mailto:kim@burgestrand.se">kim@burgestrand.se</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg">Found the answer to my follow-up question! It's a known and reported bug: <a href="https://bugs.swift.org/browse/SR-912" class="gmail_msg" target="_blank">https://bugs.swift.org/browse/SR-912</a><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Thanks!</div></div><br class="gmail_msg"><div class="gmail_quote gmail_msg"><div dir="ltr" class="gmail_msg">On Wed, 15 Mar 2017 at 12:47 Kim Burgestrand <<a href="mailto:kim@burgestrand.se" class="gmail_msg" target="_blank">kim@burgestrand.se</a>> wrote:<br class="gmail_msg"></div><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg">On Tue, 14 Mar 2017 at 19:50 Joe Groff <<a href="mailto:jgroff@apple.com" class="gmail_msg" target="_blank">jgroff@apple.com</a>> wrote:<br class="gmail_msg"></div><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg"><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br class="gmail_msg">
It shouldn't. Please file a bug, if you haven't already.<br class="gmail_msg"></blockquote><div class="gmail_msg"><br class="gmail_msg"></div></div></div><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg"><div class="gmail_msg">Will do! I'll file a bug that casting to <font face="monospace" class="gmail_msg">`Any`</font> first causes different behavior.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Follow-up question, looking at the expression <font face="monospace" class="gmail_msg">`name as! T`</font>, is it expected to cause a nil-unwrapping runtime error when <font face="monospace" class="gmail_msg">`name == nil`</font> and <font face="monospace" class="gmail_msg">`T == Optional<String>`</font>? Mind you, <font face="monospace" class="gmail_msg">`(nil as! Optional<String>)`</font> does not cause an error.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">If the nil-unwrapping error is expected, how can I write it so that it doesn't, and instead returns <font face="monospace" class="gmail_msg">nil?</font></div><div class="gmail_msg"><font face="monospace" class="gmail_msg"><br class="gmail_msg"></font></div></div></div></blockquote></div></blockquote></div>