solidity/test/libsolidity/syntaxTests/globalFunctions/sha256_with_wrong_arg_count.sol
2022-04-01 23:41:18 -05:00

12 lines
1013 B
Solidity

contract C {
function f() public {
require(sha256() != 0);
require(sha256(uint(1)) != 0);
require(sha256(uint(1), uint(2)) != 0);
}
}
// ----
// TypeError 4323: (55-63='sha256()'): Wrong argument count for function call: 0 arguments given but expected 1. This function requires a single bytes argument. Use abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...) to use ABI encoding.
// TypeError 7556: (94-101='uint(1)'): Invalid type for argument in function call. Invalid implicit conversion from uint256 to bytes memory requested. This function requires a single bytes argument. Use abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...) to use ABI encoding.
// TypeError 4323: (126-150='sha256(uint(1), uint(2))'): Wrong argument count for function call: 2 arguments given but expected 1. This function requires a single bytes argument. Use abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...) to use ABI encoding.