diff options
author | chriseth <chris@ethereum.org> | 2018-07-11 20:28:20 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-11 20:28:20 +0800 |
commit | 238dbe1b9904cee916089ab51b81a5368b80dda3 (patch) | |
tree | b1c42459ae4cce29241b4e2a933bd6649e0c3b7c /libsolidity/analysis | |
parent | 28ac3f0a6c8c532e79aaa3bff1e1a7d8ac7d8cb0 (diff) | |
parent | f7a9c4203e35439de6ff4bdd94c7083c16b73e43 (diff) | |
download | dexon-solidity-238dbe1b9904cee916089ab51b81a5368b80dda3.tar.gz dexon-solidity-238dbe1b9904cee916089ab51b81a5368b80dda3.tar.zst dexon-solidity-238dbe1b9904cee916089ab51b81a5368b80dda3.zip |
Merge pull request #4388 from ethereum/noPackedLiterals
Disallow packed encoding of literals.
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index d181462e..071ac9fe 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -1651,8 +1651,6 @@ bool TypeChecker::visit(FunctionCall const& _functionCall) else _functionCall.annotation().type = make_shared<TupleType>(returnTypes); - bool const v050 = m_scope->sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::V050); - if (auto functionName = dynamic_cast<Identifier const*>(&_functionCall.expression())) { if (functionName->name() == "sha3" && functionType->kind() == FunctionType::Kind::SHA3) @@ -1672,23 +1670,15 @@ bool TypeChecker::visit(FunctionCall const& _functionCall) auto const& argType = type(*arguments[i]); if (auto literal = dynamic_cast<RationalNumberType const*>(argType.get())) { - /* If no mobile type is available an error will be raised elsewhere. */ if (literal->mobileType()) + m_errorReporter.typeError( + arguments[i]->location(), + "Cannot perform packed encoding for a literal. Please convert it to an explicit type first." + ); + else { - if (v050) - m_errorReporter.typeError( - arguments[i]->location(), - "Cannot perform packed encoding for a literal. Please convert it to an explicit type first." - ); - else - m_errorReporter.warning( - arguments[i]->location(), - "The type of \"" + - argType->toString() + - "\" was inferred as " + - literal->mobileType()->toString() + - ". This is probably not desired. Use an explicit type to silence this warning." - ); + /* If no mobile type is available an error will be raised elsewhere. */ + solAssert(m_errorReporter.hasErrors(), ""); } } } |