Merge pull request #6649 from ethereum/smt_tuple_asgn

[SMTChecker] Support tuple assignment
This commit is contained in:
chriseth
2019-05-02 18:43:16 +02:00
committed by GitHub
8 changed files with 105 additions and 10 deletions
@@ -0,0 +1,12 @@
pragma experimental SMTChecker;
contract C
{
function g() public pure {
uint x;
uint y;
(x, y) = (2, 4);
assert(x == 2);
assert(y == 4);
}
}
@@ -0,0 +1,12 @@
pragma experimental SMTChecker;
contract C
{
uint[] a;
function g(uint x, uint y) public {
require(x != y);
(a[x], a[y]) = (2, 4);
assert(a[x] == 2);
assert(a[y] == 4);
}
}
@@ -0,0 +1,14 @@
pragma experimental SMTChecker;
contract C
{
uint[] a;
function g(uint x, uint y) public {
require(x != y);
(, a[y]) = (2, 4);
assert(a[x] == 2);
assert(a[y] == 4);
}
}
// ----
// Warning: (136-153): Assertion violation happens here
@@ -0,0 +1,14 @@
pragma experimental SMTChecker;
contract C
{
function g() public pure {
uint x;
uint y;
(x, ) = (2, 4);
assert(x == 2);
assert(y == 4);
}
}
// ----
// Warning: (132-146): Assertion violation happens here
@@ -0,0 +1,13 @@
pragma experimental SMTChecker;
contract C
{
function g() public pure {
(uint x, uint y) = (2, 4);
assert(x == 2);
assert(y == 4);
}
}
// ----
// Warning: (76-101): Assertion checker does not yet support such variable declarations.
// Warning: (105-119): Assertion violation happens here