You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Guppy type array[qubit, 42] is lowered to the Hugr type Array<Option<Qubit>> to allow non-linear indexing. The same also happens for array[T, 42] where T is a generic linear type variable.
However, when we subsitute T with a classical type (say int), it suddenly lowers to the Hugr type Array<Int<6>> without the Option! This results in ill-typed Hugrs whenever we invoke a generic array function with a classical type.
Short-term fix: Also use Option for classical values (but omitting the "replacing with None" logic). This is not very nice, but should solve the problem until we implement the proper solution.
Longer-term: Add a new Hugr extension for Guppy arrays that is lowered to regular arrays later on in the stack (after monomorphisation!). See #628.
The text was updated successfully, but these errors were encountered:
The Guppy type
array[qubit, 42]
is lowered to the Hugr typeArray<Option<Qubit>>
to allow non-linear indexing. The same also happens forarray[T, 42]
whereT
is a generic linear type variable.However, when we subsitute
T
with a classical type (sayint
), it suddenly lowers to the Hugr typeArray<Int<6>>
without theOption
! This results in ill-typed Hugrs whenever we invoke a generic array function with a classical type.Short-term fix: Also use
Option
for classical values (but omitting the "replacing with None" logic). This is not very nice, but should solve the problem until we implement the proper solution.Longer-term: Add a new Hugr extension for Guppy arrays that is lowered to regular arrays later on in the stack (after monomorphisation!). See #628.
The text was updated successfully, but these errors were encountered: