From 6e8c05eda8bfca24f48d8c2f2ee8126f5d645181 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Tue, 11 Aug 2026 23:18:07 -0700 Subject: [PATCH] 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 --- elaborate.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/elaborate.cc b/elaborate.cc index 32e600ed5..5c5906837 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -5256,15 +5256,23 @@ NetProc* PDisable::elaborate(Design*des, NetScope*scope) const } } - list 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: