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:
See #629 for context.
This PR changes the lowering of classical arrays to use the same
`Option` trick that we use for linear arrays. This fixes#629 in the
short-term. Longer-term we should do #628 to address the problem
properly
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: