Repository navigation
Conversation
Argus reviewAuto-review is off for this repo. Tick the box below to run a review on this PR.
Estimated cost
Tip: you can also comment |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Fixes qBraid#438: extern FunctionCall now wrapped in ExpressionStatement to emit semicolon. Added changelog entry per repo convention.
|
Updated the CHANGELOG.md with an entry for this fix under the Unreleased → Fixed section. The extern FunctionCall semicolon issue (#438) is now documented per the repo's Keep a Changelog convention. |
|
Hi @Jah-yee , can you please add the |
|
Thanks for the feedback! I've added a regression test to tests/qasm3/subroutines/test_subroutines.py. It verifies that a bare extern function call (not assigned to a variable) emits a semicolon in the output, ensuring the generated OpenQASM 3 is valid. The test is pushed as the second commit on this PR. Warmly, RoomWithOutRoof |
Jah-yee
left a comment
There was a problem hiding this comment.
Hi @TheGupta2012, thanks for the review! I've added the changelog entry for this fix. The regression test is already in place (commit 1e1eebe). Let me know if there's anything else needed!
|
Hi @TheGupta2012, just following up — the changelog entry and regression test are in place (commit 1e1eebe). Happy to make any adjustments if needed! |
Add regression test for bare extern function call and changelog entry. Fixes qBraid#438.
ce964ed to
206758b
Compare
Summary
When an extern function is called as a bare statement (not assigned to a variable), e.g.:
OPENQASM 3.0; extern my_extern(int); my_extern(3);pyqasm.dumps()emitted the call without a terminating semicolon, making the output unparsable byopenqasm3.parse().Root cause
In
_visit_function_call(visitor.py), when the subroutine is anExternDeclaration, the rawFunctionCallnode was appended to the result list. Theopenqasm3.printer.Printer.visit_FunctionCallmethod does not add a semicolon — that is done byvisit_ExpressionStatementvia_end_statement. BareFunctionCallnodes were visited directly, missing the semicolon.Fix
Wrap the extern
FunctionCallinqasm3_ast.ExpressionStatementbefore appending to the result list, ensuring the printer correctly adds the semicolon.Testing
Verified with the reproducer from issue #438: the output now parses cleanly with
openqasm3.parse().Fixes #438