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-cst/0.4.25/boolean-constant-misuse.sol

46 lines
923 B

contract MyConc {
function bad0(bool foo) public pure returns (bool) {
if (foo) {
return true;
}
return false;
}
function bad1(bool b) public pure returns (bool) {
return (b || true);
}
function bad2(bool x, uint8 y) public pure returns (bool) {
while (x == (y > 0)) {
return true;
}
return false;
}
function bad3(bool a) public pure returns (bool) {
uint256 b = 0;
while (a) {
b++;
}
return true;
}
function bad4() public pure returns (bool) {
uint256 b = 0;
while (true) {
b++;
}
return true;
}
function bad5() public pure returns (bool) {
while (true) {
return true;
}
return false;
}
function good() public pure returns (bool) {
return true;
}
}