Closed satyamacn closed 1 year ago
The Move prover does not print the correct line number in some error traces. Consider the example below.
public fun test_loop(x: u64) { if (x != 0) { x = 1; } else { x = 2; }; spec { assert x == 1; }; }
The following error trace is given.
error: unknown assertion failed ┌─ ./sources/loop.move:9:9 │ 9 │ assert x == 1; │ ^^^^^^^^^^^^^^ │ = at ./sources/loop.move:1: test_loop = x = 0 = at ./sources/loop.move:2: test_loop = x = 2 = at ./sources/loop.move:8: test_loop = at ./sources/loop.move:9: test_loop
However, the assignment x = 2 occurs at Line 6 rather than Line 2. This pull request will insert at ./sources/loop.move:6: test_loop above x = 2.
x = 2
./sources/loop.move:6: test_loop
cargo test --release
/canary
:sunny: Canary successful
/land
:broken_heart: Test Failed - ci-test
Motivation
The Move prover does not print the correct line number in some error traces. Consider the example below.
The following error trace is given.
However, the assignment
x = 2
occurs at Line 6 rather than Line 2. This pull request will insert at./sources/loop.move:6: test_loop
abovex = 2
.Test Plan
cargo test --release