BBN-Q / pyqgl2

An imperative Quantum Gate Language (QGL) embedded in python.
Apache License 2.0
9 stars 3 forks source link

Allow qbit argument with a None default #51

Open ahelsing opened 5 years ago

ahelsing commented 5 years ago

The inliner does not understand an argument annotated as a qreg which also has a default of None. The typical current solution is to leave off the annotation. See for example basic_sequences/helpers.py:create_cal_seqs.

Symptoms (after recent improvements):

  File "/home/ahelsing/Projects/Quantum/pyqgl2/src/python/pyqgl2/inline.py", line 776, in create_inline_procedure
    if isinstance(rewriter.name2const[formal_param.arg], ast.Name):
KeyError: 'measChans'
ahelsing commented 5 years ago

It seems there is some case in create_inline_procedure that is not adding a proper entry to the rewriter. There is a loop around line 656 looking for keyword params, which should be catching this (combined with the loop around line 703 inserting the constant value in this case), but clearly there is something missing.