Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type check error when trying to access the last element of an empty vector #154

Open
BorisI opened this issue May 4, 2024 · 0 comments
Open

Comments

@BorisI
Copy link
Collaborator

BorisI commented May 4, 2024

pragma ton-solidity >= 0.74.0;

contract tce_vec {
function pop() external pure {
vector(uint) v;
v.pop();
}
function last() external pure {
vector(uint) v;
v.last();
}
}

NB: vector.pop() and vector.last() fail with the same error code but in two different spots with different diagnostic messages:

$ ever-cli -c etc/tce_vec.conf debug run -m pop | tail -n7 trace.log | head -n-4
57 2120 26 TUPLE 0 tce_vec.sol:5
58 2146 26 TPOP tce_vec.sol:6
59 2196 0 UNHANDLED EXCEPTION: VM Exception: type check error, code 7, value: 0 .../ever-vm/src/error.rs:86 CMD: TPOP err: TypeCheckError tce_vec.sol:6

$ ever-cli -c etc/tce_vec.conf debug run -m last | tail -n7 trace.log | head -n-4
57 2020 26 TUPLE 0 tce_vec.sol:9
58 2046 26 LAST tce_vec.sol:10
59 2096 0 UNHANDLED EXCEPTION: VM Exception: type check error, code 7, value: 0 .../ever-vm/src/executor/tuple.rs:366 CMD: LAST err: tuple is empty tce_vec.sol:10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant