Static Analyzer for Solidity
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
slither/tests/detectors/boolean-constant-equality/0.5.16/boolean-constant-equality.sol

27 lines
578 B

contract MyConc {
function bad0(bool foo) public pure returns (bool) {
if (foo) {
return true;
}
}
function bad1(bool b) public pure returns (bool) {
return (b == true);
}
function bad2(bool x, uint8 y) public pure returns (bool) {
if (x == (y > 0)) {
return true;
}
}
function bad3() public pure returns (bool) {
uint256 a;
if (a == 10) {
return true;
}
}
function good(uint8 a) public pure returns (bool) {
return a >= 1;
}
}