Merge pull request #6652 from ethereum/smt_tuple_function

[SMTChecker] Support tuples as function calls with multiple return values
This commit is contained in:
Leonardo
2019-05-06 15:19:24 +02:00
committed by GitHub
8 changed files with 96 additions and 32 deletions
@@ -10,3 +10,4 @@ contract C
assert(y == 4);
}
}
// ----
@@ -0,0 +1,17 @@
pragma experimental SMTChecker;
contract C
{
function f() internal pure returns (uint, uint) {
return (2, 3);
}
function g() public pure {
uint x;
uint y;
(x,y) = f();
assert(x == 1);
assert(y == 4);
}
}
// ----
// Warning: (182-196): Assertion violation happens here
@@ -0,0 +1,17 @@
pragma experimental SMTChecker;
contract C
{
function f() internal pure returns (uint, uint) {
return (2, 3);
}
function g() public pure {
uint x;
uint y;
(x,) = f();
assert(x == 2);
assert(y == 4);
}
}
// ----
// Warning: (199-213): Assertion violation happens here
@@ -0,0 +1,19 @@
pragma experimental SMTChecker;
contract C
{
function f() internal pure returns (uint, bool, uint) {
return (2, false, 3);
}
function g() public pure {
uint x;
uint y;
bool b;
(,b,) = f();
assert(x == 2);
assert(y == 4);
assert(!b);
}
}
// ----
// Warning: (205-219): Assertion violation happens here
@@ -3,9 +3,9 @@
{
"smtlib2responses":
{
"0x47a038dd9021ecb218726ea6bf1f75c215a50b1981bae4341e89c9f2b7ac5db7": "sat\n((|EVALEXPR_0| 1))\n",
"0xf057b272f2ceb99a2f714cb132960babdeedfb84ff8ffb96106a58bc0c2060cb": "sat\n((|EVALEXPR_0| 0))\n",
"0xf49b9d0eb7b6d2f2ac9e1604288e52ee1a08cda57058e26d7843ed109ca6d7c9": "unsat\n"
"0x092d52dc5c2b54c1909592f7b3c8efedfd87afc0223ce421a24a1cc7905006b4": "sat\n((|EVALEXPR_0| 1))\n",
"0x8faacfc008b6f2278b5927ff22d76832956dfb46b3c21a64fab96583c241b88f": "unsat\n",
"0xa66d08de30c873ca7d0e7e9e426f278640e0ee463a1aed2e4e80baee916b6869": "sat\n((|EVALEXPR_0| 0))\n"
}
}
}
@@ -3,7 +3,7 @@
{
"smtlib2responses":
{
"0xf057b272f2ceb99a2f714cb132960babdeedfb84ff8ffb96106a58bc0c2060cb": "sat\n((|EVALEXPR_0| 0))\n"
"0xa66d08de30c873ca7d0e7e9e426f278640e0ee463a1aed2e4e80baee916b6869": "sat\n((|EVALEXPR_0| 0))\n"
}
}
}