From cdb9bc2c215efa728eafca981f1985eb84463653 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 11 May 2026 08:39:25 -0700 Subject: [PATCH] Reject `super` access without a parent class The `super` keyword refers to the parent class of the current class. If the class has no parent the lookup still returned the current class handle and left the `super` path component for l-value elaboration. This triggered the `tail_path.empty()` assert. Report an error during symbol lookup instead. Signed-off-by: Lars-Peter Clausen --- symbol_search.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/symbol_search.cc b/symbol_search.cc index 61a28d4ec..255d608c4 100644 --- a/symbol_search.cc +++ b/symbol_search.cc @@ -153,6 +153,15 @@ bool symbol_search(const LineInfo*li, Design*des, NetScope*scope, if (path_tail.name == "#") { if (NetNet *net = scope->find_signal(perm_string::literal(THIS_TOKEN))) { const netclass_t *class_type = dynamic_cast(net->net_type()); + ivl_assert(*li, class_type); + if (!class_type->get_super()) { + cerr << li->get_fileline() << ": error: " + << "Class " << class_type->get_name() + << " uses `super` without a base class." + << endl; + des->errors += 1; + return false; + } path.push_back(path_tail); res->scope = scope; res->net = net;