Improve function call argument error to show target function

This commit is contained in:
Wilson Snyder
2026-03-04 19:01:01 -05:00
parent 7acd73fede
commit 1bf2ea7643
5 changed files with 61 additions and 23 deletions
+16 -5
View File
@@ -1822,9 +1822,14 @@ V3TaskConnects V3Task::taskConnects(AstNodeFTaskRef* nodep, AstNode* taskStmtsp,
const auto it = nameToIndex.find(argp->name());
if (it == nameToIndex.end()) {
if (makeChanges) {
argp->v3error("No such argument " << argp->prettyNameQ()
<< " in function call to "
<< nodep->taskp()->prettyTypeName());
argp->v3error(
"No such argument "
<< argp->prettyNameQ() << " in call to " << nodep->taskp()->verilogKwd()
<< " " << nodep->taskp()->prettyNameQ() << '\n'
<< nodep->warnContextPrimary() << '\n'
<< nodep->warnMore() << "... " << ucfirst(nodep->taskp()->verilogKwd())
<< " " << nodep->taskp()->prettyNameQ() << " declared here:\n"
<< nodep->taskp()->warnContextSecondary());
// We'll just delete it; seems less error prone than making a false argument
VL_DO_DANGLING(argp->unlinkFrBack()->deleteTree(), argp);
}
@@ -1847,8 +1852,14 @@ V3TaskConnects V3Task::taskConnects(AstNodeFTaskRef* nodep, AstNode* taskStmtsp,
tconnects[ppinnum].second = argp;
++tpinnum;
} else if (makeChanges) {
argp->v3error("Too many arguments in function call to "
<< nodep->taskp()->prettyTypeName());
argp->v3error("Too many arguments in call to "
<< nodep->taskp()->verilogKwd() << " "
<< nodep->taskp()->prettyNameQ() << '\n'
<< nodep->warnContextPrimary() << '\n'
<< nodep->warnMore() << "... "
<< ucfirst(nodep->taskp()->verilogKwd()) << " "
<< nodep->taskp()->prettyNameQ() << " declared here:\n"
<< nodep->taskp()->warnContextSecondary());
// We'll just delete it; seems less error prone than making a false argument
VL_DO_DANGLING(argp->unlinkFrBack()->deleteTree(), argp);
}