aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLefteris Karapetsas <lefteris@refu.co>2015-03-18 00:35:18 +0800
committerLefteris Karapetsas <lefteris@refu.co>2015-03-18 17:57:24 +0800
commit8e0f4c7db972950215d807bd0e17b7998e22b0db (patch)
tree53031705217127a0f131668cf61f4959d52bb0e0
parented757ba5bf1090ba8a9a5e3e6a29da8785afb861 (diff)
downloaddexon-solidity-8e0f4c7db972950215d807bd0e17b7998e22b0db.tar
dexon-solidity-8e0f4c7db972950215d807bd0e17b7998e22b0db.tar.gz
dexon-solidity-8e0f4c7db972950215d807bd0e17b7998e22b0db.tar.bz2
dexon-solidity-8e0f4c7db972950215d807bd0e17b7998e22b0db.tar.lz
dexon-solidity-8e0f4c7db972950215d807bd0e17b7998e22b0db.tar.xz
dexon-solidity-8e0f4c7db972950215d807bd0e17b7998e22b0db.tar.zst
dexon-solidity-8e0f4c7db972950215d807bd0e17b7998e22b0db.zip
Explicit conversion between bytes and int of any size
- Allowing aforementioned conversion and adding tests for it
-rw-r--r--Types.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/Types.cpp b/Types.cpp
index 04f86b92..4b5dddac 100644
--- a/Types.cpp
+++ b/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();
}