solidity/test/libsolidity/smtCheckerTests/inheritance/overriden_function_static_call_parent.sol

22 lines
699 B
Solidity
Raw Normal View History

2021-01-18 10:40:04 +00:00
pragma experimental SMTChecker;
contract BaseBase {
uint x;
function init(uint a, uint b) public virtual {
x = a;
}
}
contract Base is BaseBase {
function init(uint a, uint b) public override {
}
}
contract Child is Base {
function bInit(uint c, uint d) public {
BaseBase.init(c, d);
assert(x == c);
assert(x == d); // should fail
}
}
// ----
// Warning 5667: (84-90): Unused function parameter. Remove or comment out the variable name to silence this warning.
// Warning 6328: (314-328): CHC: Assertion violation happens here.\nCounterexample:\nx = 0\nc = 0\nd = 1\n\nTransaction trace:\nChild.constructor()\nState: x = 0\nChild.bInit(0, 1)\n BaseBase.init(0, 1) -- internal call