Skip to content

Commit cd53d56

Browse files
committed
Amend SE-0224 to include #if compiler as well.
1 parent e6339e9 commit cd53d56

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

proposals/0224-ifswift-lessthan-operator.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ code:
3030
#if !swift(>=4.2)
3131
// This will only be executed if the Swift version is less than 4.2.
3232
#endif
33+
34+
#if !compiler(>=4.2)
35+
// This will only be executed if the Swift compiler version is less than 4.2.
36+
#endif
3337
```
3438

3539
With the introduction of support for the "<" unary operator, the
@@ -39,6 +43,10 @@ refactored code would be more clear and readable:
3943
#if swift(<4.2)
4044
// This will only be executed if the Swift version is less than 4.2.
4145
#endif
46+
47+
#if compiler(<4.2)
48+
// This will only be executed if the Swift compiler version is less than 4.2.
49+
#endif
4250
```
4351

4452
In the former snippet, the `!` can be easily missed in a code
@@ -53,8 +61,8 @@ example.
5361
## Proposed solution
5462

5563
The solution is small change in the parser so that the operator "<" is
56-
supported. Diagnostic messages about invalid unary operators must be
57-
updated as well.
64+
supported for both the `#if swift` and `#if compiler` conditions. Diagnostic
65+
messages about invalid unary operators must be updated as well.
5866

5967
## Detailed design
6068

0 commit comments

Comments
 (0)