File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 30
30
#if !swift (>= 4.2 )
31
31
// This will only be executed if the Swift version is less than 4.2.
32
32
#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
33
37
```
34
38
35
39
With the introduction of support for the "<" unary operator, the
@@ -39,6 +43,10 @@ refactored code would be more clear and readable:
39
43
#if swift (< 4.2 )
40
44
// This will only be executed if the Swift version is less than 4.2.
41
45
#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
42
50
```
43
51
44
52
In the former snippet, the ` ! ` can be easily missed in a code
@@ -53,8 +61,8 @@ example.
53
61
## Proposed solution
54
62
55
63
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.
58
66
59
67
## Detailed design
60
68
You can’t perform that action at this time.
0 commit comments