<div dir="ltr"><div class="gmail_default"><font face="georgia, serif">In my test, compiler thought you use `</font><span class="gmail-syntax-keyword" style="font-family:arial,sans-serif;color:rgb(0,0,0);font-size:11px;white-space:pre-wrap">init</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0);font-size:11px;white-space:pre-wrap">?(</span><span class="gmail-syntax-identifier" style="font-family:arial,sans-serif;color:rgb(0,0,0);font-size:11px;white-space:pre-wrap">exactly</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0);font-size:11px;white-space:pre-wrap"> </span><span class="gmail-syntax-param-name" style="font-family:arial,sans-serif;color:rgb(0,0,0);font-size:11px;white-space:pre-wrap">value</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0);font-size:11px;white-space:pre-wrap">: </span><span class="gmail-syntax-type" style="font-family:arial,sans-serif;color:rgb(0,0,0);font-size:11px;white-space:pre-wrap"><a style="color:rgb(0,51,102);text-decoration:none">Double</a></span><span style="font-family:arial,sans-serif;color:rgb(0,0,0);font-size:11px;white-space:pre-wrap">)`, </span><span style="color:rgb(0,0,0);white-space:pre-wrap"><font face="georgia, serif">which returns nil. So this is not a bug.</font></span></div><div class="gmail_default" style="font-family:georgia,serif"><span style="color:rgb(0,0,0);font-size:11px;white-space:pre-wrap;font-family:arial,sans-serif"><br></span></div><div class="gmail_default"><span style="color:rgb(0,0,0);white-space:pre-wrap"><font face="georgia, serif">Zhaoxin</font></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 2, 2017 at 1:39 AM, Halen Wooten via swift-users <span dir="ltr">&lt;<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I&#39;m seeing a weird issue with using an initializer in flatMap. Here&#39;s<br>
an example:<br>
<br>
```<br>
let time: TimeInterval? = 662.82582598600004<br>
let intTimeFlatmap = time.flatMap(Int.init) // nil<br>
let intTime = Int(time!) // 662<br>
```<br>
<br>
I would expect for the flatMap call to return an optional Int with the<br>
proper value of 662. Is there something I&#39;m misunderstanding, or is<br>
this a swift bug?<br>
<br>
Thanks,<br>
Halen<br>
______________________________<wbr>_________________<br>
swift-users mailing list<br>
<a href="mailto:swift-users@swift.org">swift-users@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-users</a><br>
</blockquote></div><br></div>