Skip to content

fix(simulator): support array literal function arguments - #3131

Merged
dalance merged 3 commits into
veryl-lang:masterfrom
tignear:fix/simulator-array-literal-function-args
Aug 3, 2026
Merged

fix(simulator): support array literal function arguments#3131
dalance merged 3 commits into
veryl-lang:masterfrom
tignear:fix/simulator-array-literal-function-args

Conversation

@tignear

@tignear tignear commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Expand array literals using the formal function argument type before converting their elements into simulator expressions. Previously, passing an array literal directly to a function caused the simulator to panic with unhandled Expression variant.

function pick (
    x: input logic<4> [2],
) -> logic<4> {
    return x[1];
}

always_ff (clk) {
    out_q = pick('{in_hi, in_lo});
}

The added tests cover unpacked, packed, single-element, repeated, default-filled, and multidimensional literals, including nested function calls.

@codspeed-hq

codspeed-hq Bot commented Aug 2, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 8 untouched benchmarks


Comparing tignear:fix/simulator-array-literal-function-args (a099902) with master (3c02060)

Open in CodSpeed

@tignear

tignear commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

I found that malformed array literal arguments bypass the analyzer. This PR avoids the existing panic, but reports only a generic unsupported description error. I’m converting it back to draft while I fix the diagnostics. Sorry I missed this.

@tignear
tignear force-pushed the fix/simulator-array-literal-function-args branch from 9876ba5 to a099902 Compare August 2, 2026 17:02
@dalance dalance added this to the v0.20.3 milestone Aug 3, 2026
@dalance
dalance merged commit 83e6d80 into veryl-lang:master Aug 3, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants