-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Zekun Wang
committed
Sep 26, 2024
1 parent
903542d
commit 7108561
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
third_party/move/move-compiler-v2/tests/op-equal/invalid6.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// -- Model dump before bytecode pipeline | ||
module 0x42::test { | ||
private fun inc_new(x: &u256) { | ||
{ | ||
let $t: &u256 = x; | ||
$t = Add<u256>(Deref($t), 1) | ||
}; | ||
Tuple() | ||
} | ||
private fun inc_old(x: &u256) { | ||
x = Add<u256>(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; | ||
│ ^ |
9 changes: 9 additions & 0 deletions
9
third_party/move/move-compiler-v2/tests/op-equal/invalid6.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module 0x42::test { | ||
fun inc_old(x: &u256) { | ||
*x = *x + 1; | ||
} | ||
|
||
fun inc_new(x: &u256) { | ||
*x += 1; | ||
} | ||
} |