Use `symbol_search()` for disable targets

Disable targets currently use `Design::find_scope()`, which searches only
scope names. A task or named block from an outer scope is therefore selected
even when a variable, named event, or parameter in a closer scope has the
same name.

The LRM section 3.13 places tasks, named blocks, parameters, named events, and
variables in the same local name space. Use normal symbol lookup and require
the result to be a scope. This lets a closer non-scope object hide the outer
disable target and reports an error for the non-scope result.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2026-08-11 23:18:07 -07:00
parent b3d0677d08
commit 6e8c05eda8
1 changed files with 12 additions and 4 deletions

View File

@ -5256,15 +5256,23 @@ NetProc* PDisable::elaborate(Design*des, NetScope*scope) const
}
}
list<hname_t> spath = eval_scope_path(des, scope, scope_);
NetScope*target = des->find_scope(scope, spath);
if (target == 0) {
symbol_search_results search_results;
if (!symbol_search(this, des, scope, scope_, lexical_pos(),
&search_results)) {
cerr << get_fileline() << ": error: Cannot find scope "
<< scope_ << " in " << scope_path(scope) << endl;
des->errors += 1;
return 0;
}
if (!search_results.is_scope()) {
cerr << get_fileline() << ": error: Cannot disable "
<< search_results.result_type() << " `" << scope_ << "'."
<< endl;
des->errors += 1;
return 0;
}
NetScope *target = search_results.scope;
switch (target->type()) {
case NetScope::FUNC: