warn when fewer returns than expected are given for a function

This commit is contained in:
Ricardo Luís Vaz Silva 2023-10-15 11:21:07 -03:00 committed by Christoph Oelckers
commit d699ba248e
3 changed files with 10 additions and 4 deletions

View file

@ -11330,6 +11330,10 @@ FxExpression *FxReturnStatement::Resolve(FCompileContext &ctx)
{
mismatchSeverity = MSG_ERROR;
}
else if (protoRetCount > retCount)
{ // also warn when returning less values then the return count
mismatchSeverity = MSG_WARNING;
}
}
if (mismatchSeverity != -1)