mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Explicit conversion between bytes and int of any size
- Allowing aforementioned conversion and adding tests for it
This commit is contained in:
parent
ed757ba5bf
commit
8e0f4c7db9
10
Types.cpp
10
Types.cpp
@ -536,14 +536,8 @@ bool FixedBytesType::isImplicitlyConvertibleTo(Type const& _convertTo) const
|
||||
|
||||
bool FixedBytesType::isExplicitlyConvertibleTo(Type const& _convertTo) const
|
||||
{
|
||||
if (_convertTo.getCategory() == Category::Integer)
|
||||
{
|
||||
IntegerType const& convertTo = dynamic_cast<IntegerType const&>(_convertTo);
|
||||
if (m_bytes * 8 <= convertTo.getNumBits())
|
||||
return true;
|
||||
}
|
||||
|
||||
return _convertTo.getCategory() == Category::Contract ||
|
||||
return _convertTo.getCategory() == Category::Integer ||
|
||||
_convertTo.getCategory() == Category::Contract ||
|
||||
_convertTo.getCategory() == getCategory();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user