mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
22 lines
508 B
Solidity
22 lines
508 B
Solidity
pragma experimental SMTChecker;
|
|
contract C {
|
|
int public x;
|
|
|
|
function f() public view {
|
|
int y = 42;
|
|
bool success = false;
|
|
try this.x() returns (int v) {
|
|
y = v;
|
|
try this.x() returns (int w) {
|
|
success = true;
|
|
y = w;
|
|
}
|
|
catch {}
|
|
} catch {}
|
|
assert(!success || y == x); // should hold
|
|
assert(y == 42); // should fail
|
|
}
|
|
}
|
|
// ----
|
|
// Warning 6328: (312-327): CHC: Assertion violation happens here.\nCounterexample:\nx = 0\n\nTransaction trace:\nC.constructor()\nState: x = 0\nC.f()
|