Open vadym-kl opened 5 years ago
From the strack-trace, looks like:
ArrayFromIndicies
is not figuring out that 'T
is of type Pauli
(which is strange, since 'T
is in the values
argument) so it defaults to object -->
that causes that the resolved type for the array is object[]
, but looks like QArray
doesn't support objects so it fails.
This seems related to #47, however, for this one I would start on GenericaCallable.FindCallable to figure out why the Type parameter 'T
from ArrayFromIndicies
is not correctly identified.
I did a quick investigation and the problem is that IsValidValue(Type targetType, object partialValues) will fail for the target type being an IQArray of objects and the partialValues being a concrete array of something (Paulis in this case). This is unfortunately how ArrayFromIndicies(values,_) currently get's translated. To fix this we would need to construct the mapper at runtime in this case, i.e. whether or not to build the partial mapper on code gen has to be determined based on whether the original callable had type parameters (not the partially applied one), but then PartialApplicationTypes needs to be adapted I think.
Describe the bug
Run-time failure related to use of type parameters and partial application
To Reproduce
Create project with
Bug.qs
with content below and runPrintAllPaulis()
operation.Expected behavior
64 lines of all possible combinations of 3 Pauli operators printed to console.
Actual behavior
Run-time failure with the following data:
System information