diff --git a/third_party/move/move-compiler-v2/tests/op-equal/invalid6.exp b/third_party/move/move-compiler-v2/tests/op-equal/invalid6.exp new file mode 100644 index 00000000000000..70d243b459dacd --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/op-equal/invalid6.exp @@ -0,0 +1,28 @@ +// -- Model dump before bytecode pipeline +module 0x42::test { + private fun inc_new(x: &u256) { + { + let $t: &u256 = x; + $t = Add(Deref($t), 1) + }; + Tuple() + } + private fun inc_old(x: &u256) { + x = Add(Deref(x), 1); + Tuple() + } +} // end 0x42::test + + +Diagnostics: +error: expected `&mut` but found `&u256` + ┌─ tests/op-equal/invalid6.move:3:10 + │ +3 │ *x = *x + 1; + │ ^ + +error: expected `&mut` but found `&u256` + ┌─ tests/op-equal/invalid6.move:7:11 + │ +7 │ *x += 1; + │ ^ diff --git a/third_party/move/move-compiler-v2/tests/op-equal/invalid6.move b/third_party/move/move-compiler-v2/tests/op-equal/invalid6.move new file mode 100644 index 00000000000000..684e628eacfe05 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/op-equal/invalid6.move @@ -0,0 +1,9 @@ +module 0x42::test { + fun inc_old(x: &u256) { + *x = *x + 1; + } + + fun inc_new(x: &u256) { + *x += 1; + } +}