Improve error message for wrong struct initialization (#3359)

This commit is contained in:
Federico Bond
2018-01-04 11:24:39 +01:00
committed by chriseth
parent fdbe78a769
commit a0771691ff
3 changed files with 20 additions and 1 deletions
+5 -1
View File
@@ -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()) +