Turns wrong argument count in base constructor call into en error.

This commit is contained in:
Erik Kundt
2018-07-11 01:56:07 +02:00
parent d84976dc87
commit 0b960f5a9c
3 changed files with 16 additions and 32 deletions
+9 -22
View File
@@ -548,31 +548,18 @@ void TypeChecker::endVisit(InheritanceSpecifier const& _inheritance)
if (arguments)
{
bool v050 = m_scope->sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::V050);
if (parameterTypes.size() != arguments->size())
{
if (arguments->size() == 0 && !v050)
m_errorReporter.warning(
_inheritance.location(),
"Wrong argument count for constructor call: " +
toString(arguments->size()) +
" arguments given but expected " +
toString(parameterTypes.size()) +
"."
);
else
{
m_errorReporter.typeError(
_inheritance.location(),
"Wrong argument count for constructor call: " +
toString(arguments->size()) +
" arguments given but expected " +
toString(parameterTypes.size()) +
"."
);
m_errorReporter.typeError(
_inheritance.location(),
"Wrong argument count for constructor call: " +
toString(arguments->size()) +
" arguments given but expected " +
toString(parameterTypes.size()) +
"."
);
if (arguments->size() != 0)
return;
}
}
for (size_t i = 0; i < arguments->size(); ++i)
if (!type(*(*arguments)[i])->isImplicitlyConvertibleTo(*parameterTypes[i]))