aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2018-05-16 17:12:25 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2018-05-16 17:12:25 +0800
commit221a4d1f1f8a644ef9905f8f1d4a9a4428ec0489 (patch)
tree46b41743c2057f2ea8dd08619337ca1905bd1483 /libsolidity/analysis
parent23adea88fdc7eafc5b67b759b4c2418bd6b93aa6 (diff)
downloaddexon-solidity-221a4d1f1f8a644ef9905f8f1d4a9a4428ec0489.tar.gz
dexon-solidity-221a4d1f1f8a644ef9905f8f1d4a9a4428ec0489.tar.zst
dexon-solidity-221a4d1f1f8a644ef9905f8f1d4a9a4428ec0489.zip
Split warning for multi arguments for hash functions
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index f77cc60c..30302908 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -1762,22 +1762,24 @@ bool TypeChecker::visit(FunctionCall const& _functionCall)
if (functionType->takesSinglePackedBytesParameter())
{
- string generalMessage =
- "This function only accepts a single \"bytes\" argument. Please use "
- "\"abi.encodePacked(...)\" or a similar function to encode the data.";
-
- if (arguments.size() > 1)
+ if (
+ (arguments.size() > 1) ||
+ (arguments.size() == 1 && !type(*arguments.front())->isImplicitlyConvertibleTo(ArrayType(DataLocation::Memory)))
+ )
{
+ string msg =
+ "This function only accepts a single \"bytes\" argument. Please use "
+ "\"abi.encodePacked(...)\" or a similar function to encode the data.";
if (v050)
- m_errorReporter.typeError(_functionCall.location(), generalMessage);
+ m_errorReporter.typeError(_functionCall.location(), msg);
else
- m_errorReporter.warning(_functionCall.location(), generalMessage);
+ m_errorReporter.warning(_functionCall.location(), msg);
}
- else if (arguments.size() == 1 && !type(*arguments.front())->isImplicitlyConvertibleTo(ArrayType(DataLocation::Memory)))
+
+ if (arguments.size() == 1 && !type(*arguments.front())->isImplicitlyConvertibleTo(ArrayType(DataLocation::Memory)))
{
string msg =
- generalMessage +
- " The provided argument of type " +
+ "The provided argument of type " +
type(*arguments.front())->toString() +
" is not implicitly convertible to expected type bytes memory.";
if (v050)