aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorErik Kundt <bitshift@posteo.org>2018-12-07 18:42:53 +0800
committerErik Kundt <bitshift@posteo.org>2018-12-07 19:35:35 +0800
commite2395a3dcf73b224a48e7b434b5526149d3b6254 (patch)
tree1ce16d5de82332694ab8b86839f7de9601ee0809 /libsolidity
parentb2afb8cdda84f7e98fbee652c130bff0d9d30023 (diff)
downloaddexon-solidity-e2395a3dcf73b224a48e7b434b5526149d3b6254.tar.gz
dexon-solidity-e2395a3dcf73b224a48e7b434b5526149d3b6254.tar.zst
dexon-solidity-e2395a3dcf73b224a48e7b434b5526149d3b6254.zip
Adds more detailed type errors and tests.
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/ast/Types.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp
index 0822fb4a..f5a38747 100644
--- a/libsolidity/ast/Types.cpp
+++ b/libsolidity/ast/Types.cpp
@@ -513,7 +513,7 @@ TypeResult AddressType::unaryOperatorResult(Token _operator) const
TypeResult AddressType::binaryOperatorResult(Token _operator, TypePointer const& _other) const
{
if (!TokenTraits::isCompareOp(_operator))
- return TypeResult{"Addresses can only be compared"};
+ return TypeResult{"Arithmetic operations on addresses are not supported. Convert to integer first before using them."};
return Type::commonType(shared_from_this(), _other);
}
@@ -678,7 +678,7 @@ TypeResult IntegerType::binaryOperatorResult(Token _operator, TypePointer const&
if (auto intType = dynamic_pointer_cast<IntegerType const>(commonType))
{
if (Token::Exp == _operator && intType->isSigned())
- return TypeResult{"Signed exponentiation is not allowed"};
+ return TypeResult{"Exponentiation is not allowed for signed integer types."};
}
else if (auto fixType = dynamic_pointer_cast<FixedPointType const>(commonType))
if (Token::Exp == _operator)
@@ -1127,7 +1127,7 @@ TypeResult RationalNumberType::binaryOperatorResult(Token _operator, TypePointer
uint32_t absExp = bigint(abs(exp)).convert_to<uint32_t>();
if (!fitsPrecisionExp(abs(m_value.numerator()), absExp) || !fitsPrecisionExp(abs(m_value.denominator()), absExp))
- return TypeResult{"Precision is limited to 4096 bits"};
+ return TypeResult{"Precision of rational constants is limited to 4096 bits."};
static auto const optimizedPow = [](bigint const& _base, uint32_t _exponent) -> bigint {
if (_base == 1)
@@ -1208,7 +1208,7 @@ TypeResult RationalNumberType::binaryOperatorResult(Token _operator, TypePointer
// verify that numerator and denominator fit into 4096 bit after every operation
if (value.numerator() != 0 && max(mostSignificantBit(abs(value.numerator())), mostSignificantBit(abs(value.denominator()))) > 4096)
- return TypeResult{"Precision is limited to 4096 bits"};
+ return TypeResult{"Precision of rational constants is limited to 4096 bits."};
return TypeResult(make_shared<RationalNumberType>(value));
}