SystemVerilog: honor with-clause for class queue min/max

Route class queue-property min/max calls with `with (...)` through predicate-based locator elaboration so filtered extrema behave consistently with queue and darray locator semantics.

Made-with: Cursor
This commit is contained in:
mjoekhan 2026-04-28 21:45:35 +05:00
parent 0cd7205585
commit c189cc2642
2 changed files with 17 additions and 0 deletions

View File

@ -3838,6 +3838,19 @@ NetExpr* PECallFunction::elaborate_expr_method_(Design*des, NetScope*scope,
des->errors += 1;
return 0;
}
if (with_expr_) {
if (!parms_.empty()) {
cerr << get_fileline() << ": error: array locator "
<< "`with` clause cannot be combined with a "
<< "method argument." << endl;
des->errors += 1;
return 0;
}
return elab_queue_locator_with_predicate(
des, scope, *this, with_expr_, prop,
element_type, static_cast<ivl_type_t>(queue),
method_name);
}
NetESFunc*sys_expr = new NetESFunc(
method_name == "min" ? "$ivl_queue_method$min"
: "$ivl_queue_method$max",

View File

@ -49,6 +49,10 @@ module test;
`check(r[0], 1);
`check(r[1], 1);
r = c.q.max() with (item < 7);
`check(r.size, 1);
`check(r[0], 6);
r = c.q.max();
`check(r.size, 2);
`check(r[0], 7);