Skip to content

Commit

Permalink
fixup! motoko-san: fix bug with array initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
GoPavel committed May 6, 2024
1 parent 5707d5b commit 643c8de
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
5 changes: 5 additions & 0 deletions test/viper/array.mo
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ actor {
vm_a := [var 42];
// lm_a := [1, 2]; // error

assert:system vi_a[0] != 0;
assert:system vi_a[0] == 1;
assert:system vm_a[0] != 1;
assert:system vm_a[0] == 42;

return 42;
};

Expand Down
8 changes: 4 additions & 4 deletions test/viper/ok/array.tc.ok
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
array.mo:7.9-7.10: warning [M0194], unused identifier f (delete or rename to wildcard `_` or `_f`)
array.mo:8.9-8.14: warning [M0194], unused identifier count (delete or rename to wildcard `_` or `_count`)
array.mo:37.18-37.22: warning [M0194], unused identifier baz2 (delete or rename to wildcard `_` or `_baz2`)
array.mo:42.18-42.21: warning [M0194], unused identifier bar (delete or rename to wildcard `_` or `_bar`)
array.mo:46.11-46.12: warning [M0194], unused identifier z (delete or rename to wildcard `_` or `_z`)
array.mo:54.11-54.12: warning [M0194], unused identifier z (delete or rename to wildcard `_` or `_z`)
array.mo:42.18-42.22: warning [M0194], unused identifier baz2 (delete or rename to wildcard `_` or `_baz2`)
array.mo:47.18-47.21: warning [M0194], unused identifier bar (delete or rename to wildcard `_` or `_bar`)
array.mo:51.11-51.12: warning [M0194], unused identifier z (delete or rename to wildcard `_` or `_z`)
array.mo:59.11-59.12: warning [M0194], unused identifier z (delete or rename to wildcard `_` or `_z`)
4 changes: 4 additions & 0 deletions test/viper/ok/array.vpr.ok
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ method foo($Self: Ref)
inhale ($size(vm_a_2) == 1)
($loc(vm_a_2, 0)).$int := 42
vm_a := vm_a_2
assert (($loc(vi_a, 0)).$int != 0)
assert (($loc(vi_a, 0)).$int == 1)
assert (($loc(vm_a, 0)).$int != 1)
assert (($loc(vm_a, 0)).$int == 42)
$Res := 42
goto $Ret
label $Ret
Expand Down
8 changes: 4 additions & 4 deletions test/viper/ok/array.vpr.stderr.ok
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
array.mo:7.9-7.10: warning [M0194], unused identifier f (delete or rename to wildcard `_` or `_f`)
array.mo:8.9-8.14: warning [M0194], unused identifier count (delete or rename to wildcard `_` or `_count`)
array.mo:37.18-37.22: warning [M0194], unused identifier baz2 (delete or rename to wildcard `_` or `_baz2`)
array.mo:42.18-42.21: warning [M0194], unused identifier bar (delete or rename to wildcard `_` or `_bar`)
array.mo:46.11-46.12: warning [M0194], unused identifier z (delete or rename to wildcard `_` or `_z`)
array.mo:54.11-54.12: warning [M0194], unused identifier z (delete or rename to wildcard `_` or `_z`)
array.mo:42.18-42.22: warning [M0194], unused identifier baz2 (delete or rename to wildcard `_` or `_baz2`)
array.mo:47.18-47.21: warning [M0194], unused identifier bar (delete or rename to wildcard `_` or `_bar`)
array.mo:51.11-51.12: warning [M0194], unused identifier z (delete or rename to wildcard `_` or `_z`)
array.mo:59.11-59.12: warning [M0194], unused identifier z (delete or rename to wildcard `_` or `_z`)

0 comments on commit 643c8de

Please sign in to comment.