<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="">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="font-variant-ligatures: no-common-ligatures; color: #0433ff" class="">func</span> foo() -> <span style="font-variant-ligatures: no-common-ligatures; color: #3495af" class="">Int</span> { <span style="font-variant-ligatures: no-common-ligatures; color: #0433ff" class="">return</span> <span style="font-variant-ligatures: no-common-ligatures; color: #3495af" class="">soon</span> + 1 }</div><div style="margin: 0px; font-size: 15px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; 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="color: rgb(0, 0, 0); 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="font-variant-ligatures: no-common-ligatures; color: #0433ff" class="">func</span> foo() -> <span style="font-variant-ligatures: no-common-ligatures; color: #3495af" class="">Int</span> { <span style="font-variant-ligatures: no-common-ligatures; color: #0433ff" class="">return</span> <span style="font-variant-ligatures: no-common-ligatures; color: #3495af" class="">soon</span> + 1 }</div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #0433ff" class="">let</span> wat = <span style="font-variant-ligatures: no-common-ligatures; color: #0433ff" class="">true</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; 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></body></html>