Describe the bug
Constructing a function (Int -> 'T) for a parameterized type 'T and passing it to another operation causes an issue when the function is called.
To Reproduce
Steps to reproduce the behavior:
Call ConstructFailure() in the following code:
open Microsoft.Quantum.Arrays();
operation ConstructFailure() : Unit {
let table = [1,2,3,4];
TableFailure(table);
}
operation TableFailure<'T>(table : 'T[]) : Unit {
let lFunction = LookupFunction(table);
let x = lFunction(0);
Message("Has not failed");
LookupFailure(LookupFunction(table));
}
operation LookupFailure<'T> (lookup : (Int -> 'T)) : Unit {
let x = lookup(0);
Message("Still has not failed");
}
Expected behaviorlookup should be callable from within LookupFailure. Instead, it does not reach the second Message line before giving the error:
Unhandled Exception: System.AggregateException: One or more errors occurred. (Constructor on type 'Microsoft.Quantum.Simulation.Core.IQArray1[[System.Object, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]' not found.) ---> System.MissingMethodException: Constructor on type 'Microsoft.Quantum.Simulation.Core.IQArray1[[System.Object, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]' not found.
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at Microsoft.Quantum.Simulation.Core.PartialMapper.CastTuple(Type targetType, Object value)
at Microsoft.Quantum.Simulation.Core.PartialMapper.CastTuple(Type targetType, Object value)
at Microsoft.Quantum.Simulation.Core.PartialMapper.<>cDisplayClass9_02.<Create>b__0(P argTuple) at Microsoft.Quantum.Simulation.Core.FunctionPartial3.b16_0(P a)
at Microsoft.Quantum.Simulation.Core.Function2.Apply[GenO](Object args) at Microsoft.Quantum.Simulation.Core.GenericCallable.Apply[O](Object args) at Microsoft.Quantum.Crypto.Canon.LookupFailure1.b__10_0(ICallable in)
Screenshots
If applicable, add screenshots to help explain your problem.
Describe the bug Constructing a function
(Int -> 'T)
for a parameterized type'T
and passing it to another operation causes an issue when the function is called.To Reproduce Steps to reproduce the behavior:
Call
ConstructFailure()
in the following code:Expected behavior
lookup
should be callable from withinLookupFailure
. Instead, it does not reach the secondMessage
line before giving the error:Screenshots If applicable, add screenshots to help explain your problem.
System information