File tree Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 2
2
3
3
var global : Int = 5
4
4
func testGlobal( ) {
5
- let _ = consume global
5
+ let _ = consume global // expected-warning {{'consume' applied to bitwise-copyable type 'Int' has no effect}}
6
6
}
7
7
8
8
func testLet( ) {
Original file line number Diff line number Diff line change @@ -725,7 +725,14 @@ func consumeInitdArray() {
725
725
func isNegative( _ c: consuming Int ) -> Bool { return c < 0 }
726
726
func consumeInt( ) {
727
727
var g = 0 // expected-warning{{variable 'g' was never mutated; consider changing to 'let' constant}}
728
- isNegative ( consume g) // expected-warning{{result of call to 'isNegative' is unused}}
728
+ // expected-error@-1 {{'g' used after consume}}
729
+
730
+ _ = isNegative ( consume g) // expected-note {{consumed here}}
731
+ // expected-warning@-1 {{'consume' applied to bitwise-copyable type 'Int' has no effect}}
732
+
733
+ _ = isNegative ( consume g) // expected-note {{used here}}
734
+ // expected-error@-1 {{'consume' applied to value that the compiler does not support. This is a compiler bug. Please file a bug with a small example of the bug}}
735
+ // expected-warning@-2 {{'consume' applied to bitwise-copyable type 'Int' has no effect}}
729
736
}
730
737
731
738
//////////////////////
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ class Klass {
6
6
7
7
var global : Int = 5
8
8
func testGlobal( ) {
9
- let _ = consume global
9
+ let _ = consume global // expected-warning {{'consume' applied to bitwise-copyable type 'Int' has no effect}}
10
10
}
11
11
12
12
func testLet( ) {
@@ -23,14 +23,14 @@ func testVar() {
23
23
func testExprFailureLet( ) {
24
24
let t = 5
25
25
// Next line is parsed as move(t) + t
26
- let _ = consume t + t
26
+ let _ = consume t + t // expected-warning {{'consume' applied to bitwise-copyable type 'Int' has no effect}}
27
27
}
28
28
29
29
func testExprFailureVar( ) {
30
30
var t = 5
31
31
t = 5
32
32
// Next line is parsed as move(t) + t
33
- let _ = consume t + t
33
+ let _ = consume t + t // expected-warning {{'consume' applied to bitwise-copyable type 'Int' has no effect}}
34
34
}
35
35
36
36
func letAddressOnly< T> ( _ v: T ) {
You can’t perform that action at this time.
0 commit comments