aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-08-16 19:52:06 +0800
committerchriseth <chris@ethereum.org>2017-08-16 19:54:28 +0800
commit3d595d4b149e590138f35a6f535c0a20a28e6f04 (patch)
treeeb1cc0d4735e34f121684d6099f4f0c663b850ef /libsolidity/analysis
parent83561e136c992287211f348e0b7bd85b8087fe23 (diff)
downloaddexon-solidity-3d595d4b149e590138f35a6f535c0a20a28e6f04.tar.gz
dexon-solidity-3d595d4b149e590138f35a6f535c0a20a28e6f04.tar.zst
dexon-solidity-3d595d4b149e590138f35a6f535c0a20a28e6f04.zip
Warn about shift of literals.
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index dbc95c4f..ca848dd0 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -1305,8 +1305,9 @@ void TypeChecker::endVisit(BinaryOperation const& _operation)
_operation.leftExpression().annotation().isPure &&
_operation.rightExpression().annotation().isPure;
- if (_operation.getOperator() == Token::Exp)
+ if (_operation.getOperator() == Token::Exp || _operation.getOperator() == Token::SHL)
{
+ string operation = _operation.getOperator() == Token::Exp ? "exponentiation" : "shift";
if (
leftType->category() == Type::Category::RationalNumber &&
rightType->category() != Type::Category::RationalNumber
@@ -1320,7 +1321,7 @@ void TypeChecker::endVisit(BinaryOperation const& _operation)
))
m_errorReporter.warning(
_operation.location(),
- "Result of exponentiation has type " + commonType->toString() + " and thus "
+ "Result of " + operation + " has type " + commonType->toString() + " and thus "
"might overflow. Silence this warning by converting the literal to the "
"expected type."
);