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 31
31
#if !swift (>= 4.2 )
32
32
// This will only be executed if the Swift version is less than 4.2.
33
33
#endif
34
+
35
+ #if !compiler (>= 4.2 )
36
+ // This will only be executed if the Swift compiler version is less than 4.2.
37
+ #endif
34
38
```
35
39
36
40
With the introduction of support for the "<" unary operator, the
@@ -40,6 +44,10 @@ refactored code would be more clear and readable:
40
44
#if swift (< 4.2 )
41
45
// This will only be executed if the Swift version is less than 4.2.
42
46
#endif
47
+
48
+ #if compiler (< 4.2 )
49
+ // This will only be executed if the Swift compiler version is less than 4.2.
50
+ #endif
43
51
```
44
52
45
53
In the former snippet, the ` ! ` can be easily missed in a code
@@ -54,8 +62,8 @@ example.
54
62
## Proposed solution
55
63
56
64
The solution is small change in the parser so that the operator "<" is
57
- supported. Diagnostic messages about invalid unary operators must be
58
- updated as well.
65
+ supported for both the ` #if swift ` and ` #if compiler ` conditions. Diagnostic
66
+ messages about invalid unary operators must be updated as well.
59
67
60
68
## Detailed design
61
69
You can’t perform that action at this time.
0 commit comments