<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hello,<div class=""><br class=""></div><div class=""><br class=""></div><div class="">Don’t you think that the compiler should emit a warning for a possible overflow in the following code?</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #0433ff" class="">func</span> foo(x:<span style="font-variant-ligatures: no-common-ligatures; color: #3495af" class="">UInt16</span>) {</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; min-height: 15px;" class=""><br class=""></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo;" class=""><span class="Apple-tab-span" style="white-space:pre">        </span><span style="font-variant-ligatures: no-common-ligatures; color: #0433ff" class="">let</span> y = <span style="font-variant-ligatures: no-common-ligatures; color: #3495af" class="">Int16</span>(x)<span class="Apple-tab-span" style="white-space:pre">                </span>&lt;— Shouldn’t we have a warning here? Or an optional?</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(52, 149, 175);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span>print<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(y)</span></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo;" class="">}</div></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo;" class="">This code is very very fragile and Swift is supposed to bring safety?</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo;" class="">Thanks,</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo;" class="">Stéphane</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div></body></html>