mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Disallow ambiguous conversions between number literals and bytesXX types.
This commit is contained in:
@@ -2,7 +2,7 @@ contract C {
|
||||
function f() view public {
|
||||
bytes32 x = keccak256("abc");
|
||||
bytes32 y = sha256("abc");
|
||||
address z = ecrecover(bytes32(1), uint8(2), bytes32(3), bytes32(4));
|
||||
address z = ecrecover(bytes32(uint256(1)), uint8(2), bytes32(uint256(3)), bytes32(uint256(4)));
|
||||
require(true);
|
||||
assert(true);
|
||||
x; y; z;
|
||||
@@ -10,12 +10,12 @@ contract C {
|
||||
function g() public {
|
||||
bytes32 x = keccak256("abc");
|
||||
bytes32 y = sha256("abc");
|
||||
address z = ecrecover(bytes32(1), uint8(2), bytes32(3), bytes32(4));
|
||||
address z = ecrecover(bytes32(uint256(1)), uint8(2), bytes32(uint256(3)), bytes32(uint256(4)));
|
||||
require(true);
|
||||
assert(true);
|
||||
x; y; z;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (17-261): Function state mutability can be restricted to pure
|
||||
// Warning: (266-505): Function state mutability can be restricted to pure
|
||||
// Warning: (17-288): Function state mutability can be restricted to pure
|
||||
// Warning: (293-559): Function state mutability can be restricted to pure
|
||||
|
||||
Reference in New Issue
Block a user