mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
32 lines
750 B
Solidity
32 lines
750 B
Solidity
|
pragma experimental SMTChecker;
|
||
|
contract A {
|
||
|
function f() public virtual returns (uint256 r) {
|
||
|
return 1;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
contract B is A {
|
||
|
function f() public virtual override returns (uint256 r) {
|
||
|
return super.f() + 2;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
contract C is A {
|
||
|
function f() public virtual override returns (uint256 r) {
|
||
|
return super.f() + 4;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
contract D is B, C {
|
||
|
function f() public override(B, C) returns (uint256 r) {
|
||
|
r = super.f() + 8;
|
||
|
assert(r == 15); // should hold
|
||
|
assert(r == 13); // should fail
|
||
|
}
|
||
|
}
|
||
|
// ----
|
||
|
// Warning 6328: (469-484): CHC: Assertion violation happens here.\nCounterexample:\n\nr = 15\n\nTransaction trace:\nD.constructor()\nD.f()\n C.f() -- internal call\n B.f() -- internal call\n A.f() -- internal call
|