mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Until now, only ">=" was supported in #if swift() expressions, for example: ```#if swift(>=2.1) ```#endif This means that if we want to evaluate code only when the language version is less than a particular version we need to do the following: ```#if !swift(>=2.1) ```#endif An alernative to make this more readable (the "!" can be easily missed in a code review) is to introduce another supported unary operator, "<". The previous example could be rewritten like this: ```#if swift(<2.1) ```#endif This commit adds support for that unary operator, along with some tests.
2.4 KiB
2.4 KiB