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 22
33var global : Int = 5
44func testGlobal( ) {
5- let _ = consume global
5+ let _ = consume global // expected-warning {{'consume' applied to bitwise-copyable type 'Int' has no effect}}
66}
77
88func testLet( ) {
Original file line number Diff line number Diff line change @@ -725,7 +725,14 @@ func consumeInitdArray() {
725725func isNegative( _ c: consuming Int ) -> Bool { return c < 0 }
726726func consumeInt( ) {
727727 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}}
729736}
730737
731738//////////////////////
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ class Klass {
66
77var global : Int = 5
88func testGlobal( ) {
9- let _ = consume global
9+ let _ = consume global // expected-warning {{'consume' applied to bitwise-copyable type 'Int' has no effect}}
1010}
1111
1212func testLet( ) {
@@ -23,14 +23,14 @@ func testVar() {
2323func testExprFailureLet( ) {
2424 let t = 5
2525 // 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}}
2727}
2828
2929func testExprFailureVar( ) {
3030 var t = 5
3131 t = 5
3232 // 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}}
3434}
3535
3636func letAddressOnly< T> ( _ v: T ) {
You can’t perform that action at this time.
0 commit comments