<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I think the source breakage here, if any in actual codebases, is minor enough that the patch could go through. </div><div class=""><br class=""></div><div class="">~Robert Widmann</div><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 8, 2017, at 2:11 AM, rintaro ishizaki via swift-dev <<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi all,<br class=""><br class="">I'm fixing <font face="monospace, monospace" class="">#if</font> condition processing in this PR<br class=""><div class=""><a href="https://github.com/apple/swift/pull/7955" class="">https://github.com/apple/swift/pull/7955</a><br class=""><br class="">It resolves these issues:</div><div class=""><br class=""><div class=""><b class="">A) <a href="https://bugs.swift.org/browse/SR-3663" class="">SR-3663</a>: Precedence of '&&' and '||' and short-circuit rule of them.<br class=""></b><br class=""><pre style="box-sizing:border-box;font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:13.6px;margin-top:0px;margin-bottom:0px;font-stretch:normal;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(246,248,250);border-radius:3px;word-break:normal;color:rgb(36,41,46)" class="">#<span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">if</span> <span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">false</span> || true && false<span class="gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"></span>
<span class="gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"> print("true")</span>
<span class="gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"></span>#<span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">endif</span></pre><div class=""><br class=""></div><div class="">This used to evaluate to '<font face="monospace, monospace" class="">true</font>'.</div><div class=""><br class=""></div><b class="">B) <a href="https://bugs.swift.org/browse/SR-4032" class="">SR-4032</a>: Version check with binary operator.<br class=""></b><br class=""><pre style="box-sizing:border-box;font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:13.6px;margin-top:0px;margin-bottom:0px;font-stretch:normal;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(246,248,250);border-radius:3px;word-break:normal;color:rgb(36,41,46)" class="">#<span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">if</span> <span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">swift</span>(<span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">>=</span><span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">5.0</span>) <span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">&&</span> FOO
Some Swift <span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">5</span> code here
#<span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">endif</span></pre><div class=""><br class=""></div><div class="">I believe, this block should not be parsed.</div><div class=""><br class=""></div><b class="">C) <a href="https://bugs.swift.org/browse/SR-3663" class="">SR-3663</a>: Invalid condition after short-circuit binary operator.<br class=""></b><br class=""><pre style="box-sizing:border-box;font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:13.6px;margin-top:0px;margin-bottom:0px;font-stretch:normal;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(246,248,250);border-radius:3px;word-break:normal;color:rgb(36,41,46)" class="">#<span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">if</span> <span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">true</span> <span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">||</span> <span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">true</span> * This is not <acceptable>!
#<span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">endif</span></pre><div class=""><br class=""></div><div class="">This used to be accepted.</div><div class=""><br class=""></div><b class="">D) <a href="https://bugs.swift.org/browse/SR-4031" class="">SR-4031</a>: Compound name in the condition<br class=""></b><br class=""><div class=""><pre style="box-sizing:border-box;font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:13.6px;margin-top:0px;margin-bottom:0px;font-stretch:normal;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(246,248,250);border-radius:3px;word-break:normal;color:rgb(36,41,46)" class="">#<span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">if</span> FOO(_:)
#<span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">elseif</span> os(foo:)(macOS)
#<span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">elseif</span> os(Linux(foo:bar:))
#<span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">endif</span></pre><br class=""></div></div></div><div class="">This used to be accepted.</div><div class=""><br class=""></div><div class="">In the PR, I keep A) and B) behavior in <font face="monospace, monospace" class="">-swift-version 3</font> mode.</div><div class="">However, as for C) and D), I don't think it's worth to keep them even in Swift3 mode, because they are obviously wrong.</div><div class=""><br class=""></div><div class="">What do you think? Do we need accept them in Swift3 mode?</div></div>
_______________________________________________<br class="">swift-dev mailing list<br class=""><a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-dev<br class=""></div></blockquote></div><br class=""></body></html>