diff options
author | Leonardo Alt <leo@ethereum.org> | 2019-01-17 20:36:06 +0800 |
---|---|---|
committer | Leonardo Alt <leo@ethereum.org> | 2019-01-17 20:36:53 +0800 |
commit | c96b760c472a134c59deb20c27e5252319c74e2b (patch) | |
tree | f7b2aad0423f3b9c1dcf0de9a3bbdeb2f57a5bd5 | |
parent | d8f663429fb6757df11916ea411f822a5fd0a704 (diff) | |
download | dexon-solidity-c96b760c472a134c59deb20c27e5252319c74e2b.tar.gz dexon-solidity-c96b760c472a134c59deb20c27e5252319c74e2b.tar.zst dexon-solidity-c96b760c472a134c59deb20c27e5252319c74e2b.zip |
Return TypeError is fixed point encoding is attempted.
-rw-r--r-- | Changelog.md | 1 | ||||
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 11 |
2 files changed, 11 insertions, 1 deletions
diff --git a/Changelog.md b/Changelog.md index 7668daa6..a0438b53 100644 --- a/Changelog.md +++ b/Changelog.md @@ -8,6 +8,7 @@ Compiler Features: Bugfixes: + * TypeChecker: Return type error if fixed point encoding is attempted instead of throwing ``UnimplementedFeatureError``. * Yul: Check that arguments to ``dataoffset`` and ``datasize`` are literals at parse time and properly take this into account in the optimizer. * Yul: Parse number literals for detecting duplicate switch cases. * Yul: Require switch cases to have the same type. 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(), |