mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #6649 from ethereum/smt_tuple_asgn
[SMTChecker] Support tuple assignment
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user