<div dir="ltr">hi Dan, <div><span style="line-height:1.5"><br></span></div><div><span style="line-height:1.5">Seems to work when using Swift 2.2 Snapshot from 6th of jan: </span><br></div><div><br></div><div><div style="margin:0px"><div style="font-family:Menlo;font-size:15px;line-height:normal;margin:0px">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"> 1> func foo() -> Int { return soon + 1 } </div><div style="font-family:Menlo;font-size:15px;line-height:normal;margin:0px"> 2. let wat = true </div><div style="font-family:Menlo;font-size:15px;line-height:normal;margin:0px"> 3. let soon = 1</div><div style="font-family:Menlo;font-size:15px;line-height:normal;margin:0px">wat: Bool = true</div><div style="font-family:Menlo;font-size:15px;line-height:normal;margin:0px">soon: Int = 1</div><div style="font-family:Menlo;font-size:15px;line-height:normal;margin:0px"> 4> foo()</div><div style="font-family:Menlo;font-size:15px;line-height:normal;margin:0px">$R0: Int = 2</div><div style="font-family:Menlo;font-size:15px;line-height:normal;margin:0px"><br></div><div style="margin:0px">I am able to reproduce the bug on a playground though where swift 2.1 is used I guess. </div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Sat, Jan 9, 2016 at 10:44 PM Dan Cutting via swift-users <<a href="mailto:swift-users@swift.org">swift-users@swift.org</a>> wrote:<br></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">Hi,<div><br></div><div><div>This code builds and runs fine:</div><div><div><br></div><div><div style="margin:0px;font-size:15px;line-height:normal;font-family:Menlo"><span style="color:#0433ff">func</span> foo() -> <span style="color:#3495af">Int</span> { <span style="color:#0433ff">return</span> <span style="color:#3495af">soon</span> + 1 }</div><div style="margin:0px;font-size:15px;line-height:normal;font-family:Menlo"><span style="color:#0433ff">let</span> soon = 1</div><div style="margin:0px;font-size:15px;line-height:normal;font-family:Menlo;color:rgb(0,143,0)"><br></div></div><div style="margin:0px;line-height:normal"><div style="margin:0px;line-height:normal">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)"><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:14px"><br></span></div></div></div><div><div style="margin:0px;font-size:15px;line-height:normal;font-family:Menlo"><div style="margin:0px;line-height:normal"><span style="color:#0433ff">func</span> foo() -> <span style="color:#3495af">Int</span> { <span style="color:#0433ff">return</span> <span style="color:#3495af">soon</span> + 1 }</div><div style="margin:0px;line-height:normal"><span style="color:#0433ff">let</span> wat = <span style="color:#0433ff">true</span></div><div style="margin:0px;line-height:normal"><span style="color:#0433ff">let</span> soon = 1</div><div><br></div><div><span style="font-family:Helvetica;font-size:14px">Any ideas why? Is this a bug in Swift or intended behaviour?</span></div><div><span style="font-family:Helvetica;font-size:14px"><br></span></div><div><span style="font-family:Helvetica;font-size:14px">I might expect either or neither of these to work, but to have one work and one fail is perplexing.</span></div><div><span style="font-family:Helvetica;font-size:14px"><br></span></div><div><span style="font-family:Helvetica;font-size:14px">Thanks,</span></div><div><span style="font-family:Helvetica;font-size:14px">Dan</span></div><div><span style="font-family:Helvetica;font-size:14px"><br></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">
</div>
_______________________________________________<br>
swift-users mailing list<br>
<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-users</a><br>
</blockquote></div>