2020-11-09 13:09:34 +00:00
|
|
|
pragma experimental SMTChecker;
|
|
|
|
library L {
|
|
|
|
function l(uint x, uint y) internal pure returns (uint) {
|
|
|
|
return x + y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
contract C {
|
|
|
|
function f(uint u, uint s, bool b) internal pure returns (uint z) {
|
|
|
|
if (b)
|
|
|
|
z = u;
|
|
|
|
else
|
|
|
|
z = s;
|
|
|
|
}
|
|
|
|
|
|
|
|
using L for uint;
|
|
|
|
|
|
|
|
function call() public pure {
|
|
|
|
uint a = 2;
|
|
|
|
uint b = a.l({y: 3});
|
|
|
|
assert(b == 5);
|
|
|
|
b = L.l({x: 3, y: 3});
|
|
|
|
assert(b == 6);
|
|
|
|
b = f({b: true, u: 1, s: 2});
|
|
|
|
assert(b == 1);
|
|
|
|
b = f({b: false, u: 1, s: 2});
|
|
|
|
// Fails, should be 2.
|
|
|
|
assert(b == 6);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// ----
|
2021-01-06 15:34:16 +00:00
|
|
|
// Warning 6328: (507-521): CHC: Assertion violation happens here.\nCounterexample:\n\n\nTransaction trace:\nC.constructor()\nC.call()\n L.l(2, 3) -- internal call\n L.l(3, 3) -- internal call\n C.f(1, 2, true) -- internal call\n C.f(1, 2, false) -- internal call
|