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

Aperta
#480 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python
Ambito
compilers

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Python
Stelle
29
Fork
33
Merge medio
1g 3h
PR unite (30g)
14

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di qBraid/pyqasm

Tutte le issue di qBraid/pyqasm

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.