Support array slices

This commit is contained in:
Leonardo Alt
2020-10-01 11:52:02 +02:00
parent 3af21c92d2
commit c8cc73c80c
14 changed files with 237 additions and 13 deletions
@@ -0,0 +1,12 @@
pragma experimental SMTChecker;
contract C {
function f(bytes calldata b) external pure {
require(b[10] == 0xff);
assert(bytes(b[10:20]).length == 10);
assert(bytes(b[10:20])[0] == 0xff);
assert(bytes(b[10:20])[5] == 0xff);
}
}
// ----
// Warning 6328: (198-232): CHC: Assertion violation happens here.
@@ -0,0 +1,17 @@
pragma experimental SMTChecker;
contract C {
function f(bytes calldata b) external pure {
require(b.length == 30);
require(b[10] == 0xff);
require(b[b.length - 1] == 0xaa);
assert(bytes(b[10:]).length == 20);
assert(bytes(b[10:])[0] == 0xff);
assert(bytes(b[10:])[5] == 0xff);
assert(bytes(b[10:])[19] == 0xaa);
}
}
// ----
// Warning 4661: (221-253): BMC: Assertion violation happens here.
// Warning 4661: (257-289): BMC: Assertion violation happens here.
// Warning 4661: (293-326): BMC: Assertion violation happens here.
@@ -0,0 +1,13 @@
pragma experimental SMTChecker;
contract C {
function f(bytes calldata b) external pure {
require(b[0] == 0xff);
assert(bytes(b[:20]).length == 20);
assert(bytes(b[:20])[0] == 0xff);
assert(bytes(b[:20])[5] == 0xff);
}
}
// ----
// Warning 6328: (193-225): CHC: Assertion violation happens here.
// Warning 4661: (157-189): BMC: Assertion violation happens here.
@@ -8,6 +8,3 @@ contract C {
}
}
// ----
// Warning 2923: (94-109): Assertion checker does not yet implement this expression.
// Warning 2923: (113-128): Assertion checker does not yet implement this expression.
// Warning 2923: (132-165): Assertion checker does not yet implement this expression.
@@ -5,5 +5,4 @@ contract C {
}
}
// ----
// Warning 2923: (143-152): Assertion checker does not yet implement this expression.
// Warning 4588: (126-154): Assertion checker does not yet implement this type of function call.
@@ -8,6 +8,3 @@ contract C {
}
}
// ----
// Warning 2923: (100-115): Assertion checker does not yet implement this expression.
// Warning 2923: (126-141): Assertion checker does not yet implement this expression.
// Warning 2923: (152-185): Assertion checker does not yet implement this expression.