aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-06-29 23:41:59 +0800
committerchriseth <chris@ethereum.org>2018-07-03 07:02:00 +0800
commitf7a9c4203e35439de6ff4bdd94c7083c16b73e43 (patch)
treeae55099d02be2a04c769cf4868f57239365d1583 /libsolidity/analysis
parent4649f9202a93f7573d7fb425fbcbdd50e6d4407c (diff)
downloaddexon-solidity-f7a9c4203e35439de6ff4bdd94c7083c16b73e43.tar
dexon-solidity-f7a9c4203e35439de6ff4bdd94c7083c16b73e43.tar.gz
dexon-solidity-f7a9c4203e35439de6ff4bdd94c7083c16b73e43.tar.bz2
dexon-solidity-f7a9c4203e35439de6ff4bdd94c7083c16b73e43.tar.lz
dexon-solidity-f7a9c4203e35439de6ff4bdd94c7083c16b73e43.tar.xz
dexon-solidity-f7a9c4203e35439de6ff4bdd94c7083c16b73e43.tar.zst
dexon-solidity-f7a9c4203e35439de6ff4bdd94c7083c16b73e43.zip
Disallow packed encoding of literals.
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp24
1 files changed, 7 insertions, 17 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index b9e3f8d0..500d4123 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -1702,8 +1702,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)
@@ -1723,23 +1721,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(), "");
}
}
}