Explicit conversion between bytes and int of any size

- Allowing aforementioned conversion and adding tests for it
This commit is contained in:
Lefteris Karapetsas 2015-03-17 17:35:18 +01:00
parent ed757ba5bf
commit 8e0f4c7db9

View File

@ -536,14 +536,8 @@ bool FixedBytesType::isImplicitlyConvertibleTo(Type const& _convertTo) const
bool FixedBytesType::isExplicitlyConvertibleTo(Type const& _convertTo) const bool FixedBytesType::isExplicitlyConvertibleTo(Type const& _convertTo) const
{ {
if (_convertTo.getCategory() == Category::Integer) return _convertTo.getCategory() == Category::Integer ||
{ _convertTo.getCategory() == Category::Contract ||
IntegerType const& convertTo = dynamic_cast<IntegerType const&>(_convertTo);
if (m_bytes * 8 <= convertTo.getNumBits())
return true;
}
return _convertTo.getCategory() == Category::Contract ||
_convertTo.getCategory() == getCategory(); _convertTo.getCategory() == getCategory();
} }