From a0771691ff1a8ea8b2dda07ff50e48fc81a2a705 Mon Sep 17 00:00:00 2001 From: Federico Bond Date: Thu, 4 Jan 2018 07:24:39 -0300 Subject: Improve error message for wrong struct initialization (#3359) --- libsolidity/analysis/TypeChecker.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'libsolidity/analysis') diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 090e5159..75d71925 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -1551,8 +1551,12 @@ bool TypeChecker::visit(FunctionCall const& _functionCall) if (!functionType->takesArbitraryParameters() && parameterTypes.size() != arguments.size()) { + bool isStructConstructorCall = _functionCall.annotation().kind == FunctionCallKind::StructConstructorCall; + string msg = - "Wrong argument count for function call: " + + "Wrong argument count for " + + string(isStructConstructorCall ? "struct constructor" : "function call") + + ": " + toString(arguments.size()) + " arguments given but expected " + toString(parameterTypes.size()) + -- cgit v1.2.3