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:
+1
-1
@@ -444,7 +444,7 @@ For example,
|
||||
pragma solidity >0.4.24;
|
||||
|
||||
contract Test {
|
||||
constructor() public { b = 0x12345678901234567890123456789012; }
|
||||
constructor() public { b = hex"12345678901234567890123456789012"; }
|
||||
event Event(uint indexed a, bytes32 b);
|
||||
event Event2(uint indexed a, bytes32 b);
|
||||
function foo(uint a) public { emit Event(a, b); }
|
||||
|
||||
+3
-4
@@ -114,8 +114,7 @@ This means that cyclic creation dependencies are impossible.
|
||||
returns (bool ok)
|
||||
{
|
||||
// Check some arbitrary condition.
|
||||
address tokenAddress = msg.sender;
|
||||
return (keccak256(abi.encodePacked(newOwner)) & 0xff) == (bytes20(tokenAddress) & 0xff);
|
||||
return currentOwner != newOwner;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -811,12 +810,12 @@ as topics. The event call above can be performed in the same way as
|
||||
|
||||
contract C {
|
||||
function f() public payable {
|
||||
bytes32 _id = 0x420042;
|
||||
uint256 _id = 0x420042;
|
||||
log3(
|
||||
bytes32(msg.value),
|
||||
bytes32(0x50cb9fe53daa9737b786ab3646f04d0150dc50ef4e75f59509d83667ad5adb20),
|
||||
bytes32(uint256(msg.sender)),
|
||||
_id
|
||||
bytes32(_id)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -773,7 +773,7 @@ Members
|
||||
// but can be treated identical to "uint8[]"
|
||||
m_byteData = data;
|
||||
m_byteData.length += 7;
|
||||
m_byteData[3] = byte(8);
|
||||
m_byteData[3] = 0x08;
|
||||
delete m_byteData[2];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user