File tree Expand file tree Collapse file tree 2 files changed +46
-6
lines changed Expand file tree Collapse file tree 2 files changed +46
-6
lines changed Original file line number Diff line number Diff line change @@ -3882,20 +3882,17 @@ ${assignmentOperatorComment(x.operator, True)}
3882
3882
return ! ( lhs == rhs)
3883
3883
}
3884
3884
3885
- @inlinable // FIXME(sil-serialize-all)
3886
- @inline( __always )
3885
+ @_transparent
3887
3886
public static func <= ( lhs: ${ Self} , rhs: ${ Self} ) -> Bool {
3888
3887
return ! ( rhs < lhs )
3889
3888
}
3890
3889
3891
- @inlinable // FIXME(sil-serialize-all)
3892
- @inline ( __always)
3890
+ @_transparent
3893
3891
public static func >= ( lhs: ${ Self} , rhs : ${ Self} ) -> Bool {
3894
3892
return ! ( lhs < rhs )
3895
3893
}
3896
3894
3897
- @inlinable // FIXME(sil-serialize-all)
3898
- @inline ( __always)
3895
+ @_transparent
3899
3896
public static func > ( lhs: ${ Self} , rhs: ${ Self} ) -> Bool {
3900
3897
return rhs < lhs
3901
3898
}
Original file line number Diff line number Diff line change @@ -15,6 +15,49 @@ func ifTrue() -> Int {
15
15
return 0 // expected-warning {{will never be executed}}
16
16
}
17
17
18
+ func testUnreachableIfBranch( ) -> Int {
19
+ let a = 2
20
+ let c : Int
21
+ if a < 2 { // expected-note {{condition always evaluates to false}}
22
+ c = 3 // expected-warning {{will never be executed}}
23
+ } else {
24
+ c = 4
25
+ }
26
+ return c
27
+ }
28
+
29
+ func testUnreachableIfBranch2( ) -> Int {
30
+ let a = 2
31
+ let c : Int
32
+ if a > 2 { // expected-note {{condition always evaluates to false}}
33
+ c = 3 // expected-warning {{will never be executed}}
34
+ } else {
35
+ c = 4
36
+ }
37
+ return c
38
+ }
39
+
40
+ func testUnreachableElseBranch( ) -> Int {
41
+ let a = 2
42
+ let c : Int
43
+ if a == 2 { // expected-note {{condition always evaluates to true}}
44
+ c = 3
45
+ } else {
46
+ c = 4 // expected-warning {{will never be executed}}
47
+ }
48
+ return c
49
+ }
50
+
51
+ // FIXME: False Negative: <rdar://39516135>. No warnings are produced here
52
+ // as the statements along the unreachable branches are marked implicit.
53
+ // Unreachable code analysis suppresses warnings in such cases.
54
+ func testQuestionMarkOperator( ) -> Int {
55
+ let a = 2
56
+ let c : Int
57
+ c = ( a < 2 ) ? 3 : 4
58
+ return c
59
+ }
60
+
18
61
// Work-around <rdar://problem/17687851> by ensuring there is
19
62
// something that appears to be user code in unreachable blocks.
20
63
func userCode( ) { }
You can’t perform that action at this time.
0 commit comments