[BUG] Unusual error when running direct recursion
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- Nửa ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
Start with the reproducer in the issue: a recursive def test(qubit[1] a, int b) that calls itself with a[0], which fails with "Expecting qubit argument for 'a'". The reporter points at Qasm3SubroutineProcessor.process_quantum_arg, so read how qubit arguments are resolved inside a subroutine's own scope. Done when the recursive program validates without error and the existing subroutine tests still pass.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Environment
- PyQASM version: 0.3.2
- Python version: 3.12.8
- Operating system: Windows
What happened?
Issue
The OpenQASM standard allows direct recursion by making gate/subroutine identifiers available within their own scope.
However, pyqasm fails when handling recursive calls, producing an unexpected parameter type error.
Example
OPENQASM 3;
include "stdgates.inc";
qubit[5] qb;
bit[5] cb;
const float my_angle = .1;
def test(qubit[1] a,int b){
p(my_angle) a[0];
if(b > 0){
test(a[0],b-1);
}
}
test(qb[2],3);
'''
Observed Behavior
The recursive call throws the following error:
ERROR :pyqasm: Error at line 9, column 2 in QASM file
>>>>>> test(a[0], b - 1)
ValidationError: Expecting qubit argument for 'a'. Qubit register 'a' not found for function 'test'
- note that both test(a,b-1); and test(a[0],b-1); threw the same error when I was testing for semantic errors in my code
Expected Behavior
pyqasm should accept recursive calls in accordance with the OpenQASM standard, correctly resolving subroutine identifiers within their own scope.
Suggestions (Optional)
Id assume this is an error regarding scoping/aliasing within subroutine calls rather than a recursion issue, since error originates from: Qasm3SubroutineProcessor.process_quantum_arg(
- Ngôn ngữ chính
- Python
- Star
- 29
- Fork
- 33
- Merge trung bình
- 2 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 15
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của qBraid/pyqasm
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 63/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement error-handling program-validation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Move the QASM 2 printer and its branch pre-processing out of qasm2.pyCó thể đã có người làm @danielgaskins đã nhận 8 ngày trước. Đang mởenhancement qasm2
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 22/100
qBraid/pyqasm#447 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] dumps() emits extern calls without a semicolon, producing unparsable QASMCó thể đã có người làm @Jah-yee đã nhận 16 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 25/100
qBraid/pyqasm#438 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Parse failures raise ValidationError with an empty message; the ANTLR diagnostic is lostCó thể đã có người làm @tonycoder-hub đã nhận 10 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 22/100
qBraid/pyqasm#436 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của qBraid/pyqasm
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
volcengine/OpenViking#6445 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
BUG:Edit Album strips spaces from the password so albums with a leading/trailing space in the password can't be editedCó thể đã có người làm @ManyaJain111 đã nhận hôm nay. Đang mởbug enhancement possible-duplicate
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
AOSSIE-Org/PictoPy#1637 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
deepspeedai/DeepSpeed#8884 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Flaky: test_advisor_live_calibrates_an_unmeasured_circuit ranks engines by a 1.8ms sleep marginĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
flagos-ai/FlagQuantum#718 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug CI-failure high priority
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
vllm-project/afd-plugin#483 ·
Maintainer thường phản hồi trong vòng 1 ngày