aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorLeonardo Alt <leo@ethereum.org>2019-01-17 20:36:06 +0800
committerLeonardo Alt <leo@ethereum.org>2019-01-17 20:36:53 +0800
commitc96b760c472a134c59deb20c27e5252319c74e2b (patch)
treef7b2aad0423f3b9c1dcf0de9a3bbdeb2f57a5bd5 /libsolidity
parentd8f663429fb6757df11916ea411f822a5fd0a704 (diff)
downloaddexon-solidity-c96b760c472a134c59deb20c27e5252319c74e2b.tar.gz
dexon-solidity-c96b760c472a134c59deb20c27e5252319c74e2b.tar.zst
dexon-solidity-c96b760c472a134c59deb20c27e5252319c74e2b.zip
Return TypeError is fixed point encoding is attempted.
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index 507a2c94..3d671a71 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -1482,7 +1482,16 @@ void TypeChecker::typeCheckABIEncodeFunctions(
if (argType->category() == Type::Category::RationalNumber)
{
- if (!argType->mobileType())
+ auto const& rationalType = dynamic_cast<RationalNumberType const&>(*argType);
+ if (rationalType.isFractional())
+ {
+ m_errorReporter.typeError(
+ arguments[i]->location(),
+ "Fixed point numbers cannot yet be encoded."
+ );
+ continue;
+ }
+ else if (!argType->mobileType())
{
m_errorReporter.typeError(
arguments[i]->location(),