mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
36 lines
706 B
Solidity
36 lines
706 B
Solidity
|
pragma experimental SMTChecker;
|
||
|
|
||
|
contract A {
|
||
|
int public x;
|
||
|
function f() public virtual {
|
||
|
x = 1;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
contract B is A {
|
||
|
function f() public virtual override {
|
||
|
super.f();
|
||
|
x += 100;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
contract C is B {
|
||
|
function f() public virtual override {
|
||
|
super.f();
|
||
|
x += 10;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
contract D is B {
|
||
|
}
|
||
|
|
||
|
contract E is C,D {
|
||
|
function f() public override(C,B) {
|
||
|
super.f();
|
||
|
assert(x == 111); // should hold
|
||
|
assert(x == 13); // should fail
|
||
|
}
|
||
|
}
|
||
|
// ----
|
||
|
// Warning 6328: (412-427): CHC: Assertion violation happens here.\nCounterexample:\nx = 111\n\nTransaction trace:\nE.constructor()\nState: x = 0\nE.f()\n C.f() -- internal call\n B.f() -- internal call\n A.f() -- internal call
|