diff --git a/src/Simulation/CsharpGeneration.Tests/Circuits/CodegenTests.qs b/src/Simulation/CsharpGeneration.Tests/Circuits/CodegenTests.qs index 131e7899e01..a491fe0d43f 100644 --- a/src/Simulation/CsharpGeneration.Tests/Circuits/CodegenTests.qs +++ b/src/Simulation/CsharpGeneration.Tests/Circuits/CodegenTests.qs @@ -1262,6 +1262,11 @@ namespace Microsoft.Quantum.Compiler.Generics { genIter(genU1, a); } + operation genericWithMultipleTypeParams<'A, 'B, 'C>() : Unit { } + + operation callsGenericWithMultipleTypeParams () : Unit { + genericWithMultipleTypeParams(); + } operation composeImpl<'A, 'B> (second : ('A => Unit), first : ('B => 'A), arg : 'B) : Unit { diff --git a/src/Simulation/CsharpGeneration.Tests/SimulationCodeTests.fs b/src/Simulation/CsharpGeneration.Tests/SimulationCodeTests.fs index 90416d37e9e..de97e3aedc8 100644 --- a/src/Simulation/CsharpGeneration.Tests/SimulationCodeTests.fs +++ b/src/Simulation/CsharpGeneration.Tests/SimulationCodeTests.fs @@ -167,6 +167,7 @@ namespace N1 let genMapper = findCallable @"genMapper" let genIter = findCallable @"genIter" let usesGenerics = findCallable @"usesGenerics" + let callsGenericWithMultipleTypeParams = findCallable @"callsGenericWithMultipleTypeParams" let duplicatedDefinitionsCaller = findCallable @"duplicatedDefinitionsCaller" let nestedArgTuple1 = findCallable @"nestedArgTuple1" let nestedArgTuple2 = findCallable @"nestedArgTuple2" @@ -453,6 +454,11 @@ namespace N1 ] |> testOne usesGenerics + [ + ((NSG, "genericWithMultipleTypeParams"), "ICallable") + ] + |> testOne callsGenericWithMultipleTypeParams + [ ((NS2, "Allocate" ), "Allocate") ((NS2, "H" ), "IUnitary") @@ -897,13 +903,18 @@ namespace N1 |> testOne usesGenerics [ - template "Z" "IUnitary" "Microsoft.Quantum.Intrinsic.Z" + template "genericWithMultipleTypeParams" "ICallable" "genericWithMultipleTypeParams<,,>" + ] + |> testOne callsGenericWithMultipleTypeParams + + [ + template "Z" "IUnitary" "Microsoft.Quantum.Intrinsic.Z" "this.self = this;" ] |> testOne selfInvokingOperation [ - template "self" "ICallable" "genRecursion<>" + template "self" "ICallable" "genRecursion<>" ] |> testOne genRecursion @@ -934,6 +945,11 @@ namespace N1 |> List.sort |> testOne usesGenerics + [ + template "genericWithMultipleTypeParams<,,>" + ] + |> testOne callsGenericWithMultipleTypeParams + [ template "composeImpl<,>" ] @@ -979,6 +995,11 @@ namespace N1 ] |> testOne usesGenerics + [ + template "ICallable" "genericWithMultipleTypeParams" + ] + |> testOne callsGenericWithMultipleTypeParams + [ template "IUnitary" "Z" template "IAdjointable" "self" @@ -2502,7 +2523,7 @@ namespace N1 |> testOneClass genCtrl3 AssemblyConstants.HoneywellProcessor """ - [SourceLocation("%%%", OperationFunctor.Body, 1266, 1272)] + [SourceLocation("%%%", OperationFunctor.Body, 1271, 1277)] public partial class composeImpl<__A__, __B__> : Operation<(ICallable,ICallable,__B__), QVoid>, ICallable { public composeImpl(IOperationFactory m) : base(m) @@ -2579,7 +2600,7 @@ namespace N1 [] let ``buildOperationClass - access modifiers`` () = """ -[SourceLocation("%%%", OperationFunctor.Body, 1314, 1316)] +[SourceLocation("%%%", OperationFunctor.Body, 1319, 1321)] internal partial class EmptyInternalFunction : Function, ICallable { public EmptyInternalFunction(IOperationFactory m) : base(m) @@ -2613,7 +2634,7 @@ internal partial class EmptyInternalFunction : Function, ICallable |> testOneClass emptyInternalFunction null """ -[SourceLocation("%%%", OperationFunctor.Body, 1316, 1318)] +[SourceLocation("%%%", OperationFunctor.Body, 1321, 1323)] internal partial class EmptyInternalOperation : Operation, ICallable { public EmptyInternalOperation(IOperationFactory m) : base(m) @@ -2730,7 +2751,7 @@ internal partial class EmptyInternalOperation : Operation, ICallab [] let ``buildOperationClass - concrete functions`` () = """ - [SourceLocation("%%%", OperationFunctor.Body, 1301,1310)] + [SourceLocation("%%%", OperationFunctor.Body, 1306,1315)] public partial class UpdateUdtItems : Function, ICallable { public UpdateUdtItems(IOperationFactorym) : base(m) diff --git a/src/Simulation/CsharpGeneration/SimulationCode.fs b/src/Simulation/CsharpGeneration/SimulationCode.fs index 30e83926c90..30d8bcdd95a 100644 --- a/src/Simulation/CsharpGeneration/SimulationCode.fs +++ b/src/Simulation/CsharpGeneration/SimulationCode.fs @@ -93,9 +93,7 @@ module SimulationCode = let isGeneric context (n: QsQualifiedName) = if context.allCallables.ContainsKey n then let signature = context.allCallables.[n].Signature - let tIn = signature.ArgumentType - let tOut = signature.ReturnType - hasTypeParameters [tIn;tOut] + not signature.TypeParameters.IsEmpty else false @@ -861,9 +859,7 @@ module SimulationCode = let opName = if sameNamespace then n.Name.Value else n.Namespace.Value + "." + n.Name.Value if isGeneric context n then let signature = context.allCallables.[n].Signature - let tIn = signature.ArgumentType - let tOut = signature.ReturnType - let count = (getTypeParameters [tIn;tOut]).Length + let count = signature.TypeParameters.Length sprintf "%s<%s>" opName (String.replicate (count - 1) ",") else opName diff --git a/src/Simulation/Simulators.Tests/TestProjects/HoneywellExe/ClassicallyControlledSupportTests.qs b/src/Simulation/Simulators.Tests/TestProjects/HoneywellExe/ClassicallyControlledSupportTests.qs index 2cd17b39207..34f140ee6b0 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/HoneywellExe/ClassicallyControlledSupportTests.qs +++ b/src/Simulation/Simulators.Tests/TestProjects/HoneywellExe/ClassicallyControlledSupportTests.qs @@ -1,680 +1,679 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - - -namespace Microsoft.Quantum.Simulation.Testing.Honeywell.ClassicallyControlledSupportTests { - - open Microsoft.Quantum.Intrinsic; - - operation SubOp1() : Unit { } - operation SubOp2() : Unit { } - operation SubOp3() : Unit { } - - operation SubOpCA1() : Unit is Ctl + Adj { } - operation SubOpCA2() : Unit is Ctl + Adj { } - operation SubOpCA3() : Unit is Ctl + Adj { } - - operation BranchOnMeasurement() : Unit { - using (q = Qubit()) { - H(q); - let r = M(q); - if (r == Zero) { - SubOp1(); - } - Reset(q); - } - } - - operation BasicLift() : Unit { - let r = Zero; - if (r == Zero) { - SubOp1(); - SubOp2(); - SubOp3(); - let temp = 4; - using (q = Qubit()) { - let temp2 = q; - } - } - } - - operation LiftLoops() : Unit { - let r = Zero; - if (r == Zero) { - for (index in 0 .. 3) { - let temp = index; - } - - repeat { - let success = true; - } until (success) - fixup { - let temp2 = 0; - } - } - } - - operation LiftSingleNonCall() : Unit { - let r = Zero; - if (r == Zero) { - let temp = 2; - } - } - - operation LiftSelfContainedMutable() : Unit { - let r = Zero; - if (r == Zero) { - mutable temp = 3; - set temp = 4; - } - } - - operation PartiallyResolved<'Q, 'W> (q : 'Q, w : 'W) : Unit { } - - operation ArgumentsPartiallyResolveTypeParameters() : Unit { - let r = Zero; - if (r == Zero) { - PartiallyResolved(1, 1.0); - } - } - - operation LiftFunctorApplication() : Unit { - let r = Zero; - if (r == Zero) { - Adjoint SubOpCA1(); - } - } - - operation PartialApplication(q : Int, w : Double) : Unit { } - - operation LiftPartialApplication() : Unit { - let r = Zero; - if (r == Zero) { - (PartialApplication(1, _))(1.0); - } - } - - operation LiftArrayItemCall() : Unit { - let f = [SubOp1]; - let r = Zero; - if (r == Zero) { - f[0](); - } - } - - operation LiftOneNotBoth() : Unit { - let r = Zero; - if (r == Zero) { - SubOp1(); - SubOp2(); - } - else { - SubOp3(); - } - } - - operation ApplyIfZero_Test() : Unit { - let r = Zero; - if (r == Zero) { - SubOp1(); - } - } - - operation ApplyIfOne_Test() : Unit { - let r = Zero; - if (r == One) { - SubOp1(); - } - } - - operation ApplyIfZeroElseOne() : Unit { - let r = Zero; - if (r == Zero) { - SubOp1(); - } else { - SubOp2(); - } - } - - operation ApplyIfOneElseZero() : Unit { - let r = Zero; - if (r == One) { - SubOp1(); - } else { - SubOp2(); - } - } - - operation IfElif() : Unit { - let r = Zero; - - if (r == Zero) { - SubOp1(); - } elif (r == One) { - SubOp2(); - } else { - SubOp3(); - } - } - - operation AndCondition() : Unit { - let r = Zero; - if (r == Zero and r == One) { - SubOp1(); - } else { - SubOp2(); - } - } - - operation OrCondition() : Unit { - let r = Zero; - if (r == Zero or r == One) { - SubOp1(); - } else { - SubOp2(); - } - } - - operation ApplyConditionally() : Unit { - let r1 = Zero; - let r2 = Zero; - if (r1 == r2) { - SubOp1(); - } - else { - SubOp2(); - } - } - - operation ApplyConditionallyWithNoOp() : Unit { - let r1 = Zero; - let r2 = Zero; - if (r1 == r2) { - SubOp1(); - } - } - - operation InequalityWithApplyConditionally() : Unit { - let r1 = Zero; - let r2 = Zero; - if (r1 != r2) { - SubOp1(); - } - else { - SubOp2(); - } - } - - operation InequalityWithApplyIfOneElseZero() : Unit { - let r = Zero; - if (r != Zero) { - SubOp1(); - } - else { - SubOp2(); - } - } - - operation InequalityWithApplyIfZeroElseOne() : Unit { - let r = Zero; - if (r != One) { - SubOp1(); - } - else { - SubOp2(); - } - } - - operation InequalityWithApplyIfOne() : Unit { - let r = Zero; - if (r != Zero) { - SubOp1(); - } - } - - operation InequalityWithApplyIfZero() : Unit { - let r = Zero; - if (r != One) { - SubOp1(); - } - } - - operation LiteralOnTheLeft() : Unit { - let r = Zero; - if (Zero == r) { - SubOp1(); - } - } - - // ToDo: Uncomment once #17245 is fixed. - //operation GenericsSupport<'A, 'B, 'C>() : Unit { - // let r = Zero; - // - // if (r == Zero) { - // SubOp1(); - // SubOp2(); - // } - //} - - operation WithinBlockSupport() : Unit { - let r = One; - within { - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } apply { - if (r == One) { - SubOpCA2(); - SubOpCA3(); - } - } - } - - operation AdjointSupportProvided() : Unit is Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - adjoint (...) { - let w = One; - - if (w == One) { - SubOpCA2(); - SubOpCA3(); - } - } - } - - operation AdjointSupportSelf() : Unit is Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - adjoint self; - } - - operation AdjointSupportInvert() : Unit is Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - adjoint invert; - } - - operation ControlledSupportProvided() : Unit is Ctl { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - controlled (ctl, ...) { - let w = One; - - if (w == One) { - SubOpCA2(); - SubOpCA3(); - } - } - } - - operation ControlledSupportDistribute() : Unit is Ctl { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - controlled distribute; - } - - operation ControlledAdjointSupportProvided_ProvidedBody() : Unit is Ctl + Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - controlled adjoint (ctl, ...) { - let y = One; - - if (y == One) { - SubOpCA2(); - SubOpCA3(); - } - } - } - - operation ControlledAdjointSupportProvided_ProvidedAdjoint() : Unit is Ctl + Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - adjoint (...) { - let w = One; - - if (w == One) { - SubOpCA3(); - SubOpCA1(); - } - } - - controlled adjoint (ctl, ...) { - let y = One; - - if (y == One) { - SubOpCA2(); - SubOpCA3(); - } - } - } - - operation ControlledAdjointSupportProvided_ProvidedControlled() : Unit is Ctl + Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - controlled (ctl, ...) { - let w = One; - - if (w == One) { - SubOpCA3(); - SubOpCA1(); - } - } - - controlled adjoint (ctl, ...) { - let y = One; - - if (y == One) { - SubOpCA2(); - SubOpCA3(); - } - } - } - - operation ControlledAdjointSupportProvided_ProvidedAll() : Unit is Ctl + Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - controlled (ctl, ...) { - let w = One; - - if (w == One) { - SubOpCA3(); - SubOpCA1(); - } - } - - adjoint (...) { - let y = One; - - if (y == One) { - SubOpCA2(); - SubOpCA3(); - } - } - - controlled adjoint (ctl, ...) { - let b = One; - - if (b == One) { - let temp1 = 0; - let temp2 = 0; - SubOpCA3(); - } - } - } - - operation ControlledAdjointSupportDistribute_DistributeBody() : Unit is Ctl + Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - controlled adjoint distribute; - } - - operation ControlledAdjointSupportDistribute_DistributeAdjoint() : Unit is Ctl + Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - adjoint (...) { - let w = One; - - if (w == One) { - SubOpCA3(); - SubOpCA1(); - } - } - - controlled adjoint distribute; - } - - operation ControlledAdjointSupportDistribute_DistributeControlled() : Unit is Ctl + Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - controlled (ctl, ...) { - let w = One; - - if (w == One) { - SubOpCA3(); - SubOpCA1(); - } - } - - controlled adjoint distribute; - } - - operation ControlledAdjointSupportDistribute_DistributeAll() : Unit is Ctl + Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - controlled (ctl, ...) { - let w = One; - - if (w == One) { - SubOpCA3(); - SubOpCA1(); - } - } - - adjoint (...) { - let y = One; - - if (y == One) { - SubOpCA2(); - SubOpCA3(); - } - } - - controlled adjoint distribute; - } - - operation ControlledAdjointSupportInvert_InvertBody() : Unit is Ctl + Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - controlled adjoint invert; - } - - operation ControlledAdjointSupportInvert_InvertAdjoint() : Unit is Ctl + Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - adjoint (...) { - let w = One; - - if (w == One) { - SubOpCA3(); - SubOpCA1(); - } - } - - controlled adjoint invert; - } - - operation ControlledAdjointSupportInvert_InvertControlled() : Unit is Ctl + Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - controlled (ctl, ...) { - let w = One; - - if (w == One) { - SubOpCA3(); - SubOpCA1(); - } - } - - controlled adjoint invert; - } - - operation ControlledAdjointSupportInvert_InvertAll() : Unit is Ctl + Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - controlled (ctl, ...) { - let w = One; - - if (w == One) { - SubOpCA3(); - SubOpCA1(); - } - } - - adjoint (...) { - let y = One; - - if (y == One) { - SubOpCA2(); - SubOpCA3(); - } - } - - controlled adjoint invert; - } - - operation ControlledAdjointSupportSelf_SelfBody() : Unit is Ctl + Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - controlled adjoint self; - } - - operation ControlledAdjointSupportSelf_SelfControlled() : Unit is Ctl + Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - controlled (ctl, ...) { - let w = One; - - if (w == One) { - SubOpCA3(); - SubOpCA1(); - } - } - - controlled adjoint self; - } +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + + +namespace Microsoft.Quantum.Simulation.Testing.Honeywell.ClassicallyControlledSupportTests { + + open Microsoft.Quantum.Intrinsic; + + operation SubOp1() : Unit { } + operation SubOp2() : Unit { } + operation SubOp3() : Unit { } + + operation SubOpCA1() : Unit is Ctl + Adj { } + operation SubOpCA2() : Unit is Ctl + Adj { } + operation SubOpCA3() : Unit is Ctl + Adj { } + + operation BranchOnMeasurement() : Unit { + using (q = Qubit()) { + H(q); + let r = M(q); + if (r == Zero) { + SubOp1(); + } + Reset(q); + } + } + + operation BasicLift() : Unit { + let r = Zero; + if (r == Zero) { + SubOp1(); + SubOp2(); + SubOp3(); + let temp = 4; + using (q = Qubit()) { + let temp2 = q; + } + } + } + + operation LiftLoops() : Unit { + let r = Zero; + if (r == Zero) { + for (index in 0 .. 3) { + let temp = index; + } + + repeat { + let success = true; + } until (success) + fixup { + let temp2 = 0; + } + } + } + + operation LiftSingleNonCall() : Unit { + let r = Zero; + if (r == Zero) { + let temp = 2; + } + } + + operation LiftSelfContainedMutable() : Unit { + let r = Zero; + if (r == Zero) { + mutable temp = 3; + set temp = 4; + } + } + + operation PartiallyResolved<'Q, 'W> (q : 'Q, w : 'W) : Unit { } + + operation ArgumentsPartiallyResolveTypeParameters() : Unit { + let r = Zero; + if (r == Zero) { + PartiallyResolved(1, 1.0); + } + } + + operation LiftFunctorApplication() : Unit { + let r = Zero; + if (r == Zero) { + Adjoint SubOpCA1(); + } + } + + operation PartialApplication(q : Int, w : Double) : Unit { } + + operation LiftPartialApplication() : Unit { + let r = Zero; + if (r == Zero) { + (PartialApplication(1, _))(1.0); + } + } + + operation LiftArrayItemCall() : Unit { + let f = [SubOp1]; + let r = Zero; + if (r == Zero) { + f[0](); + } + } + + operation LiftOneNotBoth() : Unit { + let r = Zero; + if (r == Zero) { + SubOp1(); + SubOp2(); + } + else { + SubOp3(); + } + } + + operation ApplyIfZero_Test() : Unit { + let r = Zero; + if (r == Zero) { + SubOp1(); + } + } + + operation ApplyIfOne_Test() : Unit { + let r = Zero; + if (r == One) { + SubOp1(); + } + } + + operation ApplyIfZeroElseOne() : Unit { + let r = Zero; + if (r == Zero) { + SubOp1(); + } else { + SubOp2(); + } + } + + operation ApplyIfOneElseZero() : Unit { + let r = Zero; + if (r == One) { + SubOp1(); + } else { + SubOp2(); + } + } + + operation IfElif() : Unit { + let r = Zero; + + if (r == Zero) { + SubOp1(); + } elif (r == One) { + SubOp2(); + } else { + SubOp3(); + } + } + + operation AndCondition() : Unit { + let r = Zero; + if (r == Zero and r == One) { + SubOp1(); + } else { + SubOp2(); + } + } + + operation OrCondition() : Unit { + let r = Zero; + if (r == Zero or r == One) { + SubOp1(); + } else { + SubOp2(); + } + } + + operation ApplyConditionally() : Unit { + let r1 = Zero; + let r2 = Zero; + if (r1 == r2) { + SubOp1(); + } + else { + SubOp2(); + } + } + + operation ApplyConditionallyWithNoOp() : Unit { + let r1 = Zero; + let r2 = Zero; + if (r1 == r2) { + SubOp1(); + } + } + + operation InequalityWithApplyConditionally() : Unit { + let r1 = Zero; + let r2 = Zero; + if (r1 != r2) { + SubOp1(); + } + else { + SubOp2(); + } + } + + operation InequalityWithApplyIfOneElseZero() : Unit { + let r = Zero; + if (r != Zero) { + SubOp1(); + } + else { + SubOp2(); + } + } + + operation InequalityWithApplyIfZeroElseOne() : Unit { + let r = Zero; + if (r != One) { + SubOp1(); + } + else { + SubOp2(); + } + } + + operation InequalityWithApplyIfOne() : Unit { + let r = Zero; + if (r != Zero) { + SubOp1(); + } + } + + operation InequalityWithApplyIfZero() : Unit { + let r = Zero; + if (r != One) { + SubOp1(); + } + } + + operation LiteralOnTheLeft() : Unit { + let r = Zero; + if (Zero == r) { + SubOp1(); + } + } + + operation GenericsSupport<'A, 'B, 'C>() : Unit { + let r = Zero; + + if (r == Zero) { + SubOp1(); + SubOp2(); + } + } + + operation WithinBlockSupport() : Unit { + let r = One; + within { + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } apply { + if (r == One) { + SubOpCA2(); + SubOpCA3(); + } + } + } + + operation AdjointSupportProvided() : Unit is Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + adjoint (...) { + let w = One; + + if (w == One) { + SubOpCA2(); + SubOpCA3(); + } + } + } + + operation AdjointSupportSelf() : Unit is Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + adjoint self; + } + + operation AdjointSupportInvert() : Unit is Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + adjoint invert; + } + + operation ControlledSupportProvided() : Unit is Ctl { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + controlled (ctl, ...) { + let w = One; + + if (w == One) { + SubOpCA2(); + SubOpCA3(); + } + } + } + + operation ControlledSupportDistribute() : Unit is Ctl { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + controlled distribute; + } + + operation ControlledAdjointSupportProvided_ProvidedBody() : Unit is Ctl + Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + controlled adjoint (ctl, ...) { + let y = One; + + if (y == One) { + SubOpCA2(); + SubOpCA3(); + } + } + } + + operation ControlledAdjointSupportProvided_ProvidedAdjoint() : Unit is Ctl + Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + adjoint (...) { + let w = One; + + if (w == One) { + SubOpCA3(); + SubOpCA1(); + } + } + + controlled adjoint (ctl, ...) { + let y = One; + + if (y == One) { + SubOpCA2(); + SubOpCA3(); + } + } + } + + operation ControlledAdjointSupportProvided_ProvidedControlled() : Unit is Ctl + Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + controlled (ctl, ...) { + let w = One; + + if (w == One) { + SubOpCA3(); + SubOpCA1(); + } + } + + controlled adjoint (ctl, ...) { + let y = One; + + if (y == One) { + SubOpCA2(); + SubOpCA3(); + } + } + } + + operation ControlledAdjointSupportProvided_ProvidedAll() : Unit is Ctl + Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + controlled (ctl, ...) { + let w = One; + + if (w == One) { + SubOpCA3(); + SubOpCA1(); + } + } + + adjoint (...) { + let y = One; + + if (y == One) { + SubOpCA2(); + SubOpCA3(); + } + } + + controlled adjoint (ctl, ...) { + let b = One; + + if (b == One) { + let temp1 = 0; + let temp2 = 0; + SubOpCA3(); + } + } + } + + operation ControlledAdjointSupportDistribute_DistributeBody() : Unit is Ctl + Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + controlled adjoint distribute; + } + + operation ControlledAdjointSupportDistribute_DistributeAdjoint() : Unit is Ctl + Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + adjoint (...) { + let w = One; + + if (w == One) { + SubOpCA3(); + SubOpCA1(); + } + } + + controlled adjoint distribute; + } + + operation ControlledAdjointSupportDistribute_DistributeControlled() : Unit is Ctl + Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + controlled (ctl, ...) { + let w = One; + + if (w == One) { + SubOpCA3(); + SubOpCA1(); + } + } + + controlled adjoint distribute; + } + + operation ControlledAdjointSupportDistribute_DistributeAll() : Unit is Ctl + Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + controlled (ctl, ...) { + let w = One; + + if (w == One) { + SubOpCA3(); + SubOpCA1(); + } + } + + adjoint (...) { + let y = One; + + if (y == One) { + SubOpCA2(); + SubOpCA3(); + } + } + + controlled adjoint distribute; + } + + operation ControlledAdjointSupportInvert_InvertBody() : Unit is Ctl + Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + controlled adjoint invert; + } + + operation ControlledAdjointSupportInvert_InvertAdjoint() : Unit is Ctl + Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + adjoint (...) { + let w = One; + + if (w == One) { + SubOpCA3(); + SubOpCA1(); + } + } + + controlled adjoint invert; + } + + operation ControlledAdjointSupportInvert_InvertControlled() : Unit is Ctl + Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + controlled (ctl, ...) { + let w = One; + + if (w == One) { + SubOpCA3(); + SubOpCA1(); + } + } + + controlled adjoint invert; + } + + operation ControlledAdjointSupportInvert_InvertAll() : Unit is Ctl + Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + controlled (ctl, ...) { + let w = One; + + if (w == One) { + SubOpCA3(); + SubOpCA1(); + } + } + + adjoint (...) { + let y = One; + + if (y == One) { + SubOpCA2(); + SubOpCA3(); + } + } + + controlled adjoint invert; + } + + operation ControlledAdjointSupportSelf_SelfBody() : Unit is Ctl + Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + controlled adjoint self; + } + + operation ControlledAdjointSupportSelf_SelfControlled() : Unit is Ctl + Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + controlled (ctl, ...) { + let w = One; + + if (w == One) { + SubOpCA3(); + SubOpCA1(); + } + } + + controlled adjoint self; + } } \ No newline at end of file diff --git a/src/Simulation/Simulators.Tests/TestProjects/HoneywellExe/MeasurementSupportTests.qs b/src/Simulation/Simulators.Tests/TestProjects/HoneywellExe/MeasurementSupportTests.qs index 9fb25f7d64c..38aa57ee876 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/HoneywellExe/MeasurementSupportTests.qs +++ b/src/Simulation/Simulators.Tests/TestProjects/HoneywellExe/MeasurementSupportTests.qs @@ -1,30 +1,30 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - - -namespace Microsoft.Quantum.Simulation.Testing.Honeywell.MeasurementSupportTests { - - open Microsoft.Quantum.Intrinsic; - - operation MeasureInMiddle() : Unit { - using (qs = Qubit[2]) { - H(qs[0]); - let r1 = M(qs[0]); - H(qs[1]); - let r2 = M(qs[1]); - Reset(qs[0]); - Reset(qs[1]); - } - } - - operation QubitAfterMeasurement() : Unit { - using (q = Qubit()) { - H(q); - let r1 = M(q); - H(q); - let r2 = M(q); - Reset(q); - } - } - +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + + +namespace Microsoft.Quantum.Simulation.Testing.Honeywell.MeasurementSupportTests { + + open Microsoft.Quantum.Intrinsic; + + operation MeasureInMiddle() : Unit { + using (qs = Qubit[2]) { + H(qs[0]); + let r1 = M(qs[0]); + H(qs[1]); + let r2 = M(qs[1]); + Reset(qs[0]); + Reset(qs[1]); + } + } + + operation QubitAfterMeasurement() : Unit { + using (q = Qubit()) { + H(q); + let r1 = M(q); + H(q); + let r2 = M(q); + Reset(q); + } + } + } \ No newline at end of file diff --git a/src/Simulation/Simulators.Tests/TestProjects/IonQExe/MeasurementSupportTests.qs b/src/Simulation/Simulators.Tests/TestProjects/IonQExe/MeasurementSupportTests.qs index 7abecd8ec95..f6aa40b1a84 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/IonQExe/MeasurementSupportTests.qs +++ b/src/Simulation/Simulators.Tests/TestProjects/IonQExe/MeasurementSupportTests.qs @@ -1,30 +1,30 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - - -namespace Microsoft.Quantum.Simulation.Testing.IonQ.MeasurementSupportTests { - - open Microsoft.Quantum.Intrinsic; - - operation MeasureInMiddle() : Unit { - using (qs = Qubit[2]) { - H(qs[0]); - let r1 = M(qs[0]); - H(qs[1]); - let r2 = M(qs[1]); - Reset(qs[0]); - Reset(qs[1]); - } - } - - operation QubitAfterMeasurement() : Unit { - using (q = Qubit()) { - H(q); - let r1 = M(q); - H(q); - let r2 = M(q); - Reset(q); - } - } - +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + + +namespace Microsoft.Quantum.Simulation.Testing.IonQ.MeasurementSupportTests { + + open Microsoft.Quantum.Intrinsic; + + operation MeasureInMiddle() : Unit { + using (qs = Qubit[2]) { + H(qs[0]); + let r1 = M(qs[0]); + H(qs[1]); + let r2 = M(qs[1]); + Reset(qs[0]); + Reset(qs[1]); + } + } + + operation QubitAfterMeasurement() : Unit { + using (q = Qubit()) { + H(q); + let r1 = M(q); + H(q); + let r2 = M(q); + Reset(q); + } + } + } \ No newline at end of file diff --git a/src/Simulation/Simulators.Tests/TestProjects/QCIExe/ClassicallyControlledSupportTests.qs b/src/Simulation/Simulators.Tests/TestProjects/QCIExe/ClassicallyControlledSupportTests.qs index f6e0979ebf8..26a4213a328 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/QCIExe/ClassicallyControlledSupportTests.qs +++ b/src/Simulation/Simulators.Tests/TestProjects/QCIExe/ClassicallyControlledSupportTests.qs @@ -1,680 +1,679 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - - -namespace Microsoft.Quantum.Simulation.Testing.QCI.ClassicallyControlledSupportTests { - - open Microsoft.Quantum.Intrinsic; - - operation SubOp1() : Unit { } - operation SubOp2() : Unit { } - operation SubOp3() : Unit { } - - operation SubOpCA1() : Unit is Ctl + Adj { } - operation SubOpCA2() : Unit is Ctl + Adj { } - operation SubOpCA3() : Unit is Ctl + Adj { } - - operation BranchOnMeasurement() : Unit { - using (q = Qubit()) { - H(q); - let r = M(q); - if (r == Zero) { - SubOp1(); - } - Reset(q); - } - } - - operation BasicLift() : Unit { - let r = Zero; - if (r == Zero) { - SubOp1(); - SubOp2(); - SubOp3(); - let temp = 4; - using (q = Qubit()) { - let temp2 = q; - } - } - } - - operation LiftLoops() : Unit { - let r = Zero; - if (r == Zero) { - for (index in 0 .. 3) { - let temp = index; - } - - repeat { - let success = true; - } until (success) - fixup { - let temp2 = 0; - } - } - } - - operation LiftSingleNonCall() : Unit { - let r = Zero; - if (r == Zero) { - let temp = 2; - } - } - - operation LiftSelfContainedMutable() : Unit { - let r = Zero; - if (r == Zero) { - mutable temp = 3; - set temp = 4; - } - } - - operation PartiallyResolved<'Q, 'W> (q : 'Q, w : 'W) : Unit { } - - operation ArgumentsPartiallyResolveTypeParameters() : Unit { - let r = Zero; - if (r == Zero) { - PartiallyResolved(1, 1.0); - } - } - - operation LiftFunctorApplication() : Unit { - let r = Zero; - if (r == Zero) { - Adjoint SubOpCA1(); - } - } - - operation PartialApplication(q : Int, w : Double) : Unit { } - - operation LiftPartialApplication() : Unit { - let r = Zero; - if (r == Zero) { - (PartialApplication(1, _))(1.0); - } - } - - operation LiftArrayItemCall() : Unit { - let f = [SubOp1]; - let r = Zero; - if (r == Zero) { - f[0](); - } - } - - operation LiftOneNotBoth() : Unit { - let r = Zero; - if (r == Zero) { - SubOp1(); - SubOp2(); - } - else { - SubOp3(); - } - } - - operation ApplyIfZero_Test() : Unit { - let r = Zero; - if (r == Zero) { - SubOp1(); - } - } - - operation ApplyIfOne_Test() : Unit { - let r = Zero; - if (r == One) { - SubOp1(); - } - } - - operation ApplyIfZeroElseOne() : Unit { - let r = Zero; - if (r == Zero) { - SubOp1(); - } else { - SubOp2(); - } - } - - operation ApplyIfOneElseZero() : Unit { - let r = Zero; - if (r == One) { - SubOp1(); - } else { - SubOp2(); - } - } - - operation IfElif() : Unit { - let r = Zero; - - if (r == Zero) { - SubOp1(); - } elif (r == One) { - SubOp2(); - } else { - SubOp3(); - } - } - - operation AndCondition() : Unit { - let r = Zero; - if (r == Zero and r == One) { - SubOp1(); - } else { - SubOp2(); - } - } - - operation OrCondition() : Unit { - let r = Zero; - if (r == Zero or r == One) { - SubOp1(); - } else { - SubOp2(); - } - } - - operation ApplyConditionally() : Unit { - let r1 = Zero; - let r2 = Zero; - if (r1 == r2) { - SubOp1(); - } - else { - SubOp2(); - } - } - - operation ApplyConditionallyWithNoOp() : Unit { - let r1 = Zero; - let r2 = Zero; - if (r1 == r2) { - SubOp1(); - } - } - - operation InequalityWithApplyConditionally() : Unit { - let r1 = Zero; - let r2 = Zero; - if (r1 != r2) { - SubOp1(); - } - else { - SubOp2(); - } - } - - operation InequalityWithApplyIfOneElseZero() : Unit { - let r = Zero; - if (r != Zero) { - SubOp1(); - } - else { - SubOp2(); - } - } - - operation InequalityWithApplyIfZeroElseOne() : Unit { - let r = Zero; - if (r != One) { - SubOp1(); - } - else { - SubOp2(); - } - } - - operation InequalityWithApplyIfOne() : Unit { - let r = Zero; - if (r != Zero) { - SubOp1(); - } - } - - operation InequalityWithApplyIfZero() : Unit { - let r = Zero; - if (r != One) { - SubOp1(); - } - } - - operation LiteralOnTheLeft() : Unit { - let r = Zero; - if (Zero == r) { - SubOp1(); - } - } - - // ToDo: Uncomment once #17245 is fixed. - //operation GenericsSupport<'A, 'B, 'C>() : Unit { - // let r = Zero; - // - // if (r == Zero) { - // SubOp1(); - // SubOp2(); - // } - //} - - operation WithinBlockSupport() : Unit { - let r = One; - within { - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } apply { - if (r == One) { - SubOpCA2(); - SubOpCA3(); - } - } - } - - operation AdjointSupportProvided() : Unit is Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - adjoint (...) { - let w = One; - - if (w == One) { - SubOpCA2(); - SubOpCA3(); - } - } - } - - operation AdjointSupportSelf() : Unit is Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - adjoint self; - } - - operation AdjointSupportInvert() : Unit is Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - adjoint invert; - } - - operation ControlledSupportProvided() : Unit is Ctl { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - controlled (ctl, ...) { - let w = One; - - if (w == One) { - SubOpCA2(); - SubOpCA3(); - } - } - } - - operation ControlledSupportDistribute() : Unit is Ctl { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - controlled distribute; - } - - operation ControlledAdjointSupportProvided_ProvidedBody() : Unit is Ctl + Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - controlled adjoint (ctl, ...) { - let y = One; - - if (y == One) { - SubOpCA2(); - SubOpCA3(); - } - } - } - - operation ControlledAdjointSupportProvided_ProvidedAdjoint() : Unit is Ctl + Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - adjoint (...) { - let w = One; - - if (w == One) { - SubOpCA3(); - SubOpCA1(); - } - } - - controlled adjoint (ctl, ...) { - let y = One; - - if (y == One) { - SubOpCA2(); - SubOpCA3(); - } - } - } - - operation ControlledAdjointSupportProvided_ProvidedControlled() : Unit is Ctl + Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - controlled (ctl, ...) { - let w = One; - - if (w == One) { - SubOpCA3(); - SubOpCA1(); - } - } - - controlled adjoint (ctl, ...) { - let y = One; - - if (y == One) { - SubOpCA2(); - SubOpCA3(); - } - } - } - - operation ControlledAdjointSupportProvided_ProvidedAll() : Unit is Ctl + Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - controlled (ctl, ...) { - let w = One; - - if (w == One) { - SubOpCA3(); - SubOpCA1(); - } - } - - adjoint (...) { - let y = One; - - if (y == One) { - SubOpCA2(); - SubOpCA3(); - } - } - - controlled adjoint (ctl, ...) { - let b = One; - - if (b == One) { - let temp1 = 0; - let temp2 = 0; - SubOpCA3(); - } - } - } - - operation ControlledAdjointSupportDistribute_DistributeBody() : Unit is Ctl + Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - controlled adjoint distribute; - } - - operation ControlledAdjointSupportDistribute_DistributeAdjoint() : Unit is Ctl + Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - adjoint (...) { - let w = One; - - if (w == One) { - SubOpCA3(); - SubOpCA1(); - } - } - - controlled adjoint distribute; - } - - operation ControlledAdjointSupportDistribute_DistributeControlled() : Unit is Ctl + Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - controlled (ctl, ...) { - let w = One; - - if (w == One) { - SubOpCA3(); - SubOpCA1(); - } - } - - controlled adjoint distribute; - } - - operation ControlledAdjointSupportDistribute_DistributeAll() : Unit is Ctl + Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - controlled (ctl, ...) { - let w = One; - - if (w == One) { - SubOpCA3(); - SubOpCA1(); - } - } - - adjoint (...) { - let y = One; - - if (y == One) { - SubOpCA2(); - SubOpCA3(); - } - } - - controlled adjoint distribute; - } - - operation ControlledAdjointSupportInvert_InvertBody() : Unit is Ctl + Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - controlled adjoint invert; - } - - operation ControlledAdjointSupportInvert_InvertAdjoint() : Unit is Ctl + Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - adjoint (...) { - let w = One; - - if (w == One) { - SubOpCA3(); - SubOpCA1(); - } - } - - controlled adjoint invert; - } - - operation ControlledAdjointSupportInvert_InvertControlled() : Unit is Ctl + Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - controlled (ctl, ...) { - let w = One; - - if (w == One) { - SubOpCA3(); - SubOpCA1(); - } - } - - controlled adjoint invert; - } - - operation ControlledAdjointSupportInvert_InvertAll() : Unit is Ctl + Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - controlled (ctl, ...) { - let w = One; - - if (w == One) { - SubOpCA3(); - SubOpCA1(); - } - } - - adjoint (...) { - let y = One; - - if (y == One) { - SubOpCA2(); - SubOpCA3(); - } - } - - controlled adjoint invert; - } - - operation ControlledAdjointSupportSelf_SelfBody() : Unit is Ctl + Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - controlled adjoint self; - } - - operation ControlledAdjointSupportSelf_SelfControlled() : Unit is Ctl + Adj { - body (...) { - let r = Zero; - - if (r == Zero) { - SubOpCA1(); - SubOpCA2(); - } - } - - controlled (ctl, ...) { - let w = One; - - if (w == One) { - SubOpCA3(); - SubOpCA1(); - } - } - - controlled adjoint self; - } +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + + +namespace Microsoft.Quantum.Simulation.Testing.QCI.ClassicallyControlledSupportTests { + + open Microsoft.Quantum.Intrinsic; + + operation SubOp1() : Unit { } + operation SubOp2() : Unit { } + operation SubOp3() : Unit { } + + operation SubOpCA1() : Unit is Ctl + Adj { } + operation SubOpCA2() : Unit is Ctl + Adj { } + operation SubOpCA3() : Unit is Ctl + Adj { } + + operation BranchOnMeasurement() : Unit { + using (q = Qubit()) { + H(q); + let r = M(q); + if (r == Zero) { + SubOp1(); + } + Reset(q); + } + } + + operation BasicLift() : Unit { + let r = Zero; + if (r == Zero) { + SubOp1(); + SubOp2(); + SubOp3(); + let temp = 4; + using (q = Qubit()) { + let temp2 = q; + } + } + } + + operation LiftLoops() : Unit { + let r = Zero; + if (r == Zero) { + for (index in 0 .. 3) { + let temp = index; + } + + repeat { + let success = true; + } until (success) + fixup { + let temp2 = 0; + } + } + } + + operation LiftSingleNonCall() : Unit { + let r = Zero; + if (r == Zero) { + let temp = 2; + } + } + + operation LiftSelfContainedMutable() : Unit { + let r = Zero; + if (r == Zero) { + mutable temp = 3; + set temp = 4; + } + } + + operation PartiallyResolved<'Q, 'W> (q : 'Q, w : 'W) : Unit { } + + operation ArgumentsPartiallyResolveTypeParameters() : Unit { + let r = Zero; + if (r == Zero) { + PartiallyResolved(1, 1.0); + } + } + + operation LiftFunctorApplication() : Unit { + let r = Zero; + if (r == Zero) { + Adjoint SubOpCA1(); + } + } + + operation PartialApplication(q : Int, w : Double) : Unit { } + + operation LiftPartialApplication() : Unit { + let r = Zero; + if (r == Zero) { + (PartialApplication(1, _))(1.0); + } + } + + operation LiftArrayItemCall() : Unit { + let f = [SubOp1]; + let r = Zero; + if (r == Zero) { + f[0](); + } + } + + operation LiftOneNotBoth() : Unit { + let r = Zero; + if (r == Zero) { + SubOp1(); + SubOp2(); + } + else { + SubOp3(); + } + } + + operation ApplyIfZero_Test() : Unit { + let r = Zero; + if (r == Zero) { + SubOp1(); + } + } + + operation ApplyIfOne_Test() : Unit { + let r = Zero; + if (r == One) { + SubOp1(); + } + } + + operation ApplyIfZeroElseOne() : Unit { + let r = Zero; + if (r == Zero) { + SubOp1(); + } else { + SubOp2(); + } + } + + operation ApplyIfOneElseZero() : Unit { + let r = Zero; + if (r == One) { + SubOp1(); + } else { + SubOp2(); + } + } + + operation IfElif() : Unit { + let r = Zero; + + if (r == Zero) { + SubOp1(); + } elif (r == One) { + SubOp2(); + } else { + SubOp3(); + } + } + + operation AndCondition() : Unit { + let r = Zero; + if (r == Zero and r == One) { + SubOp1(); + } else { + SubOp2(); + } + } + + operation OrCondition() : Unit { + let r = Zero; + if (r == Zero or r == One) { + SubOp1(); + } else { + SubOp2(); + } + } + + operation ApplyConditionally() : Unit { + let r1 = Zero; + let r2 = Zero; + if (r1 == r2) { + SubOp1(); + } + else { + SubOp2(); + } + } + + operation ApplyConditionallyWithNoOp() : Unit { + let r1 = Zero; + let r2 = Zero; + if (r1 == r2) { + SubOp1(); + } + } + + operation InequalityWithApplyConditionally() : Unit { + let r1 = Zero; + let r2 = Zero; + if (r1 != r2) { + SubOp1(); + } + else { + SubOp2(); + } + } + + operation InequalityWithApplyIfOneElseZero() : Unit { + let r = Zero; + if (r != Zero) { + SubOp1(); + } + else { + SubOp2(); + } + } + + operation InequalityWithApplyIfZeroElseOne() : Unit { + let r = Zero; + if (r != One) { + SubOp1(); + } + else { + SubOp2(); + } + } + + operation InequalityWithApplyIfOne() : Unit { + let r = Zero; + if (r != Zero) { + SubOp1(); + } + } + + operation InequalityWithApplyIfZero() : Unit { + let r = Zero; + if (r != One) { + SubOp1(); + } + } + + operation LiteralOnTheLeft() : Unit { + let r = Zero; + if (Zero == r) { + SubOp1(); + } + } + + operation GenericsSupport<'A, 'B, 'C>() : Unit { + let r = Zero; + + if (r == Zero) { + SubOp1(); + SubOp2(); + } + } + + operation WithinBlockSupport() : Unit { + let r = One; + within { + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } apply { + if (r == One) { + SubOpCA2(); + SubOpCA3(); + } + } + } + + operation AdjointSupportProvided() : Unit is Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + adjoint (...) { + let w = One; + + if (w == One) { + SubOpCA2(); + SubOpCA3(); + } + } + } + + operation AdjointSupportSelf() : Unit is Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + adjoint self; + } + + operation AdjointSupportInvert() : Unit is Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + adjoint invert; + } + + operation ControlledSupportProvided() : Unit is Ctl { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + controlled (ctl, ...) { + let w = One; + + if (w == One) { + SubOpCA2(); + SubOpCA3(); + } + } + } + + operation ControlledSupportDistribute() : Unit is Ctl { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + controlled distribute; + } + + operation ControlledAdjointSupportProvided_ProvidedBody() : Unit is Ctl + Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + controlled adjoint (ctl, ...) { + let y = One; + + if (y == One) { + SubOpCA2(); + SubOpCA3(); + } + } + } + + operation ControlledAdjointSupportProvided_ProvidedAdjoint() : Unit is Ctl + Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + adjoint (...) { + let w = One; + + if (w == One) { + SubOpCA3(); + SubOpCA1(); + } + } + + controlled adjoint (ctl, ...) { + let y = One; + + if (y == One) { + SubOpCA2(); + SubOpCA3(); + } + } + } + + operation ControlledAdjointSupportProvided_ProvidedControlled() : Unit is Ctl + Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + controlled (ctl, ...) { + let w = One; + + if (w == One) { + SubOpCA3(); + SubOpCA1(); + } + } + + controlled adjoint (ctl, ...) { + let y = One; + + if (y == One) { + SubOpCA2(); + SubOpCA3(); + } + } + } + + operation ControlledAdjointSupportProvided_ProvidedAll() : Unit is Ctl + Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + controlled (ctl, ...) { + let w = One; + + if (w == One) { + SubOpCA3(); + SubOpCA1(); + } + } + + adjoint (...) { + let y = One; + + if (y == One) { + SubOpCA2(); + SubOpCA3(); + } + } + + controlled adjoint (ctl, ...) { + let b = One; + + if (b == One) { + let temp1 = 0; + let temp2 = 0; + SubOpCA3(); + } + } + } + + operation ControlledAdjointSupportDistribute_DistributeBody() : Unit is Ctl + Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + controlled adjoint distribute; + } + + operation ControlledAdjointSupportDistribute_DistributeAdjoint() : Unit is Ctl + Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + adjoint (...) { + let w = One; + + if (w == One) { + SubOpCA3(); + SubOpCA1(); + } + } + + controlled adjoint distribute; + } + + operation ControlledAdjointSupportDistribute_DistributeControlled() : Unit is Ctl + Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + controlled (ctl, ...) { + let w = One; + + if (w == One) { + SubOpCA3(); + SubOpCA1(); + } + } + + controlled adjoint distribute; + } + + operation ControlledAdjointSupportDistribute_DistributeAll() : Unit is Ctl + Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + controlled (ctl, ...) { + let w = One; + + if (w == One) { + SubOpCA3(); + SubOpCA1(); + } + } + + adjoint (...) { + let y = One; + + if (y == One) { + SubOpCA2(); + SubOpCA3(); + } + } + + controlled adjoint distribute; + } + + operation ControlledAdjointSupportInvert_InvertBody() : Unit is Ctl + Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + controlled adjoint invert; + } + + operation ControlledAdjointSupportInvert_InvertAdjoint() : Unit is Ctl + Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + adjoint (...) { + let w = One; + + if (w == One) { + SubOpCA3(); + SubOpCA1(); + } + } + + controlled adjoint invert; + } + + operation ControlledAdjointSupportInvert_InvertControlled() : Unit is Ctl + Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + controlled (ctl, ...) { + let w = One; + + if (w == One) { + SubOpCA3(); + SubOpCA1(); + } + } + + controlled adjoint invert; + } + + operation ControlledAdjointSupportInvert_InvertAll() : Unit is Ctl + Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + controlled (ctl, ...) { + let w = One; + + if (w == One) { + SubOpCA3(); + SubOpCA1(); + } + } + + adjoint (...) { + let y = One; + + if (y == One) { + SubOpCA2(); + SubOpCA3(); + } + } + + controlled adjoint invert; + } + + operation ControlledAdjointSupportSelf_SelfBody() : Unit is Ctl + Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + controlled adjoint self; + } + + operation ControlledAdjointSupportSelf_SelfControlled() : Unit is Ctl + Adj { + body (...) { + let r = Zero; + + if (r == Zero) { + SubOpCA1(); + SubOpCA2(); + } + } + + controlled (ctl, ...) { + let w = One; + + if (w == One) { + SubOpCA3(); + SubOpCA1(); + } + } + + controlled adjoint self; + } } \ No newline at end of file diff --git a/src/Simulation/Simulators.Tests/TestProjects/QCIExe/MeasurementSupportTests.qs b/src/Simulation/Simulators.Tests/TestProjects/QCIExe/MeasurementSupportTests.qs index 8082db9100b..62b81376407 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/QCIExe/MeasurementSupportTests.qs +++ b/src/Simulation/Simulators.Tests/TestProjects/QCIExe/MeasurementSupportTests.qs @@ -1,30 +1,30 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - - -namespace Microsoft.Quantum.Simulation.Testing.QCI.MeasurementSupportTests { - - open Microsoft.Quantum.Intrinsic; - - operation MeasureInMiddle() : Unit { - using (qs = Qubit[2]) { - H(qs[0]); - let r1 = M(qs[0]); - H(qs[1]); - let r2 = M(qs[1]); - Reset(qs[0]); - Reset(qs[1]); - } - } - - operation QubitAfterMeasurement() : Unit { - using (q = Qubit()) { - H(q); - let r1 = M(q); - H(q); - let r2 = M(q); - Reset(q); - } - } - +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + + +namespace Microsoft.Quantum.Simulation.Testing.QCI.MeasurementSupportTests { + + open Microsoft.Quantum.Intrinsic; + + operation MeasureInMiddle() : Unit { + using (qs = Qubit[2]) { + H(qs[0]); + let r1 = M(qs[0]); + H(qs[1]); + let r2 = M(qs[1]); + Reset(qs[0]); + Reset(qs[1]); + } + } + + operation QubitAfterMeasurement() : Unit { + using (q = Qubit()) { + H(q); + let r1 = M(q); + H(q); + let r2 = M(q); + Reset(q); + } + } + } \ No newline at end of file diff --git a/src/Simulation/Simulators.Tests/TestProjects/UnitTests/HoneywellSimulation.qs b/src/Simulation/Simulators.Tests/TestProjects/UnitTests/HoneywellSimulation.qs index 6082ac038ad..5325dca658a 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/UnitTests/HoneywellSimulation.qs +++ b/src/Simulation/Simulators.Tests/TestProjects/UnitTests/HoneywellSimulation.qs @@ -6,13 +6,13 @@ namespace Microsoft.Quantum.Simulation.Testing.Honeywell { open Microsoft.Quantum.Diagnostics; open Microsoft.Quantum.Simulation.Testing.Honeywell.ClassicallyControlledSupportTests; open Microsoft.Quantum.Simulation.Testing.Honeywell.MeasurementSupportTests; - + @Test("QuantumSimulator") @Test("ResourcesEstimator") operation MeasureInMiddleTest() : Unit { MeasureInMiddle(); } - + @Test("QuantumSimulator") @Test("ResourcesEstimator") operation QubitAfterMeasurementTest() : Unit { @@ -169,12 +169,11 @@ namespace Microsoft.Quantum.Simulation.Testing.Honeywell { LiteralOnTheLeft(); } - // ToDo: Uncomment once #17245 is fixed. - //@Test("QuantumSimulator") - //@Test("ResourcesEstimator") - //operation GenericsSupportTest() : Unit { - // GenericsSupport(); - //} + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation GenericsSupportTest() : Unit { + GenericsSupport(); + } @Test("QuantumSimulator") @Test("ResourcesEstimator") diff --git a/src/Simulation/Simulators.Tests/TestProjects/UnitTests/IonQSimulation.qs b/src/Simulation/Simulators.Tests/TestProjects/UnitTests/IonQSimulation.qs index c64724eb9b9..46ae721dce1 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/UnitTests/IonQSimulation.qs +++ b/src/Simulation/Simulators.Tests/TestProjects/UnitTests/IonQSimulation.qs @@ -1,20 +1,20 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - - -namespace Microsoft.Quantum.Simulation.Testing.IonQ { - open Microsoft.Quantum.Diagnostics; - open Microsoft.Quantum.Simulation.Testing.IonQ.MeasurementSupportTests; - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation MeasureInMiddleTest() : Unit { - MeasureInMiddle(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation QubitAfterMeasurementTest() : Unit { - QubitAfterMeasurement(); - } -} +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + + +namespace Microsoft.Quantum.Simulation.Testing.IonQ { + open Microsoft.Quantum.Diagnostics; + open Microsoft.Quantum.Simulation.Testing.IonQ.MeasurementSupportTests; + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation MeasureInMiddleTest() : Unit { + MeasureInMiddle(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation QubitAfterMeasurementTest() : Unit { + QubitAfterMeasurement(); + } +} diff --git a/src/Simulation/Simulators.Tests/TestProjects/UnitTests/QCISimulation.qs b/src/Simulation/Simulators.Tests/TestProjects/UnitTests/QCISimulation.qs index 5cc75f4577f..8585758f894 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/UnitTests/QCISimulation.qs +++ b/src/Simulation/Simulators.Tests/TestProjects/UnitTests/QCISimulation.qs @@ -1,299 +1,298 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - - -namespace Microsoft.Quantum.Simulation.Testing.QCI { - open Microsoft.Quantum.Diagnostics; - open Microsoft.Quantum.Simulation.Testing.QCI.ClassicallyControlledSupportTests; - open Microsoft.Quantum.Simulation.Testing.QCI.MeasurementSupportTests; - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation MeasureInMiddleTest() : Unit { - MeasureInMiddle(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation QubitAfterMeasurementTest() : Unit { - QubitAfterMeasurement(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation BranchOnMeasurementTest() : Unit { - BranchOnMeasurement(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation BasicLiftTest() : Unit { - BasicLift(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation LiftLoopsTest() : Unit { - LiftLoops(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation LiftSingleNonCallTest() : Unit { - LiftSingleNonCall(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation LiftSelfContainedMutableTest() : Unit { - LiftSelfContainedMutable(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation ArgumentsPartiallyResolveTypeParametersTest() : Unit { - ArgumentsPartiallyResolveTypeParameters(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation LiftFunctorApplicationTest() : Unit { - LiftFunctorApplication(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation LiftPartialApplicationTest() : Unit { - LiftPartialApplication(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation LiftArrayItemCallTest() : Unit { - LiftArrayItemCall(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation LiftOneNotBothTest() : Unit { - LiftOneNotBoth(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation ApplyIfZeroTest() : Unit { - ApplyIfZero_Test(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation ApplyIfOneTest() : Unit { - ApplyIfOne_Test(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation ApplyIfZeroElseOneTest() : Unit { - ApplyIfZeroElseOne(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation ApplyIfOneElseZeroTest() : Unit { - ApplyIfOneElseZero(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation IfElifTest() : Unit { - IfElif(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation AndConditionTest() : Unit { - AndCondition(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation OrConditionTest() : Unit { - OrCondition(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation ApplyConditionallyTest() : Unit { - ApplyConditionally(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation ApplyConditionallyWithNoOpTest() : Unit { - ApplyConditionallyWithNoOp(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation InequalityWithApplyConditionallyTest() : Unit { - InequalityWithApplyConditionally(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation InequalityWithApplyIfOneElseZeroTest() : Unit { - InequalityWithApplyIfOneElseZero(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation InequalityWithApplyIfZeroElseOneTest() : Unit { - InequalityWithApplyIfZeroElseOne(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation InequalityWithApplyIfOneTest() : Unit { - InequalityWithApplyIfOne(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation InequalityWithApplyIfZeroTest() : Unit { - InequalityWithApplyIfZero(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation LiteralOnTheLeftTest() : Unit { - LiteralOnTheLeft(); - } - - // ToDo: Uncomment once #17245 is fixed. - //@Test("QuantumSimulator") - //@Test("ResourcesEstimator") - //operation GenericsSupportTest() : Unit { - // GenericsSupport(); - //} - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation WithinBlockSupportTest() : Unit { - WithinBlockSupport(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation AdjointSupportProvidedTest() : Unit { - AdjointSupportProvided(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation AdjointSupportSelfTest() : Unit { - AdjointSupportSelf(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation AdjointSupportInvertTest() : Unit { - AdjointSupportInvert(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation ControlledSupportProvidedTest() : Unit { - ControlledSupportProvided(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation ControlledSupportDistributeTest() : Unit { - ControlledSupportDistribute(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation ControlledAdjointSupportProvided_ProvidedBodyTest() : Unit { - ControlledAdjointSupportProvided_ProvidedBody(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation ControlledAdjointSupportProvided_ProvidedAdjointTest() : Unit { - ControlledAdjointSupportProvided_ProvidedAdjoint(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation ControlledAdjointSupportProvided_ProvidedControlledTest() : Unit { - ControlledAdjointSupportProvided_ProvidedControlled(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation ControlledAdjointSupportProvided_ProvidedAllTest() : Unit { - ControlledAdjointSupportProvided_ProvidedAll(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation ControlledAdjointSupportDistribute_DistributeBodyTest() : Unit { - ControlledAdjointSupportDistribute_DistributeBody(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation ControlledAdjointSupportDistribute_DistributeAdjointTest() : Unit { - ControlledAdjointSupportDistribute_DistributeAdjoint(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation ControlledAdjointSupportDistribute_DistributeControlledTest() : Unit { - ControlledAdjointSupportDistribute_DistributeControlled(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation ControlledAdjointSupportDistribute_DistributeAllTest() : Unit { - ControlledAdjointSupportDistribute_DistributeAll(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation ControlledAdjointSupportInvert_InvertBodyTest() : Unit { - ControlledAdjointSupportInvert_InvertBody(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation ControlledAdjointSupportInvert_InvertAdjointTest() : Unit { - ControlledAdjointSupportInvert_InvertAdjoint(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation ControlledAdjointSupportInvert_InvertControlledTest() : Unit { - ControlledAdjointSupportInvert_InvertControlled(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation ControlledAdjointSupportInvert_InvertAllTest() : Unit { - ControlledAdjointSupportInvert_InvertAll(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation ControlledAdjointSupportSelf_SelfBodyTest() : Unit { - ControlledAdjointSupportSelf_SelfBody(); - } - - @Test("QuantumSimulator") - @Test("ResourcesEstimator") - operation ControlledAdjointSupportSelf_SelfControlledTest() : Unit { - ControlledAdjointSupportSelf_SelfControlled(); - } - -} +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + + +namespace Microsoft.Quantum.Simulation.Testing.QCI { + open Microsoft.Quantum.Diagnostics; + open Microsoft.Quantum.Simulation.Testing.QCI.ClassicallyControlledSupportTests; + open Microsoft.Quantum.Simulation.Testing.QCI.MeasurementSupportTests; + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation MeasureInMiddleTest() : Unit { + MeasureInMiddle(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation QubitAfterMeasurementTest() : Unit { + QubitAfterMeasurement(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation BranchOnMeasurementTest() : Unit { + BranchOnMeasurement(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation BasicLiftTest() : Unit { + BasicLift(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation LiftLoopsTest() : Unit { + LiftLoops(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation LiftSingleNonCallTest() : Unit { + LiftSingleNonCall(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation LiftSelfContainedMutableTest() : Unit { + LiftSelfContainedMutable(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation ArgumentsPartiallyResolveTypeParametersTest() : Unit { + ArgumentsPartiallyResolveTypeParameters(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation LiftFunctorApplicationTest() : Unit { + LiftFunctorApplication(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation LiftPartialApplicationTest() : Unit { + LiftPartialApplication(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation LiftArrayItemCallTest() : Unit { + LiftArrayItemCall(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation LiftOneNotBothTest() : Unit { + LiftOneNotBoth(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation ApplyIfZeroTest() : Unit { + ApplyIfZero_Test(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation ApplyIfOneTest() : Unit { + ApplyIfOne_Test(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation ApplyIfZeroElseOneTest() : Unit { + ApplyIfZeroElseOne(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation ApplyIfOneElseZeroTest() : Unit { + ApplyIfOneElseZero(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation IfElifTest() : Unit { + IfElif(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation AndConditionTest() : Unit { + AndCondition(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation OrConditionTest() : Unit { + OrCondition(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation ApplyConditionallyTest() : Unit { + ApplyConditionally(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation ApplyConditionallyWithNoOpTest() : Unit { + ApplyConditionallyWithNoOp(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation InequalityWithApplyConditionallyTest() : Unit { + InequalityWithApplyConditionally(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation InequalityWithApplyIfOneElseZeroTest() : Unit { + InequalityWithApplyIfOneElseZero(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation InequalityWithApplyIfZeroElseOneTest() : Unit { + InequalityWithApplyIfZeroElseOne(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation InequalityWithApplyIfOneTest() : Unit { + InequalityWithApplyIfOne(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation InequalityWithApplyIfZeroTest() : Unit { + InequalityWithApplyIfZero(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation LiteralOnTheLeftTest() : Unit { + LiteralOnTheLeft(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation GenericsSupportTest() : Unit { + GenericsSupport(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation WithinBlockSupportTest() : Unit { + WithinBlockSupport(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation AdjointSupportProvidedTest() : Unit { + AdjointSupportProvided(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation AdjointSupportSelfTest() : Unit { + AdjointSupportSelf(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation AdjointSupportInvertTest() : Unit { + AdjointSupportInvert(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation ControlledSupportProvidedTest() : Unit { + ControlledSupportProvided(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation ControlledSupportDistributeTest() : Unit { + ControlledSupportDistribute(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation ControlledAdjointSupportProvided_ProvidedBodyTest() : Unit { + ControlledAdjointSupportProvided_ProvidedBody(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation ControlledAdjointSupportProvided_ProvidedAdjointTest() : Unit { + ControlledAdjointSupportProvided_ProvidedAdjoint(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation ControlledAdjointSupportProvided_ProvidedControlledTest() : Unit { + ControlledAdjointSupportProvided_ProvidedControlled(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation ControlledAdjointSupportProvided_ProvidedAllTest() : Unit { + ControlledAdjointSupportProvided_ProvidedAll(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation ControlledAdjointSupportDistribute_DistributeBodyTest() : Unit { + ControlledAdjointSupportDistribute_DistributeBody(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation ControlledAdjointSupportDistribute_DistributeAdjointTest() : Unit { + ControlledAdjointSupportDistribute_DistributeAdjoint(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation ControlledAdjointSupportDistribute_DistributeControlledTest() : Unit { + ControlledAdjointSupportDistribute_DistributeControlled(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation ControlledAdjointSupportDistribute_DistributeAllTest() : Unit { + ControlledAdjointSupportDistribute_DistributeAll(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation ControlledAdjointSupportInvert_InvertBodyTest() : Unit { + ControlledAdjointSupportInvert_InvertBody(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation ControlledAdjointSupportInvert_InvertAdjointTest() : Unit { + ControlledAdjointSupportInvert_InvertAdjoint(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation ControlledAdjointSupportInvert_InvertControlledTest() : Unit { + ControlledAdjointSupportInvert_InvertControlled(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation ControlledAdjointSupportInvert_InvertAllTest() : Unit { + ControlledAdjointSupportInvert_InvertAll(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation ControlledAdjointSupportSelf_SelfBodyTest() : Unit { + ControlledAdjointSupportSelf_SelfBody(); + } + + @Test("QuantumSimulator") + @Test("ResourcesEstimator") + operation ControlledAdjointSupportSelf_SelfControlledTest() : Unit { + ControlledAdjointSupportSelf_SelfControlled(); + } + +}