Include types in explicit conversion error message

This commit is contained in:
Alex Beregszaszi
2017-07-13 23:09:01 +02:00
parent 556ddd0f38
commit 033fc0cb1a
2 changed files with 9 additions and 1 deletions
+8 -1
View File
@@ -1364,7 +1364,14 @@ bool TypeChecker::visit(FunctionCall const& _functionCall)
// (data location cannot yet be specified for type conversions)
resultType = ReferenceType::copyForLocationIfReference(argRefType->location(), resultType);
if (!argType->isExplicitlyConvertibleTo(*resultType))
m_errorReporter.typeError(_functionCall.location(), "Explicit type conversion not allowed.");
m_errorReporter.typeError(
_functionCall.location(),
"Explicit type conversion not allowed from \"" +
argType->toString() +
"\" to \"" +
resultType->toString() +
"\"."
);
}
_functionCall.annotation().type = resultType;
_functionCall.annotation().isPure = isPure;