<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="">Thanks Victor.<div class=""><br class=""></div><div class="">Actually, that snippet works in the v2.1.1 REPL as well, so I think the REPL environment works differently.<div class=""><br class=""></div><div class="">Both v2.1.1 and v2.2-dev fail when running that code as a script.</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Dan</div><div class=""><br class=""><div class=""><br class=""><div class=""><div><blockquote type="cite" class=""><div class="">On 9 Jan 2016, at 10:41 PM, Victor Guerra <<a href="mailto:vguerra@gmail.com" class="">vguerra@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">hi Dan, <div class=""><span style="line-height:1.5" class=""><br class=""></span></div><div class=""><span style="line-height:1.5" class="">Seems to work when using Swift 2.2 Snapshot from 6th of jan: </span><br class=""></div><div class=""><br class=""></div><div class=""><div style="margin:0px" class=""><div style="font-family:Menlo;font-size:15px;line-height:normal;margin:0px" class="">Welcome to Apple Swift version 2.2-dev (LLVM 3ebdbb2c7e, Clang f66c5bb67b, Swift 54dcd16759). Type :help for assistance.</div><div style="font-family:Menlo;font-size:15px;line-height:normal;margin:0px" class=""> 1> func foo() -> Int { return soon + 1 } </div><div style="font-family:Menlo;font-size:15px;line-height:normal;margin:0px" class=""> 2. let wat = true </div><div style="font-family:Menlo;font-size:15px;line-height:normal;margin:0px" class=""> 3. let soon = 1</div><div style="font-family:Menlo;font-size:15px;line-height:normal;margin:0px" class="">wat: Bool = true</div><div style="font-family:Menlo;font-size:15px;line-height:normal;margin:0px" class="">soon: Int = 1</div><div style="font-family:Menlo;font-size:15px;line-height:normal;margin:0px" class=""> 4> foo()</div><div style="font-family:Menlo;font-size:15px;line-height:normal;margin:0px" class="">$R0: Int = 2</div><div style="font-family:Menlo;font-size:15px;line-height:normal;margin:0px" class=""><br class=""></div><div style="margin:0px" class="">I am able to reproduce the bug on a playground though where swift 2.1 is used I guess. </div></div></div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Sat, Jan 9, 2016 at 10:44 PM Dan Cutting via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Hi,<div class=""><br class=""></div><div class=""><div class="">This code builds and runs fine:</div><div class=""><div class=""><br class=""></div><div class=""><div style="margin:0px;font-size:15px;line-height:normal;font-family:Menlo" class=""><span style="color:#0433ff" class="">func</span> foo() -> <span style="color:#3495af" class="">Int</span> { <span style="color:#0433ff" class="">return</span> <span style="color:#3495af" class="">soon</span> + 1 }</div><div style="margin:0px;font-size:15px;line-height:normal;font-family:Menlo" class=""><span style="color:#0433ff" class="">let</span> soon = 1</div><div style="margin:0px;font-size:15px;line-height:normal;font-family:Menlo;color:rgb(0,143,0)" class=""><br class=""></div></div><div style="margin:0px;line-height:normal" class=""><div style="margin:0px;line-height:normal" class="">But the following code has a compilation error (“Use of unresolved identifier ‘soon’”):</div><div style="font-family:Menlo;font-size:15px;margin:0px;line-height:normal;color:rgb(52,149,175)" class=""><span style="font-family: Helvetica; font-size: 14px;" class=""><br class=""></span></div></div></div><div class=""><div style="margin:0px;font-size:15px;line-height:normal;font-family:Menlo" class=""><div style="margin:0px;line-height:normal" class=""><span style="color:#0433ff" class="">func</span> foo() -> <span style="color:#3495af" class="">Int</span> { <span style="color:#0433ff" class="">return</span> <span style="color:#3495af" class="">soon</span> + 1 }</div><div style="margin:0px;line-height:normal" class=""><span style="color:#0433ff" class="">let</span> wat = <span style="color:#0433ff" class="">true</span></div><div style="margin:0px;line-height:normal" class=""><span style="color:#0433ff" class="">let</span> soon = 1</div><div class=""><br class=""></div><div class=""><span style="font-family:Helvetica;font-size:14px" class="">Any ideas why? Is this a bug in Swift or intended behaviour?</span></div><div class=""><span style="font-family:Helvetica;font-size:14px" class=""><br class=""></span></div><div class=""><span style="font-family:Helvetica;font-size:14px" class="">I might expect either or neither of these to work, but to have one work and one fail is perplexing.</span></div><div class=""><span style="font-family:Helvetica;font-size:14px" class=""><br class=""></span></div><div class=""><span style="font-family:Helvetica;font-size:14px" class="">Thanks,</span></div><div class=""><span style="font-family:Helvetica;font-size:14px" class="">Dan</span></div><div class=""><span style="font-family:Helvetica;font-size:14px" class=""><br class=""></span></div></div></div></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=0pwJeYbtxS8d23BEAqhh-2FrxSky9HSc1HdnBL80hXWKPXGQ3RpwGCpvApJlb-2BtcCjL3uvjRUf2NNV18fAs8ovx7HgPHose7zMu6XzAmvWxSqJLxeReKiVDvWbaR-2BwauCmoTzVu9wGL6pK5ZOpkQfnCL-2FGelRBrSq5bUeF9ZVZhJDro5zX8zt62r0pvUNEBEHchYC17PdcX7XHHjsy3s4goboawH1R8TiTKkAsFCJSaTQ-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important" class="">
</div>
_______________________________________________<br class="">
swift-users mailing list<br class="">
<a href="mailto:swift-users@swift.org" target="_blank" class="">swift-users@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-users</a><br class="">
</blockquote></div>
</div></blockquote></div><br class=""></div></div></div></div></body></html>