Integer division for casts, int array elements, bitwise results, ** and int-returning subroutines

Đang mở
#480 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
1-2 ngày
Mức phù hợp với người mới
52/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
compilers

Hướng nghiên cứu

Start from the integer-division handling added in #474 and the type rules in language/types.rst and language/classical.rst. Locate where binary / is typed and where casts, array indexing, bitwise/shift results, **, and int/uint subroutine returns get their types, then add regression cases for the four snippets in the issue. Done when each snippet uses integer division and existing division tests still pass.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

After #474, / divides as integers when both operands are integer literals or int/uint variables. Other integer-typed operands still use true division:

OPENQASM 3.0;
include "stdgates.inc";
qubit[1] q;
int[32] a = 2;
int[32] b = 3;
float[64] f = 7.9;
array[int[32], 2] arr = {7, 1};
def h() -> int[32] { return 7; }
rx(int[32](f) / a) q[0];   // rx(3.5), spec gives 3
rx(arr[0] / a) q[0];       // rx(3.5), spec gives 3
rx((b | 4) / a) q[0];      // rx(3.5), spec gives 3
rx(h() / a) q[0];          // rx(3.5), spec gives 3

Casts to int/uint, elements of integer arrays, bitwise and shift results on integers, int ** int, and subroutines that return int/uint are all integer-typed in the spec (language/types.rst, language/classical.rst). Raised in the review of #474.

Ngôn ngữ chính
Python
Star
29
Fork
33
Merge trung bình
1 ngày 3 giờ
Pull request đã merge (30 ngày)
14

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của qBraid/pyqasm

Tất cả issue của qBraid/pyqasm

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.