[swift-dev] Fixing complation condition processing
rintaro ishizaki
fs.output at gmail.com
Wed Mar 8 01:11:43 CST 2017
Hi all,
I'm fixing #if condition processing in this PR
https://github.com/apple/swift/pull/7955
It resolves these issues:
*A) SR-3663 <https://bugs.swift.org/browse/SR-3663>: Precedence of '&&' and
'||' and short-circuit rule of them.*
#if false || true && false print("true")#endif
This used to evaluate to 'true'.
*B) SR-4032 <https://bugs.swift.org/browse/SR-4032>: Version check with
binary operator.*
#if swift(>=5.0) && FOO
Some Swift 5 code here
#endif
I believe, this block should not be parsed.
*C) SR-3663 <https://bugs.swift.org/browse/SR-3663>: Invalid condition
after short-circuit binary operator.*
#if true || true * This is not <acceptable>!
#endif
This used to be accepted.
*D) SR-4031 <https://bugs.swift.org/browse/SR-4031>: Compound name in the
condition*
#if FOO(_:)
#elseif os(foo:)(macOS)
#elseif os(Linux(foo:bar:))
#endif
This used to be accepted.
In the PR, I keep A) and B) behavior in -swift-version 3 mode.
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.
What do you think? Do we need accept them in Swift3 mode?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20170308/251ca90d/attachment.html>
More information about the swift-dev
mailing list