mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Clarified binary operator checking for integer types.
This commit is contained in:
parent
7dc7827907
commit
8442974617
20
Types.cpp
20
Types.cpp
@ -201,17 +201,17 @@ TypePointer IntegerType::binaryOperatorResultImpl(Token::Value _operator, TypePo
|
|||||||
if (!commonType)
|
if (!commonType)
|
||||||
return TypePointer();
|
return TypePointer();
|
||||||
|
|
||||||
|
// All integer types can be compared
|
||||||
|
if (Token::isCompareOp(_operator))
|
||||||
|
return commonType;
|
||||||
|
|
||||||
|
// Nothing else can be done with addresses, but hashes can receive bit operators
|
||||||
if (commonType->isAddress())
|
if (commonType->isAddress())
|
||||||
{
|
return TypePointer();
|
||||||
if (!Token::isCompareOp(_operator))
|
else if (commonType->isHash() && !Token::isBitOp(_operator))
|
||||||
return TypePointer();
|
return TypePointer();
|
||||||
}
|
else
|
||||||
else if (commonType->isHash())
|
return commonType;
|
||||||
{
|
|
||||||
if (!(Token::isCompareOp(_operator) || Token::isBitOp(_operator)))
|
|
||||||
return TypePointer();
|
|
||||||
}
|
|
||||||
return commonType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const MemberList IntegerType::AddressMemberList =
|
const MemberList IntegerType::AddressMemberList =
|
||||||
|
Loading…
Reference in New Issue
Block a user