(data);
public O Apply(I a)
{
- var __result__ = this.Body(a);
+ var __result__ = this.__Body__(a);
return __result__;
}
diff --git a/src/Simulation/Core/Functions/FunctionPartial.cs b/src/Simulation/Core/Functions/FunctionPartial.cs
index 97d77437aa3..e46f656d596 100644
--- a/src/Simulation/Core/Functions/FunctionPartial.cs
+++ b/src/Simulation/Core/Functions/FunctionPartial.cs
@@ -14,7 +14,7 @@ namespace Microsoft.Quantum.Simulation.Core
public class FunctionPartial : Function
, ICallable
{
- public FunctionPartial(Function op, Func
mapper) : base(op.Factory)
+ public FunctionPartial(Function op, Func
mapper) : base(op.__Factory__)
{
Debug.Assert(op != null);
Debug.Assert(mapper != null);
@@ -23,7 +23,7 @@ public FunctionPartial(Function op, Func
mapper) : base(op.Factory)
this.Mapper = mapper;
}
- public FunctionPartial(Function op, object partialTuple) : base(op.Factory)
+ public FunctionPartial(Function op, object partialTuple) : base(op.__Factory__)
{
Debug.Assert(op != null);
Debug.Assert(partialTuple != null);
@@ -32,7 +32,7 @@ public FunctionPartial(Function op, object partialTuple) : base(op.Factory
this.Mapper = PartialMapper.Create
(partialTuple);
}
- public override void Init() { }
+ public override void __Init__() { }
public ICallable BaseOp { get; }
@@ -43,7 +43,7 @@ public override void Init() { }
OperationFunctor ICallable.Variant => ((ICallable)this.BaseOp).Variant;
- public override Func
Body => (a) =>
+ public override Func
__Body__ => (a) =>
{
var args = this.Mapper(a);
return this.BaseOp.Apply(args);
@@ -79,4 +79,4 @@ public DebuggerProxy(FunctionPartial
op) : base(op)
public ICallable Base => _op.BaseOp;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Simulation/Core/Generics/Adjoint.cs b/src/Simulation/Core/Generics/Adjoint.cs
index 45577250ebd..be38c67057f 100644
--- a/src/Simulation/Core/Generics/Adjoint.cs
+++ b/src/Simulation/Core/Generics/Adjoint.cs
@@ -25,7 +25,7 @@ public interface IAdjointable : ICallable
[DebuggerTypeProxy(typeof(GenericAdjoint.DebuggerProxy))]
public class GenericAdjoint : GenericCallable, IApplyData, IOperationWrapper
{
- public GenericAdjoint(GenericCallable baseOp) : base(baseOp.Factory, null)
+ public GenericAdjoint(GenericCallable baseOp) : base(baseOp.__Factory__, null)
{
this.BaseOp = baseOp;
}
diff --git a/src/Simulation/Core/Generics/Controlled.cs b/src/Simulation/Core/Generics/Controlled.cs
index cc9b05fb994..f110cfef189 100644
--- a/src/Simulation/Core/Generics/Controlled.cs
+++ b/src/Simulation/Core/Generics/Controlled.cs
@@ -27,7 +27,7 @@ public partial interface IControllable : ICallable
[DebuggerTypeProxy(typeof(GenericControlled.DebuggerProxy))]
public class GenericControlled : GenericCallable, IApplyData, IOperationWrapper
{
- public GenericControlled(GenericCallable baseOp) : base(baseOp.Factory, null)
+ public GenericControlled(GenericCallable baseOp) : base(baseOp.__Factory__, null)
{
this.BaseOp = baseOp;
}
diff --git a/src/Simulation/Core/Generics/GenericCallable.cs b/src/Simulation/Core/Generics/GenericCallable.cs
index cdd4ac3fce4..3dcd5b98b5a 100644
--- a/src/Simulation/Core/Generics/GenericCallable.cs
+++ b/src/Simulation/Core/Generics/GenericCallable.cs
@@ -54,7 +54,7 @@ public GenericCallable(IOperationFactory m, Type baseOp) : base(m)
_controlled = new Lazy(() => new GenericControlled(this));
}
- public override void Init() { }
+ public override void __Init__() { }
public Type OperationType { get; }
@@ -103,12 +103,12 @@ protected virtual ICallable CreateCallable(Type I, Type O)
op = FindClosedType(I, O);
}
- var get = this.Factory.GetType()
+ var get = this.__Factory__.GetType()
.GetMethod("Get", new Type[0]);
var result = get
.MakeGenericMethod(typeof(ICallable), op)
- .Invoke(this.Factory, new object[] { })
+ .Invoke(this.__Factory__, new object[] { })
as ICallable;
return result;
@@ -162,7 +162,7 @@ public virtual Type FindClosedType(Type I, Type O)
// Get the list of Parameters of the Invoke method of the Body of the operation:
var expectedParameters = this.OperationType
- .GetProperty("Body").PropertyType
+ .GetProperty("__Body__").PropertyType
.GetMethod("Invoke").GetParameters();
// Tuple in...
@@ -171,7 +171,7 @@ public virtual Type FindClosedType(Type I, Type O)
// Tuple out...
var expectedReturn = this.OperationType
- .GetProperty("Body").PropertyType
+ .GetProperty("__Body__").PropertyType
.GetMethod("Invoke").ReturnType;
Resolve(expectedReturn, O, typeArgs);
diff --git a/src/Simulation/Core/Generics/GenericPartial.cs b/src/Simulation/Core/Generics/GenericPartial.cs
index 8db1263639e..406dced1380 100644
--- a/src/Simulation/Core/Generics/GenericPartial.cs
+++ b/src/Simulation/Core/Generics/GenericPartial.cs
@@ -18,7 +18,7 @@ public class GenericPartial : GenericCallable, IApplyData, IOperationWrapper
{
private Lazy __qubits = null;
- public GenericPartial(GenericCallable baseOp, object partialValues) : base(baseOp.Factory, null)
+ public GenericPartial(GenericCallable baseOp, object partialValues) : base(baseOp.__Factory__, null)
{
Debug.Assert(baseOp != null, "Received a null base operation");
Debug.Assert(partialValues != null, "Received a null partial value");
diff --git a/src/Simulation/Core/Operations/Adjoint.cs b/src/Simulation/Core/Operations/Adjoint.cs
index 8e0efe35ad2..a4337c91436 100644
--- a/src/Simulation/Core/Operations/Adjoint.cs
+++ b/src/Simulation/Core/Operations/Adjoint.cs
@@ -43,7 +43,7 @@ public Adjointable(IOperationFactory m) : base(m)
[DebuggerTypeProxy(typeof(AdjointedOperation<,>.DebuggerProxy))]
public class AdjointedOperation : Unitary, IApplyData, ICallable, IOperationWrapper
{
- public AdjointedOperation(Operation op) : base(op.Factory)
+ public AdjointedOperation(Operation op) : base(op.__Factory__)
{
Debug.Assert(typeof(O) == typeof(QVoid));
Debug.Assert(op is Operation);
@@ -54,25 +54,25 @@ public AdjointedOperation(Operation op) : base(op.Factory)
public Operation BaseOp { get; }
ICallable IOperationWrapper.BaseOperation => BaseOp;
- public override void Init() { }
+ public override void __Init__() { }
string ICallable.Name => ((ICallable)this.BaseOp).Name;
string ICallable.FullName => ((ICallable)this.BaseOp).FullName;
OperationFunctor ICallable.Variant => ((ICallable)this.BaseOp).AdjointVariant();
- public override Func Body => this.BaseOp.AdjointBody;
+ public override Func __Body__ => this.BaseOp.__AdjointBody__;
- public override Func AdjointBody => this.BaseOp.Body;
+ public override Func __AdjointBody__ => this.BaseOp.__Body__;
- public override Func<(IQArray, I), QVoid> ControlledBody => this.BaseOp.ControlledAdjointBody;
+ public override Func<(IQArray, I), QVoid> __ControlledBody__ => this.BaseOp.__ControlledAdjointBody__;
- public override Func<(IQArray, I), QVoid> ControlledAdjointBody => this.BaseOp.ControlledBody;
+ public override Func<(IQArray, I), QVoid> __ControlledAdjointBody__ => this.BaseOp.__ControlledBody__;
IEnumerable IApplyData.Qubits => ((IApplyData)this.BaseOp).Qubits;
- public override IApplyData __dataIn(I data) => this.BaseOp.__dataIn(data);
+ public override IApplyData __DataIn__(I data) => this.BaseOp.__DataIn__(data);
- public override IApplyData __dataOut(QVoid data) => data;
+ public override IApplyData __DataOut__(QVoid data) => data;
///
public override RuntimeMetadata? GetRuntimeMetadata(IApplyData args)
diff --git a/src/Simulation/Core/Operations/Controlled.cs b/src/Simulation/Core/Operations/Controlled.cs
index 770a9081f6f..5f0b823c576 100644
--- a/src/Simulation/Core/Operations/Controlled.cs
+++ b/src/Simulation/Core/Operations/Controlled.cs
@@ -60,7 +60,7 @@ public In((IQArray, IApplyData) data)
IEnumerable IApplyData.Qubits => Qubit.Concat(Ctrls, BaseData?.Qubits);
}
- public ControlledOperation(Operation op) : base(op.Factory)
+ public ControlledOperation(Operation op) : base(op.__Factory__)
{
Debug.Assert(typeof(O) == typeof(QVoid));
Debug.Assert(op is Operation);
@@ -71,17 +71,17 @@ public ControlledOperation(Operation op) : base(op.Factory)
public Operation BaseOp { get; }
ICallable IOperationWrapper.BaseOperation => BaseOp;
- public override void Init() { }
+ public override void __Init__() { }
string ICallable.Name => ((ICallable)this.BaseOp).Name;
string ICallable.FullName => ((ICallable)this.BaseOp).FullName;
OperationFunctor ICallable.Variant => ((ICallable)this.BaseOp).ControlledVariant();
- public override Func<(IQArray, I), QVoid> Body => this.BaseOp.ControlledBody;
+ public override Func<(IQArray, I), QVoid> __Body__ => this.BaseOp.__ControlledBody__;
- public override Func<(IQArray, I), QVoid> AdjointBody => this.BaseOp.ControlledAdjointBody;
+ public override Func<(IQArray, I), QVoid> __AdjointBody__ => this.BaseOp.__ControlledAdjointBody__;
- public override Func<(IQArray, (IQArray, I)), QVoid> ControlledBody
+ public override Func<(IQArray, (IQArray, I)), QVoid> __ControlledBody__
{
get
{
@@ -89,12 +89,12 @@ public override void Init() { }
{
var (ctrl1, (ctrl2, args)) = __in;
var ctrls = QArray.Add(ctrl1, ctrl2);
- return this.BaseOp.ControlledBody.Invoke((ctrls, args));
+ return this.BaseOp.__ControlledBody__.Invoke((ctrls, args));
};
}
}
- public override Func<(IQArray, (IQArray, I)), QVoid> ControlledAdjointBody
+ public override Func<(IQArray, (IQArray, I)), QVoid> __ControlledAdjointBody__
{
get
{
@@ -102,16 +102,16 @@ public override void Init() { }
{
var (ctrl1, (ctrl2, args)) = __in;
var ctrls = QArray.Add(ctrl1, ctrl2);
- return this.BaseOp.ControlledAdjointBody.Invoke((ctrls, args));
+ return this.BaseOp.__ControlledAdjointBody__.Invoke((ctrls, args));
};
}
}
IEnumerable IApplyData.Qubits => ((IApplyData)this.BaseOp).Qubits;
- public override IApplyData __dataIn((IQArray, I) data) => new In((data.Item1, this.BaseOp.__dataIn(data.Item2)));
+ public override IApplyData __DataIn__((IQArray, I) data) => new In((data.Item1, this.BaseOp.__DataIn__(data.Item2)));
- public override IApplyData __dataOut(QVoid data) => data;
+ public override IApplyData __DataOut__(QVoid data) => data;
///
public override RuntimeMetadata? GetRuntimeMetadata(IApplyData args)
@@ -121,7 +121,7 @@ public override void Init() { }
if (args.Value is ValueTuple, I> ctrlArgs)
{
var (controls, baseArgs) = ctrlArgs;
- var baseMetadata = this.BaseOp.GetRuntimeMetadata(this.BaseOp.__dataIn(baseArgs));
+ var baseMetadata = this.BaseOp.GetRuntimeMetadata(this.BaseOp.__DataIn__(baseArgs));
if (baseMetadata == null) return null;
baseMetadata.IsControlled = true;
baseMetadata.Controls = controls.Concat(baseMetadata.Controls);
diff --git a/src/Simulation/Core/Operations/Operation.cs b/src/Simulation/Core/Operations/Operation.cs
index 6a20d69af6c..3632ede3be5 100644
--- a/src/Simulation/Core/Operations/Operation.cs
+++ b/src/Simulation/Core/Operations/Operation.cs
@@ -55,21 +55,21 @@ public Operation(IOperationFactory m) : base(m)
OperationFunctor ICallable.Variant => OperationFunctor.Body;
- public virtual IApplyData __dataIn(I data) => new QTuple(data);
+ public virtual IApplyData __DataIn__(I data) => new QTuple(data);
- public virtual IApplyData __dataOut(O data) => new QTuple(data);
+ public virtual IApplyData __DataOut__(O data) => new QTuple(data);
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
- public abstract Func Body { get; }
+ public abstract Func __Body__ { get; }
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
- public virtual Func AdjointBody => throw new NotImplementedException();
+ public virtual Func __AdjointBody__ => throw new NotImplementedException();
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
- public virtual Func<(IQArray, I), QVoid> ControlledBody => throw new NotImplementedException();
+ public virtual Func<(IQArray, I), QVoid> __ControlledBody__ => throw new NotImplementedException();
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
- public virtual Func<(IQArray, I), QVoid> ControlledAdjointBody => throw new NotImplementedException();
+ public virtual Func<(IQArray, I), QVoid> __ControlledAdjointBody__ => throw new NotImplementedException();
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public AdjointedOperation Adjoint => _adjoint.Value;
@@ -92,17 +92,17 @@ public O Apply(I a)
try
{
- this.Factory?.StartOperation(this, __dataIn(a));
- __result__ = this.Body(a);
+ this.__Factory__?.StartOperation(this, __DataIn__(a));
+ __result__ = this.__Body__(a);
}
catch (Exception e)
{
- this.Factory?.Fail(System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture(e));
+ this.__Factory__?.Fail(System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture(e));
throw;
}
finally
{
- this.Factory?.EndOperation(this, __dataOut(__result__));
+ this.__Factory__?.EndOperation(this, __DataOut__(__result__));
}
return __result__;
diff --git a/src/Simulation/Core/Operations/OperationPartial.cs b/src/Simulation/Core/Operations/OperationPartial.cs
index 5a68394d3eb..2dc02cc2946 100644
--- a/src/Simulation/Core/Operations/OperationPartial.cs
+++ b/src/Simulation/Core/Operations/OperationPartial.cs
@@ -29,7 +29,7 @@ public class In : IApplyData
public In(Operation op, Func mapper, P data)
{
- this.__data = new Lazy(() => op?.__dataIn(mapper(data)));
+ this.__data = new Lazy(() => op?.__DataIn__(mapper(data)));
}
public object Value => __data.Value.Value;
@@ -38,27 +38,27 @@ public In(Operation op, Func mapper, P data)
}
- public OperationPartial(Operation op, Func
mapper) : base(op.Factory)
+ public OperationPartial(Operation op, Func
mapper) : base(op.__Factory__)
{
Debug.Assert(op != null);
Debug.Assert(mapper != null);
this.BaseOp = op;
this.Mapper = mapper;
- this.__qubits = new Lazy(() => op?.__dataIn(mapper(default(P)))?.Qubits?.ToArray());
+ this.__qubits = new Lazy(() => op?.__DataIn__(mapper(default(P)))?.Qubits?.ToArray());
}
- public OperationPartial(Operation op, object partialTuple) : base(op.Factory)
+ public OperationPartial(Operation op, object partialTuple) : base(op.__Factory__)
{
Debug.Assert(op != null);
Debug.Assert(partialTuple != null);
this.BaseOp = op;
this.Mapper = PartialMapper.Create(partialTuple);
- this.__qubits = new Lazy(() => op?.__dataIn(this.Mapper(default(P)))?.Qubits?.ToArray());
+ this.__qubits = new Lazy(() => op?.__DataIn__(this.Mapper(default(P)))?.Qubits?.ToArray());
}
- public override void Init() { }
+ public override void __Init__() { }
public Operation BaseOp { get; }
ICallable IOperationWrapper.BaseOperation => BaseOp;
@@ -70,39 +70,39 @@ public override void Init() { }
OperationFunctor ICallable.Variant => ((ICallable)this.BaseOp).Variant;
- public override IApplyData __dataIn(P data) => new In(this.BaseOp, this.Mapper, data);
+ public override IApplyData __DataIn__(P data) => new In(this.BaseOp, this.Mapper, data);
- public override IApplyData __dataOut(O data) => this.BaseOp.__dataOut(data);
+ public override IApplyData __DataOut__(O data) => this.BaseOp.__DataOut__(data);
- public override Func Body => (a) =>
+ public override Func
__Body__ => (a) =>
{
var args = this.Mapper(a);
- return this.BaseOp.Body.Invoke(args);
+ return this.BaseOp.__Body__.Invoke(args);
};
- public override Func
AdjointBody => (a) =>
+ public override Func
__AdjointBody__ => (a) =>
{
Debug.Assert(typeof(O) == typeof(QVoid));
var op = this.BaseOp;
var args = this.Mapper(a);
- return op.AdjointBody.Invoke(args);
+ return op.__AdjointBody__.Invoke(args);
};
- public override Func<(IQArray, P), QVoid> ControlledBody => (a) =>
+ public override Func<(IQArray, P), QVoid> __ControlledBody__ => (a) =>
{
Debug.Assert(typeof(O) == typeof(QVoid));
var op = this.BaseOp;
var (ctrl, ps) = a;
- return op.ControlledBody.Invoke((ctrl, this.Mapper(ps)));
+ return op.__ControlledBody__.Invoke((ctrl, this.Mapper(ps)));
};
- public override Func<(IQArray, P), QVoid> ControlledAdjointBody => (a) =>
+ public override Func<(IQArray, P), QVoid> __ControlledAdjointBody__ => (a) =>
{
Debug.Assert(typeof(O) == typeof(QVoid));
var op = this.BaseOp;
var (ctrl, ps) = a;
- return op.ControlledAdjointBody.Invoke((ctrl, this.Mapper(ps)));
+ return op.__ControlledAdjointBody__.Invoke((ctrl, this.Mapper(ps)));
};
IEnumerable IApplyData.Qubits => __qubits.Value;
@@ -167,4 +167,4 @@ public DebuggerProxy(OperationPartial op) : base(op)
public Operation Base => _op.BaseOp;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Simulation/Core/Udts/UdtFactory.cs b/src/Simulation/Core/Udts/UdtFactory.cs
index 90c7c27e655..d4677b98b63 100644
--- a/src/Simulation/Core/Udts/UdtFactory.cs
+++ b/src/Simulation/Core/Udts/UdtFactory.cs
@@ -47,7 +47,7 @@ public T Partial(object partialInfo)
public ICallable Partial(object partialTuple) => this.Partial(partialTuple);
- public override void Init()
+ public override void __Init__()
{ }
}
-}
\ No newline at end of file
+}
diff --git a/src/Simulation/CsharpGeneration.Tests/SimulationCodeTests.fs b/src/Simulation/CsharpGeneration.Tests/SimulationCodeTests.fs
index 7de7c97eb5a..b20864f09ee 100644
--- a/src/Simulation/CsharpGeneration.Tests/SimulationCodeTests.fs
+++ b/src/Simulation/CsharpGeneration.Tests/SimulationCodeTests.fs
@@ -861,10 +861,10 @@ namespace N1
let context = createTestContext op
let deps = op |> operationDependencies |> depsByName
let actual = deps |> buildInit context |> formatSyntaxTree
- let expected = sprintf "public override void Init() { %s }" (String.concat "" body)
+ let expected = sprintf "public override void __Init__() { %s }" (String.concat "" body)
Assert.Equal (expected |> clearFormatting, actual |> clearFormatting)
- let template = sprintf "this.%s = this.Factory.Get<%s>(typeof(%s));"
+ let template = sprintf "this.%s = this.__Factory__.Get<%s>(typeof(%s));"
[
]
|> testOne emptyOperation
@@ -878,37 +878,37 @@ namespace N1
|> testOne genU2
[
- template "Allocate" "Allocate" "global::Microsoft.Quantum.Intrinsic.Allocate"
- template "MicrosoftQuantumIntrinsicH" "IUnitary" "global::Microsoft.Quantum.Intrinsic.H"
- template "H" "ICallable" "H"
- template "Release" "Release" "global::Microsoft.Quantum.Intrinsic.Release"
- template "MicrosoftQuantumOverridesemptyFunction" "ICallable" "global::Microsoft.Quantum.Overrides.emptyFunction"
- template "emptyFunction" "ICallable" "emptyFunction"
+ template "Allocate__" "Allocate" "global::Microsoft.Quantum.Intrinsic.Allocate"
+ template "Microsoft__Quantum__Intrinsic__H" "IUnitary" "global::Microsoft.Quantum.Intrinsic.H"
+ template "H__" "ICallable" "H"
+ template "Release__" "Release" "global::Microsoft.Quantum.Intrinsic.Release"
+ template "Microsoft__Quantum__Overrides__emptyFunction" "ICallable" "global::Microsoft.Quantum.Overrides.emptyFunction"
+ template "emptyFunction__" "ICallable" "emptyFunction"
]
|> testOne duplicatedDefinitionsCaller
[
- template "Allocate" "Allocate" "global::Microsoft.Quantum.Intrinsic.Allocate"
- template "CNOT" "IAdjointable<(Qubit, Qubit)>" "global::Microsoft.Quantum.Intrinsic.CNOT"
- template "MicrosoftQuantumTestingHold" "ICallable" "global::Microsoft.Quantum.Testing.Hold<>"
- template "Release" "Release" "global::Microsoft.Quantum.Intrinsic.Release"
- template "ResultToString" "ICallable" "ResultToString"
- template "X" "IUnitary" "global::Microsoft.Quantum.Intrinsic.X"
- template "genIter" "IUnitary" "genIter<>"
- template "genMapper" "ICallable" "genMapper<,>"
- template "genU1" "IUnitary" "genU1<>"
- template "MicrosoftQuantumTestingnoOpGeneric" "IUnitary" "global::Microsoft.Quantum.Testing.noOpGeneric<>"
- template "MicrosoftQuantumTestingnoOpResult" "IUnitary" "global::Microsoft.Quantum.Testing.noOpResult"
+ template "Allocate__" "Allocate" "global::Microsoft.Quantum.Intrinsic.Allocate"
+ template "CNOT__" "IAdjointable<(Qubit, Qubit)>" "global::Microsoft.Quantum.Intrinsic.CNOT"
+ template "Microsoft__Quantum__Testing__Hold" "ICallable" "global::Microsoft.Quantum.Testing.Hold<>"
+ template "Release__" "Release" "global::Microsoft.Quantum.Intrinsic.Release"
+ template "ResultToString__" "ICallable" "ResultToString"
+ template "X__" "IUnitary" "global::Microsoft.Quantum.Intrinsic.X"
+ template "genIter__" "IUnitary" "genIter<>"
+ template "genMapper__" "ICallable" "genMapper<,>"
+ template "genU1__" "IUnitary" "genU1<>"
+ template "Microsoft__Quantum__Testing__noOpGeneric" "IUnitary" "global::Microsoft.Quantum.Testing.noOpGeneric<>"
+ template "Microsoft__Quantum__Testing__noOpResult" "IUnitary" "global::Microsoft.Quantum.Testing.noOpResult"
]
|> testOne usesGenerics
[
- template "genericWithMultipleTypeParams" "ICallable" "genericWithMultipleTypeParams<,,>"
+ template "genericWithMultipleTypeParams__" "ICallable" "genericWithMultipleTypeParams<,,>"
]
|> testOne callsGenericWithMultipleTypeParams
[
- template "Z" "IUnitary" "global::Microsoft.Quantum.Intrinsic.Z"
+ template "Z__" "IUnitary" "global::Microsoft.Quantum.Intrinsic.Z"
"this.self = this;"
]
|> testOne selfInvokingOperation
@@ -981,27 +981,27 @@ namespace N1
let template = sprintf @"protected %s %s { get; set; }"
[
- template "Allocate" "Allocate"
- template "IAdjointable<(Qubit,Qubit)>" "CNOT"
- template "ICallable" "MicrosoftQuantumTestingHold"
- template "Release" "Release"
- template "ICallable" "ResultToString"
- template "IUnitary" "X"
- template "IUnitary" "genIter"
- template "ICallable" "genMapper"
- template "IUnitary" "genU1"
- template "IUnitary" "MicrosoftQuantumTestingnoOpGeneric"
- template "IUnitary" "MicrosoftQuantumTestingnoOpResult"
+ template "Allocate" "Allocate__"
+ template "IAdjointable<(Qubit,Qubit)>" "CNOT__"
+ template "ICallable" "Microsoft__Quantum__Testing__Hold"
+ template "Release" "Release__"
+ template "ICallable" "ResultToString__"
+ template "IUnitary" "X__"
+ template "IUnitary" "genIter__"
+ template "ICallable" "genMapper__"
+ template "IUnitary" "genU1__"
+ template "IUnitary" "Microsoft__Quantum__Testing__noOpGeneric"
+ template "IUnitary" "Microsoft__Quantum__Testing__noOpResult"
]
|> testOne usesGenerics
[
- template "ICallable" "genericWithMultipleTypeParams"
+ template "ICallable" "genericWithMultipleTypeParams__"
]
|> testOne callsGenericWithMultipleTypeParams
[
- template "IUnitary" "Z"
+ template "IUnitary" "Z__"
template "IAdjointable" "self"
]
|> testOne selfInvokingOperation
@@ -1015,7 +1015,7 @@ namespace N1
let ``buildOperationInfoProperty test`` () =
let testOne (_, op) expectedCodeString =
let context = {createTestContext op with entryPoints = ImmutableArray.Create op.FullName}
- let (_, operationName) = findClassName context op
+ let (_, operationName) = findClassName op
let inType = op.Signature.ArgumentType |> roslynTypeName context
let outType = op.Signature.ReturnType |> roslynTypeName context
let codeString =
@@ -1094,37 +1094,37 @@ namespace N1
|> testOne (applyVisitor zeroQubitOperation)
[
- "X.Apply(q1);"
+ "X__.Apply(q1);"
]
|> testOne (applyVisitor oneQubitOperation)
[
- "X.Adjoint.Apply(q1);"
+ "X__.Adjoint.Apply(q1);"
]
|> testOne (adjointVisitor oneQubitOperation)
[
"var (q2, r) = t1; "
- "CNOT.Apply((q1,q2)); "
- "R.Apply((r,q1)); "
+ "CNOT__.Apply((q1,q2)); "
+ "R__.Apply((r,q1)); "
]
|> testOne (applyVisitor twoQubitOperation)
[
"var (q2, r) = t1; "
- "R.Adjoint.Apply((r,q1));"
- "CNOT.Adjoint.Apply((q1,q2));"
+ "R__.Adjoint.Apply((r,q1));"
+ "CNOT__.Adjoint.Apply((q1,q2));"
]
|> testOne (adjointVisitor twoQubitOperation)
[
- "three_op1.Apply((q1,q2));"
- "three_op1.Apply((q2,q1));"
- "three_op1.Apply((q1,q2));"
+ "three_op1__.Apply((q1,q2));"
+ "three_op1__.Apply((q2,q1));"
+ "three_op1__.Apply((q1,q2));"
]
|> testOne (applyVisitor threeQubitOperation)
[
- "Z.Adjoint.Apply(q1);"
+ "Z__.Adjoint.Apply(q1);"
"self.Apply(q1);"
]
|> testOne (adjointVisitor selfInvokingOperation)
@@ -1166,7 +1166,7 @@ namespace N1
let testOne = testOneBody
[
- "X.Apply(q1);"
+ "X__.Apply(q1);"
]
|> testOne (applyVisitor oneQubitOperation)
@@ -1180,7 +1180,7 @@ namespace N1
|> testOne (applyVisitor composeImpl)
[
- "return composeImpl.Partial((second, first, _));"
+ "return composeImpl__.Partial((second, first, _));"
]
|> testOne (applyVisitor compose)
@@ -1189,22 +1189,22 @@ namespace N1
let ``usesGenerics body`` () =
[
"var a = (IQArray)new QArray(Result.One, Result.Zero, Result.Zero);"
- "var s = (IQArray)new QArray(ResultToString.Apply(a[0L]), ResultToString.Apply(a[1L]));"
- "MicrosoftQuantumTestingnoOpResult.Apply(a[0L]);"
+ "var s = (IQArray)new QArray(ResultToString__.Apply(a[0L]), ResultToString__.Apply(a[1L]));"
+ "Microsoft__Quantum__Testing__noOpResult.Apply(a[0L]);"
"""
{
- var qubits = Allocate.Apply(3L);
+ var qubits = Allocate__.Apply(3L);
#line hidden
bool __arg1__ = true;
try
{
- var op = MicrosoftQuantumTestingHold.Partial(new Func((__arg2__) => (CNOT, (qubits[0L], qubits[1L]), __arg2__)));
+ var op = Microsoft__Quantum__Testing__Hold.Partial(new Func((__arg2__) => (CNOT__, (qubits[0L], qubits[1L]), __arg2__)));
op.Apply(QVoid.Instance);
- MicrosoftQuantumTestingnoOpGeneric.Apply(qubits[0L]);
- MicrosoftQuantumTestingnoOpGeneric.Apply(a[0L]);
- genIter.Apply((X, qubits));
+ Microsoft__Quantum__Testing__noOpGeneric.Apply(qubits[0L]);
+ Microsoft__Quantum__Testing__noOpGeneric.Apply(a[0L]);
+ genIter__.Apply((X__, qubits));
}
#line hidden
catch
@@ -1217,17 +1217,17 @@ namespace N1
{
if (__arg1__)
{
- Release.Apply(qubits);
+ Release__.Apply(qubits);
}
}
}
"""
- "genIter.Apply((MicrosoftQuantumTestingnoOpResult, a));"
+ "genIter__.Apply((Microsoft__Quantum__Testing__noOpResult, a));"
"""
- genIter.Apply((genU1, genMapper.Apply>((ResultToString, a))));
+ genIter__.Apply((genU1__, genMapper__.Apply>((ResultToString__, a))));
"""
- "genIter.Apply((genU1, s));"
- "genIter.Apply((genU1, a));"
+ "genIter__.Apply((genU1__, s));"
+ "genIter__.Apply((genU1__, a));"
]
|> testOneBody (applyVisitor usesGenerics)
@@ -1235,20 +1235,20 @@ namespace N1
[]
let ``callTests body`` () =
[
- "var plain = new call_plain(X);"
- "var adj = new call_adj(X);"
- "var ctr = new call_ctr(X);"
- "var uni = new call_uni(X);"
+ "var plain = new call_plain(X__);"
+ "var adj = new call_adj(X__);"
+ "var ctr = new call_ctr(X__);"
+ "var uni = new call_uni(X__);"
- "X.Apply(qubits.Data[0L]);"
- "X.Adjoint.Apply(qubits.Data[0L]);"
- "X.Controlled.Apply((qubits.Data.Slice(new QRange(1L,5L)), qubits.Data[0L]));"
+ "X__.Apply(qubits.Data[0L]);"
+ "X__.Adjoint.Apply(qubits.Data[0L]);"
+ "X__.Controlled.Apply((qubits.Data.Slice(new QRange(1L,5L)), qubits.Data[0L]));"
- "call_target1.Apply((1L, X, X, X, X));"
- "call_target1.Apply((1L, plain.Data, adj.Data, ctr.Data, uni.Data));"
+ "call_target1__.Apply((1L, X__, X__, X__, X__));"
+ "call_target1__.Apply((1L, plain.Data, adj.Data, ctr.Data, uni.Data));"
- "call_target2.Apply((1L, (Result.Zero, X), (Result.Zero, X), (Result.Zero, X), (Result.Zero, X)));"
- "call_target2.Apply((2L, (Result.One, plain.Data), (Result.One, adj.Data), (Result.One, ctr.Data), (Result.One, uni.Data)));"
+ "call_target2__.Apply((1L, (Result.Zero, X__), (Result.Zero, X__), (Result.Zero, X__), (Result.Zero, X__)));"
+ "call_target2__.Apply((2L, (Result.One, plain.Data), (Result.One, adj.Data), (Result.One, ctr.Data), (Result.One, uni.Data)));"
]
|> testOneBody (applyVisitor callTests)
@@ -1258,7 +1258,7 @@ namespace N1
[
"var q2 = q1;"
- "var r = M.Apply(q1);"
+ "var r = M__.Apply(q1);"
"var i = 1.1D;"
"var iZero = 0L;"
@@ -1291,7 +1291,7 @@ namespace N1
"var __arg1__ = t;"
"var __arg2__ = t;"
- "return let_f0.Apply(n);"
+ "return let_f0__.Apply(n);"
]
|> testOneBody (applyVisitor letsOperations)
@@ -1334,7 +1334,7 @@ namespace N1
"""
if ((r == Result.One))
{
- n = (if_f0.Apply(QVoid.Instance) * i);
+ n = (if_f0__.Apply(QVoid.Instance) * i);
}
"""
"""
@@ -1358,7 +1358,7 @@ namespace N1
}
else
{
- return ((p==Pauli.PauliI)?3L:if_f0.Apply(QVoid.Instance));
+ return ((p==Pauli.PauliI)?3L:if_f0__.Apply(QVoid.Instance));
}
"""
]
@@ -1382,7 +1382,7 @@ namespace N1
@"foreach (var n in range)
#line hidden
{
- result = ((range.End + result) + (n * -(foreach_f2.Apply((n, 4L)))));
+ result = ((range.End + result) + (n * -(foreach_f2__.Apply((n, 4L)))));
}"
"""
if ((result > 10L))
@@ -1420,7 +1420,7 @@ namespace N1
[]
let ``test Length dependency`` () =
[
- "iter.Apply((Length, new QArray>(new QArray(Result.One), new QArray(Result.Zero, Result.One))));"
+ "iter__.Apply((Length__, new QArray>(new QArray(Result.One), new QArray(Result.Zero, Result.One))));"
]
|> testOneBody (applyVisitor testLengthDependency)
@@ -1481,22 +1481,22 @@ namespace N1
[
"""
{
- var qubits = Allocate.Apply(i);
+ var qubits = Allocate__.Apply(i);
#line hidden
bool __arg1__ = true;
try
{
while (true)
{
- var res = repeat_op0.Apply(new repeat_udt0((0L, qubits)));
+ var res = repeat_op0__.Apply(new repeat_udt0((0L, qubits)));
- if ((repeat_op1.Apply((0L, qubits)) == Result.One))
+ if ((repeat_op1__.Apply((0L, qubits)) == Result.One))
{
break;
}
else
{
- res = repeat_op2.Apply((3D, new repeat_udt0(((i-1L), qubits))));
+ res = repeat_op2__.Apply((3D, new repeat_udt0(((i-1L), qubits))));
}
}
}
@@ -1511,7 +1511,7 @@ namespace N1
{
if (__arg1__)
{
- Release.Apply(qubits);
+ Release__.Apply(qubits);
}
}
}
@@ -1524,14 +1524,14 @@ namespace N1
[
"""
{
- var q = Allocate.Apply();
+ var q = Allocate__.Apply();
#line hidden
bool __arg1__ = true;
try
{
var flag = true;
- (flag ? X : Z).Apply(q);
- alloc_op0.Apply(q);
+ (flag ? X__ : Z__).Apply(q);
+ alloc_op0__.Apply(q);
}
#line hidden
catch
@@ -1544,18 +1544,18 @@ namespace N1
{
if (__arg1__)
{
- Release.Apply(q);
+ Release__.Apply(q);
}
}
}"""
"""
{
- var qs = Allocate.Apply(n);
+ var qs = Allocate__.Apply(n);
#line hidden
bool __arg2__ = true;
try
{
- alloc_op0.Apply(qs[(n-1L)]);
+ alloc_op0__.Apply(qs[(n-1L)]);
}
#line hidden
catch
@@ -1568,19 +1568,19 @@ namespace N1
{
if (__arg2__)
{
- Release.Apply(qs);
+ Release__.Apply(qs);
}
}
}"""
"""
{
- var (q1, (q2, (__arg3__, q3, __arg4__, q4))) = (Allocate.Apply(), ((Allocate.Apply(), Allocate.Apply(2L)), (Allocate.Apply(), Allocate.Apply(n), Allocate.Apply((n-1L)), Allocate.Apply(4L))));
+ var (q1, (q2, (__arg3__, q3, __arg4__, q4))) = (Allocate__.Apply(), ((Allocate__.Apply(), Allocate__.Apply(2L)), (Allocate__.Apply(), Allocate__.Apply(n), Allocate__.Apply((n-1L)), Allocate__.Apply(4L))));
#line hidden
bool __arg5__ = true;
try
{
- alloc_op0.Apply(q1);
- alloc_op0.Apply(q3[1L]);
+ alloc_op0__.Apply(q1);
+ alloc_op0__.Apply(q3[1L]);
}
#line hidden
catch
@@ -1593,13 +1593,13 @@ namespace N1
{
if (__arg5__)
{
- Release.Apply(q1);
- Release.Apply(q2.Item1);
- Release.Apply(q2.Item2);
- Release.Apply(__arg3__);
- Release.Apply(q3);
- Release.Apply(__arg4__);
- Release.Apply(q4);
+ Release__.Apply(q1);
+ Release__.Apply(q2.Item1);
+ Release__.Apply(q2.Item2);
+ Release__.Apply(__arg3__);
+ Release__.Apply(q3);
+ Release__.Apply(__arg4__);
+ Release__.Apply(q4);
}
}
}"""
@@ -1609,12 +1609,12 @@ namespace N1
[
"""
{
- var b = Borrow.Apply(n);
+ var b = Borrow__.Apply(n);
#line hidden
bool __arg1__ = true;
try
{
- alloc_op0.Apply(b[(n-1L)]);
+ alloc_op0__.Apply(b[(n-1L)]);
}
#line hidden
catch
@@ -1627,25 +1627,25 @@ namespace N1
{
if (__arg1__)
{
- Return.Apply(b);
+ Return__.Apply(b);
}
}
}"""
"""
{
- var (q1, (q2, (__arg2__, q3))) = (Borrow.Apply(), (Borrow.Apply(2L), (Borrow.Apply(), (Borrow.Apply(n), Borrow.Apply(4L)))));
+ var (q1, (q2, (__arg2__, q3))) = (Borrow__.Apply(), (Borrow__.Apply(2L), (Borrow__.Apply(), (Borrow__.Apply(n), Borrow__.Apply(4L)))));
#line hidden
bool __arg3__ = true;
try
{
{
- var qt = (Allocate.Apply(), (Allocate.Apply(1L), Allocate.Apply(2L)));
+ var qt = (Allocate__.Apply(), (Allocate__.Apply(1L), Allocate__.Apply(2L)));
#line hidden
bool __arg4__ = true;
try
{
var (qt1, qt2) = ((Qubit, (IQArray, IQArray)))qt;
- alloc_op0.Apply(qt1);
+ alloc_op0__.Apply(qt1);
}
#line hidden
catch
@@ -1658,15 +1658,15 @@ namespace N1
{
if (__arg4__)
{
- Release.Apply(qt.Item1);
- Release.Apply(qt.Item2.Item1);
- Release.Apply(qt.Item2.Item2);
+ Release__.Apply(qt.Item1);
+ Release__.Apply(qt.Item2.Item1);
+ Release__.Apply(qt.Item2.Item2);
}
}
}
- alloc_op0.Apply(q1);
- alloc_op0.Apply(q2[1L]);
+ alloc_op0__.Apply(q1);
+ alloc_op0__.Apply(q2[1L]);
}
#line hidden
catch
@@ -1679,11 +1679,11 @@ namespace N1
{
if (__arg3__)
{
- Return.Apply(q1);
- Return.Apply(q2);
- Return.Apply(__arg2__);
- Return.Apply(q3.Item1);
- Return.Apply(q3.Item2);
+ Return__.Apply(q1);
+ Return__.Apply(q2);
+ Return__.Apply(__arg2__);
+ Return__.Apply(q3.Item1);
+ Return__.Apply(q3.Item2);
}
}
}"""
@@ -1732,7 +1732,7 @@ namespace N1
|> testOne randomAbstractOperation
Some """
- public override Func Body => (__in__) =>
+ public override Func __Body__ => (__in__) =>
{
#line hidden
return QVoid.Instance;
@@ -1740,11 +1740,11 @@ namespace N1
|> testOne zeroQubitOperation
Some """
- public override Func Body => (__in__) =>
+ public override Func __Body__ => (__in__) =>
{
var q1 = __in__;
- X.Apply(q1);
+ X__.Apply(q1);
#line hidden
return QVoid.Instance;
};
@@ -1752,14 +1752,14 @@ namespace N1
|> testOne oneQubitOperation
Some """
- public override Func<(Qubit,(Qubit,Double)), QVoid> Body => (__in__) =>
+ public override Func<(Qubit,(Qubit,Double)), QVoid> __Body__ => (__in__) =>
{
var (q1,t1) = __in__;
var (q2,r) = t1;
- CNOT.Apply((q1, q2));
- R.Apply((r, q1));
+ CNOT__.Apply((q1, q2));
+ R__.Apply((r, q1));
#line hidden
return QVoid.Instance;
@@ -1769,14 +1769,14 @@ namespace N1
Some """
- public override Func<(Qubit,Qubit,IQArray), QVoid> Body => (__in__) =>
+ public override Func<(Qubit,Qubit,IQArray), QVoid> __Body__ => (__in__) =>
{
var (q1,q2,arr1) = __in__;
- da_op0.Apply(QVoid.Instance);
- da_op1.Adjoint.Apply(q1);
- da_op2.Controlled.Apply((new QArray(q1), (1L, q2)));
- da_op3.Controlled.Adjoint.Apply((new QArray(q1, q2), (1.1D, Result.One, arr1.Length)));
+ da_op0__.Apply(QVoid.Instance);
+ da_op1__.Adjoint.Apply(q1);
+ da_op2__.Controlled.Apply((new QArray(q1), (1L, q2)));
+ da_op3__.Controlled.Adjoint.Apply((new QArray(q1, q2), (1.1D, Result.One, arr1.Length)));
#line hidden
return QVoid.Instance;
@@ -1796,10 +1796,10 @@ namespace N1
let op4 = "IUnitary";
let f1 = "ICallable"
Some (sprintf """
- public override Func<(Qubit, %s, %s, %s, (%s, %s), %s), %s> Body => (__in__) =>
+ public override Func<(Qubit, %s, %s, %s, (%s, %s), %s), %s> __Body__ => (__in__) =>
{
var (q1, op0, op1, op2, t1, f1) = __in__;
- op1.Apply(OP_1);
+ op1.Apply(OP_1__);
var v0 = op0;
var r0 = v0.Apply(q1);
var (op3, op4) = t1;
@@ -1863,7 +1863,7 @@ namespace N1
"var s1 = (IQArray)qubits.Slice(new QRange(0L,10L));"
"var s2 = (IQArray)qubits.Slice(r2);"
"var s3 = (IQArray)qubits.Slice(ranges[3L]);"
- "var s4 = (IQArray)qubits.Slice(GetMeARange.Apply(QVoid.Instance));"
+ "var s4 = (IQArray)qubits.Slice(GetMeARange__.Apply(QVoid.Instance));"
"return qubits.Slice(new QRange(10L,-(3L),0L));"
]
@@ -1925,17 +1925,17 @@ namespace N1
None
|> testOne oneQubitAbstractOperation
- Some "public override Func AdjointBody => Body;"
+ Some "public override Func __AdjointBody__ => __Body__;"
|> testOne oneQubitSelfAdjointAbstractOperation
None
|> testOne randomAbstractOperation
- Some "public override Func AdjointBody => Body;"
+ Some "public override Func __AdjointBody__ => __Body__;"
|> testOne oneQubitSelfAdjointOperation
Some """
- public override Func AdjointBody => (__in__) =>
+ public override Func __AdjointBody__ => (__in__) =>
{
#line hidden
return QVoid.Instance;
@@ -1943,10 +1943,10 @@ namespace N1
|> testOne zeroQubitOperation
Some """
- public override Func AdjointBody => (__in__) =>
+ public override Func __AdjointBody__ => (__in__) =>
{
var q1 = __in__;
- X.Adjoint.Apply(q1);
+ X__.Adjoint.Apply(q1);
#line hidden
return QVoid.Instance;
@@ -1954,14 +1954,14 @@ namespace N1
|> testOne oneQubitOperation
Some """
- public override Func<(Qubit,(Qubit,Double)), QVoid> AdjointBody => (__in__) =>
+ public override Func<(Qubit,(Qubit,Double)), QVoid> __AdjointBody__ => (__in__) =>
{
var (q1,t1) = __in__;
var (q2,r) = t1;
- R.Adjoint.Apply((r, q1));
- CNOT.Adjoint.Apply((q1, q2));
+ R__.Adjoint.Apply((r, q1));
+ CNOT__.Adjoint.Apply((q1, q2));
#line hidden
return QVoid.Instance;
@@ -1969,19 +1969,19 @@ namespace N1
|> testOne twoQubitOperation
Some """
- public override Func<(Qubit,Qubit,Qubits), QVoid> AdjointBody => (__in__) =>
+ public override Func<(Qubit,Qubit,Qubits), QVoid> __AdjointBody__ => (__in__) =>
{
var (q1,q2,arr1) = __in__;
- three_op1.Adjoint.Apply((q1, q2));
- three_op1.Adjoint.Apply((q2, q1));
- three_op1.Adjoint.Apply((q1, q2));
+ three_op1__.Adjoint.Apply((q1, q2));
+ three_op1__.Adjoint.Apply((q2, q1));
+ three_op1__.Adjoint.Apply((q1, q2));
#line hidden
return QVoid.Instance;
};"""
|> testOne threeQubitOperation
- Some "public override Func<__T__, QVoid> AdjointBody => Body;"
+ Some "public override Func<__T__, QVoid> __AdjointBody__ => __Body__;"
|> testOne genAdj1
[]
@@ -1998,7 +1998,7 @@ namespace N1
|> testOne randomAbstractOperation
Some """
- public override Func<(IQArray,QVoid), QVoid> ControlledBody => (__in__) =>
+ public override Func<(IQArray,QVoid), QVoid> __ControlledBody__ => (__in__) =>
{
var (__controlQubits__, __unitArg__) = __in__;
@@ -2008,11 +2008,11 @@ namespace N1
|> testOne zeroQubitOperation
Some """
- public override Func<(IQArray,Qubit), QVoid> ControlledBody => (__in__) =>
+ public override Func<(IQArray,Qubit), QVoid> __ControlledBody__ => (__in__) =>
{
var (c, q1) = __in__;
- X.Controlled.Apply((c, q1));
+ X__.Controlled.Apply((c, q1));
#line hidden
return QVoid.Instance;
@@ -2020,13 +2020,13 @@ namespace N1
|> testOne oneQubitOperation
Some """
- public override Func<(IQArray,(Qubit,Qubit,Qubits)), QVoid> ControlledBody => (__in__) =>
+ public override Func<(IQArray,(Qubit,Qubit,Qubits)), QVoid> __ControlledBody__ => (__in__) =>
{
var (c, (q1, q2, arr1)) = __in__;
- three_op1.Controlled.Apply((c, (q1, q2)));
- three_op1.Controlled.Apply((c, (q2, q1)));
- three_op1.Controlled.Apply((c, (q1, q2)));
+ three_op1__.Controlled.Apply((c, (q1, q2)));
+ three_op1__.Controlled.Apply((c, (q2, q1)));
+ three_op1__.Controlled.Apply((c, (q1, q2)));
#line hidden
return QVoid.Instance;
@@ -2040,14 +2040,14 @@ namespace N1
None
|> testOne oneQubitAbstractOperation
- Some "public override Func<(IQArray,Qubit), QVoid> ControlledAdjointBody => ControlledBody;"
+ Some "public override Func<(IQArray,Qubit), QVoid> __ControlledAdjointBody__ => __ControlledBody__;"
|> testOne oneQubitSelfAdjointAbstractOperation
None
|> testOne randomAbstractOperation
Some """
- public override Func<(IQArray,QVoid), QVoid> ControlledAdjointBody => (__in__) =>
+ public override Func<(IQArray,QVoid), QVoid> __ControlledAdjointBody__ => (__in__) =>
{
var (__controlQubits__, __unitArg__) = __in__;
@@ -2057,10 +2057,10 @@ namespace N1
|> testOne zeroQubitOperation
Some """
- public override Func<(IQArray, Qubit), QVoid> ControlledAdjointBody => (__in__) =>
+ public override Func<(IQArray, Qubit), QVoid> __ControlledAdjointBody__ => (__in__) =>
{
var (c,q1) = __in__;
- X.Controlled.Adjoint.Apply((c, q1));
+ X__.Controlled.Adjoint.Apply((c, q1));
#line hidden
return QVoid.Instance;
};"""
@@ -2068,13 +2068,13 @@ namespace N1
|> testOne oneQubitOperation
Some """
- public override Func<(IQArray,(Qubit,Qubit,Qubits)), QVoid> ControlledAdjointBody => (__in__) =>
+ public override Func<(IQArray,(Qubit,Qubit,Qubits)), QVoid> __ControlledAdjointBody__ => (__in__) =>
{
var (c,(q1,q2,arr1)) = __in__;
- three_op1.Controlled.Adjoint.Apply((c, (q1, q2)));
- three_op1.Controlled.Adjoint.Apply((c, (q2, q1)));
- three_op1.Controlled.Adjoint.Apply((c, (q1, q2)));
+ three_op1__.Controlled.Adjoint.Apply((c, (q1, q2)));
+ three_op1__.Controlled.Adjoint.Apply((c, (q2, q1)));
+ three_op1__.Controlled.Adjoint.Apply((c, (q1, q2)));
#line hidden
return QVoid.Instance;
@@ -2085,40 +2085,40 @@ namespace N1
let ``partial application`` () =
[
//todo: "partial1Args.Partial(_).Apply(1L);"
- "partial3Args
+ "partial3Args__
.Partial(new Func<(Int64,Double,Result), (Int64,Double,Result)>((__arg1__) => (__arg1__.Item1, __arg1__.Item2, __arg1__.Item3)))
.Apply((1L, 3.5D, Result.One));"
- "partial3Args
+ "partial3Args__
.Partial(new Func((__arg2__) => (1L, __arg2__, Result.Zero)))
.Apply(3.5D);"
- "partial3Args
+ "partial3Args__
.Partial(new Func<(Int64,Result), (Int64,Double,Result)>((__arg3__) => (__arg3__.Item1, 3.5D, __arg3__.Item2)))
.Apply((1L, Result.Zero));"
- "partial3Args
+ "partial3Args__
.Partial(new Func((__arg4__) => (1L, 3.5D, __arg4__)))
.Apply(Result.Zero);"
- "partial3Args
+ "partial3Args__
.Partial(new Func<(Double,Result), (Int64,Double,Result)>((__arg5__) => (1L, __arg5__.Item1, __arg5__.Item2)))
.Apply((3.5D, Result.Zero));"
- "partialInnerTuple
+ "partialInnerTuple__
.Partial(new Func<(Int64,(Double,Result)), (Int64,(Double,Result))>((__arg6__) => (__arg6__.Item1, (__arg6__.Item2.Item1, __arg6__.Item2.Item2))))
.Apply((1L, (3.5D, Result.One)));"
- "partialInnerTuple
+ "partialInnerTuple__
.Partial(new Func<(Int64,(Double,Result)), (Int64,(Double,Result))>((__arg7__) => (__arg7__.Item1, (__arg7__.Item2.Item1, __arg7__.Item2.Item2))))
.Apply((1L, (3.5D, Result.Zero)));"
- "partialInnerTuple
+ "partialInnerTuple__
.Partial(new Func<(Double,Result), (Int64,(Double,Result))>((__arg8__) => (1L, (__arg8__.Item1, __arg8__.Item2))))
.Apply((3.5D, Result.Zero));"
- "partialInnerTuple
+ "partialInnerTuple__
.Partial(new Func<(Int64,Result), (Int64,(Double,Result))>((__arg9__) => (__arg9__.Item1, (3.5D, __arg9__.Item2))))
.Apply((1L, Result.Zero));"
- "partialInnerTuple
+ "partialInnerTuple__
.Partial(new Func<(Int64,Double), (Int64,(Double,Result))>((__arg10__) => (__arg10__.Item1, (__arg10__.Item2, Result.One))))
.Apply((1L, 3.5D));"
- "partialInnerTuple
+ "partialInnerTuple__
.Partial(new Func((__arg11__) => (1L, (3.5D, __arg11__))))
.Apply(Result.One);"
- "partialNestedArgsOp
+ "partialNestedArgsOp__
.Partial(new Func<((Int64,Int64,Int64),((Double,Double),(Result,Result,Result))), ((Int64,Int64,Int64),((Double,Double),(Result,Result,Result)))>((__arg12__) =>
(
(__arg12__.Item1.Item1, __arg12__.Item1.Item2, __arg12__.Item1.Item3),
@@ -2138,7 +2138,7 @@ namespace N1
)
))
.Apply((1L, ((3.3D, 2D), Result.Zero)));"
- "partialNestedArgsOp
+ "partialNestedArgsOp__
.Partial(new Func<(Int64,((Double,Double),Result)), ((Int64,Int64,Int64),((Double,Double),(Result,Result,Result)))>((__arg14__) =>
(
(1L, i, __arg14__.Item1),
@@ -2158,7 +2158,7 @@ namespace N1
)
))
.Apply((3.3D, Result.Zero));"
- "partialNestedArgsOp
+ "partialNestedArgsOp__
.Partial(new Func<(Int64,(Double,Result)), ((Int64,Int64,Int64),((Double,Double),(Result,Result,Result)))>((__arg16__) =>
(
(i, __arg16__.Item1, 1L),
@@ -2174,20 +2174,20 @@ namespace N1
)
))
.Apply(3.3D);"
- "partialGeneric1
+ "partialGeneric1__
.Partial(new Func((__arg18__) =>
(0L, Result.Zero, (__arg18__, Result.One))
))
.Apply(1L);"
- "partialGeneric1
+ "partialGeneric1__
.Partial(new Func<(Int64, Result), (Int64, Result, (Int64, Result))>((__arg19__) =>
(__arg19__.Item1, __arg19__.Item2, (1L, Result.One))
))
.Apply((0L, Result.Zero));"
- "partialGeneric1.Partial((0L, _, (1L, _))).Apply((Result.Zero, Result.One));"
- "partialGeneric2.Partial((0L, Result.Zero, (_, Result.One))).Apply(1L);"
- "partialGeneric2.Partial((_, _, (1L, Result.One))).Apply((0L, Result.Zero));"
- "partialGeneric2.Partial((0L, _, (1L, _))).Apply((Result.Zero, Result.One));"
+ "partialGeneric1__.Partial((0L, _, (1L, _))).Apply((Result.Zero, Result.One));"
+ "partialGeneric2__.Partial((0L, Result.Zero, (_, Result.One))).Apply(1L);"
+ "partialGeneric2__.Partial((_, _, (1L, Result.One))).Apply((0L, Result.Zero));"
+ "partialGeneric2__.Partial((0L, _, (1L, _))).Apply((Result.Zero, Result.One));"
"partialInput
.Partial(new Func<(Double,(Result,Result)), (Int64,(Double,Double),(Result,Result,Result))>((__arg20__) =>
(
@@ -2202,7 +2202,7 @@ namespace N1
.Partial(new Func, (Double,ICallable,IQArray)>((__arg21__) =>
(
1.1D,
- partialFunction.Partial(new Func<(Int64,Double), (Int64,Double,Pauli)>((__arg22__) =>
+ partialFunction__.Partial(new Func<(Int64,Double), (Int64,Double,Pauli)>((__arg22__) =>
(
__arg22__.Item1,
__arg22__.Item2,
@@ -2216,10 +2216,10 @@ namespace N1
|> testOneBody (applyVisitor partialApplicationTest)
[
- "var r1 = partialFunction
+ "var r1 = partialFunction__
.Partial(new Func<(Int64,Double,Pauli), (Int64,Double,Pauli)>((__arg1__) => (__arg1__.Item1, __arg1__.Item2, __arg1__.Item3)))
.Apply((2L, 2.2D, Pauli.PauliY));"
- "var r2 = partialFunction
+ "var r2 = partialFunction__
.Partial(new Func<(Double,Pauli), (Int64,Double,Pauli)>((__arg2__) => (1L, __arg2__.Item1, __arg2__.Item2)))
.Partial(new Func((__arg3__) => (3.3D, __arg3__)))
.Apply(Pauli.PauliZ);"
@@ -2234,7 +2234,7 @@ namespace N1
let ``buildRun test`` () =
let testOne (_,op) expected =
let context = createTestContext op
- let (name, nonGenericName) = findClassName context op
+ let _, nonGenericName = findClassName op
let actual = buildRun context nonGenericName op.ArgumentTuple op.Signature.ArgumentType op.Signature.ReturnType |> formatSyntaxTree
Assert.Equal(expected |> clearFormatting, actual |> clearFormatting)
@@ -2357,10 +2357,10 @@ namespace N1
public static HoneywellEntryPointInfo Info => new HoneywellEntryPointInfo(typeof(emptyOperation));
- public override void Init() { }
+ public override void __Init__() { }
- public override IApplyData __dataIn(QVoid data) => data;
- public override IApplyData __dataOut(QVoid data) => data;
+ public override IApplyData __DataIn__(QVoid data) => data;
+ public override IApplyData __DataOut__(QVoid data) => data;
public static System.Threading.Tasks.Task Run(IOperationFactory __m__)
{
return __m__.Run(QVoid.Instance);
@@ -2396,10 +2396,10 @@ namespace N1
public static IonQEntryPointInfo<(Qubit, Basis, (Pauli, IQArray>, Boolean), Int64), QVoid> Info => new IonQEntryPointInfo<(Qubit, Basis, (Pauli, IQArray>, Boolean), Int64), QVoid>(typeof(randomAbstractOperation));
- public override void Init() { }
+ public override void __Init__() { }
- public override IApplyData __dataIn((Qubit,Basis,(Pauli,IQArray>,Boolean),Int64) data) => new In(data);
- public override IApplyData __dataOut(QVoid data) => data;
+ public override IApplyData __DataIn__((Qubit,Basis,(Pauli,IQArray>,Boolean),Int64) data) => new In(data);
+ public override IApplyData __DataOut__(QVoid data) => data;
public static System.Threading.Tasks.Task Run(IOperationFactory __m__, Qubit q1, Basis b, (Pauli,IQArray>,Boolean) t, Int64 i)
{
return __m__.Run>,Boolean),Int64), QVoid>((q1, b, t, i));
@@ -2424,52 +2424,52 @@ namespace N1
public static QCIEntryPointInfo Info => new QCIEntryPointInfo(typeof(oneQubitOperation));
- protected IUnitary X { get; set; }
+ protected IUnitary X__ { get; set; }
- public override Func Body => (__in__) =>
+ public override Func __Body__ => (__in__) =>
{
var q1 = __in__;
- X.Apply(q1);
+ X__.Apply(q1);
#line hidden
return QVoid.Instance;
}
;
- public override Func AdjointBody => (__in__) =>
+ public override Func __AdjointBody__ => (__in__) =>
{
var q1 = __in__;
- X.Adjoint.Apply(q1);
+ X__.Adjoint.Apply(q1);
#line hidden
return QVoid.Instance;
}
;
- public override Func<(IQArray,Qubit), QVoid> ControlledBody => (__in__) =>
+ public override Func<(IQArray,Qubit), QVoid> __ControlledBody__ => (__in__) =>
{
var (c,q1) = __in__;
- X.Controlled.Apply((c, q1));
+ X__.Controlled.Apply((c, q1));
#line hidden
return QVoid.Instance;
}
;
- public override Func<(IQArray,Qubit), QVoid> ControlledAdjointBody => (__in__) =>
+ public override Func<(IQArray,Qubit), QVoid> __ControlledAdjointBody__ => (__in__) =>
{
var (c,q1) = __in__;
- X.Controlled.Adjoint.Apply((c, q1));
+ X__.Controlled.Adjoint.Apply((c, q1));
#line hidden
return QVoid.Instance;
}
;
- public override void Init()
+ public override void __Init__()
{
- this.X = this.Factory.Get>(typeof(global::Microsoft.Quantum.Intrinsic.X));
+ this.X__ = this.__Factory__.Get>(typeof(global::Microsoft.Quantum.Intrinsic.X));
}
- public override IApplyData __dataIn(Qubit data) => data;
- public override IApplyData __dataOut(QVoid data) => data;
+ public override IApplyData __DataIn__(Qubit data) => data;
+ public override IApplyData __DataOut__(QVoid data) => data;
public static System.Threading.Tasks.Task Run(IOperationFactory __m__, Qubit q1)
{
return __m__.Run(q1);
@@ -2510,10 +2510,10 @@ namespace N1
public static HoneywellEntryPointInfo<(__X__, (Int64, (__Y__, __Z__), Result)), QVoid> Info => new HoneywellEntryPointInfo<(__X__, (Int64, (__Y__, __Z__), Result)), QVoid>(typeof(genCtrl3<__X__,__Y__,__Z__>));
- public override void Init() { }
+ public override void __Init__() { }
- public override IApplyData __dataIn((__X__,(Int64,(__Y__,__Z__),Result)) data) => new In(data);
- public override IApplyData __dataOut(QVoid data) => data;
+ public override IApplyData __DataIn__((__X__,(Int64,(__Y__,__Z__),Result)) data) => new In(data);
+ public override IApplyData __DataOut__(QVoid data) => data;
public static System.Threading.Tasks.Task Run(IOperationFactory __m__, __X__ arg1, (Int64,(__Y__,__Z__),Result) arg2)
{
return __m__.Run, (__X__,(Int64,(__Y__,__Z__),Result)), QVoid>((arg1, arg2));
@@ -2551,7 +2551,7 @@ namespace N1
public static IonQEntryPointInfo<(ICallable, ICallable, __B__), QVoid> Info => new IonQEntryPointInfo<(ICallable, ICallable, __B__), QVoid>(typeof(composeImpl<__A__,__B__>));
- public override Func<(ICallable,ICallable,__B__), QVoid> Body => (__in__) =>
+ public override Func<(ICallable,ICallable,__B__), QVoid> __Body__ => (__in__) =>
{
var (second,first,arg) = __in__;
second.Apply(first.Apply<__A__>(arg));
@@ -2559,10 +2559,10 @@ namespace N1
return QVoid.Instance;
};
- public override void Init() { }
+ public override void __Init__() { }
- public override IApplyData __dataIn((ICallable,ICallable,__B__) data) => new In(data);
- public override IApplyData __dataOut(QVoid data) => data;
+ public override IApplyData __DataIn__((ICallable,ICallable,__B__) data) => new In(data);
+ public override IApplyData __DataOut__(QVoid data) => data;
public static System.Threading.Tasks.Task Run(IOperationFactory __m__, ICallable second, ICallable first, __B__ arg)
{
return __m__.Run, (ICallable,ICallable,__B__), QVoid>((second, first, arg));
@@ -2585,10 +2585,10 @@ namespace N1
public static QCIEntryPointInfo<__A__, QVoid> Info => new QCIEntryPointInfo<__A__, QVoid>(typeof(genF1<__A__>));
- public override void Init() { }
+ public override void __Init__() { }
- public override IApplyData __dataIn(__A__ data) => new QTuple<__A__>(data);
- public override IApplyData __dataOut(QVoid data) => data;
+ public override IApplyData __DataIn__(__A__ data) => new QTuple<__A__>(data);
+ public override IApplyData __DataOut__(QVoid data) => data;
public static System.Threading.Tasks.Task Run(IOperationFactory __m__, __A__ arg)
{
return __m__.Run, __A__, QVoid>(arg);
@@ -2611,19 +2611,19 @@ internal partial class EmptyInternalFunction : Function, ICallable
String ICallable.FullName => "Microsoft.Quantum.Compiler.Generics.EmptyInternalFunction";
public static EntryPointInfo Info => new EntryPointInfo(typeof(EmptyInternalFunction));
- public override Func Body => (__in__) =>
+ public override Func __Body__ => (__in__) =>
{
#line hidden
return QVoid.Instance;
};
- public override void Init()
+ public override void __Init__()
{
}
- public override IApplyData __dataIn(QVoid data) => data;
+ public override IApplyData __DataIn__(QVoid data) => data;
- public override IApplyData __dataOut(QVoid data) => data;
+ public override IApplyData __DataOut__(QVoid data) => data;
public static System.Threading.Tasks.Task Run(IOperationFactory __m__)
{
@@ -2645,19 +2645,19 @@ internal partial class EmptyInternalOperation : Operation, ICallab
String ICallable.FullName => "Microsoft.Quantum.Compiler.Generics.EmptyInternalOperation";
public static EntryPointInfo Info => new EntryPointInfo(typeof(EmptyInternalOperation));
- public override Func Body => (__in__) =>
+ public override Func __Body__ => (__in__) =>
{
#line hidden
return QVoid.Instance;
};
- public override void Init()
+ public override void __Init__()
{
}
- public override IApplyData __dataIn(QVoid data) => data;
+ public override IApplyData __DataIn__(QVoid data) => data;
- public override IApplyData __dataOut(QVoid data) => data;
+ public override IApplyData __DataOut__(QVoid data) => data;
public static System.Threading.Tasks.Task Run(IOperationFactory __m__)
{
@@ -2671,17 +2671,17 @@ internal partial class EmptyInternalOperation : Operation, ICallab
[]
let ``duplicatedDefinitionsCaller body`` () =
[
- "emptyFunction.Apply(QVoid.Instance);"
- "MicrosoftQuantumOverridesemptyFunction.Apply(QVoid.Instance);"
+ "emptyFunction__.Apply(QVoid.Instance);"
+ "Microsoft__Quantum__Overrides__emptyFunction.Apply(QVoid.Instance);"
"""
{
- var qubits = Allocate.Apply(1L);
+ var qubits = Allocate__.Apply(1L);
#line hidden
bool __arg1__ = true;
try
{
- H.Apply(qubits[0L]);
- MicrosoftQuantumIntrinsicH.Apply(qubits[0L]);
+ H__.Apply(qubits[0L]);
+ Microsoft__Quantum__Intrinsic__H.Apply(qubits[0L]);
}
#line hidden
catch
@@ -2694,7 +2694,7 @@ internal partial class EmptyInternalOperation : Operation, ICallab
{
if (__arg1__)
{
- Release.Apply(qubits);
+ Release__.Apply(qubits);
}
}
}"""
@@ -2709,12 +2709,12 @@ internal partial class EmptyInternalOperation : Operation, ICallab
let expected =
[
- template "Allocate" "Allocate"
- template "IUnitary" "MicrosoftQuantumIntrinsicH"
- template "ICallable" "H"
- template "Release" "Release"
- template "ICallable" "MicrosoftQuantumOverridesemptyFunction"
- template "ICallable" "emptyFunction"
+ template "Allocate" "Allocate__"
+ template "IUnitary" "Microsoft__Quantum__Intrinsic__H"
+ template "ICallable" "H__"
+ template "Release" "Release__"
+ template "ICallable" "Microsoft__Quantum__Overrides__emptyFunction"
+ template "ICallable" "emptyFunction__"
]
let (_,op) = duplicatedDefinitionsCaller
@@ -2730,7 +2730,7 @@ internal partial class EmptyInternalOperation : Operation, ICallab
[]
let ``buildOpsProperties - internal callables`` () =
- let property = sprintf "private protected %s %s { get; set; }"
+ let property = sprintf "private protected %s %s__ { get; set; }"
let expected =
[
property "ICallable" "EmptyInternalFunction"
@@ -2762,17 +2762,17 @@ internal partial class EmptyInternalOperation : Operation, ICallab
String ICallable.FullName => "Microsoft.Quantum.Compiler.Generics.UpdateUdtItems";
public static EntryPointInfo Info => new EntryPointInfo(typeof(UpdateUdtItems));
- public override Func Body => (__in__) =>
+ public override Func __Body__ => (__in__) =>
{
var udt = __in__;
vararr=QArray.Create(10L);
return new MyType2((1L,udt.Data.Item2,(arr?.Copy(),udt.Data.Item3.Item2)));
};
- public override void Init() { }
+ public override void __Init__() { }
- public override IApplyData __dataIn(MyType2data) => data;
- public override IApplyData __dataOut(MyType2data) => data;
+ public override IApplyData __DataIn__(MyType2data) => data;
+ public override IApplyData __DataOut__(MyType2data) => data;
public static System.Threading.Tasks.Task Run(IOperationFactory __m__, MyType2 udt)
{
return __m__.Run(udt);
@@ -2793,10 +2793,10 @@ internal partial class EmptyInternalOperation : Operation, ICallab
String ICallable.FullName => "Microsoft.Quantum.Overrides.emptyFunction";
public static EntryPointInfo Info => new EntryPointInfo(typeof(emptyFunction));
- public override void Init() { }
+ public override void __Init__() { }
- public override IApplyData __dataIn(QVoid data) => data;
- public override IApplyData __dataOut(QVoid data) => data;
+ public override IApplyData __DataIn__(QVoid data) => data;
+ public override IApplyData __DataOut__(QVoid data) => data;
public static System.Threading.Tasks.Task