Closed
Description
function bounded(uint256 value, uint256 min, uint256 max) private pure returns (uint256) {
return value < min ? min : value > max ? max : value;
}
Instrumenting this code with solidity-coverage fails with errors like these:
TypeError: True expression's type uint256 does not match false expression's type bool.
--> contracts/MVP.sol:43:10:
|
43 | return ((((value < min && c_trueceeaad3d(0xb57143507adc733b)) || c_falseceeaad3d(0x92234262f887204f)) ? min : value > max && c_trueceeaad3d(0x5923ce7a7e1a34e5)) || c_falseceeaad3d(0x8ad90b3a2b2c ...
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Operator || not compatible with types uint256 and bool
--> contracts/MVP.sol:43:9:
|
43 | return ((((value < min && c_trueceeaad3d(0x ... c_falseceeaad3d(0x8ad90b3a2b2c4f8a)) ? max : value;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Type uint256 is not implicitly convertible to expected type bool.
--> contracts/MVP.sol:43:8:
|
43 | return ((((value < min && c_trueceeaad3d(0 ... _falseceeaad3d(0x8ad90b3a2b2c4f8a)) ? max : value;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in plugin solidity-coverage: HardhatError: HH600: Compilation failed
Metadata
Metadata
Assignees
Labels
No labels
Activity