diff --git a/compiler/qsc_codegen/src/qir_base/tests.rs b/compiler/qsc_codegen/src/qir_base/tests.rs index 00a47d219f..84c332bf3e 100644 --- a/compiler/qsc_codegen/src/qir_base/tests.rs +++ b/compiler/qsc_codegen/src/qir_base/tests.rs @@ -440,7 +440,6 @@ fn qubit_allocation_allows_reuse_of_unmeasured_qubits() { check( "", Some(indoc! {"{ - open Microsoft.Quantum.Measurement; { use (c, q) = (Qubit(), Qubit()); CNOT(c, q); MResetZ(q); } { use (c, q) = (Qubit(), Qubit()); CNOT(c, q); MResetZ(q) } }"}), @@ -604,7 +603,6 @@ fn complex_program_is_valid() { check( "", Some(indoc! {"{ - open Microsoft.Quantum.Measurement; open Microsoft.Quantum.Math; operation SWAPfromExp(q1 : Qubit, q2 : Qubit) : Unit is Ctl + Adj { @@ -911,7 +909,6 @@ fn qubit_ids_properly_reused() { namespace Test { open Microsoft.Quantum.Intrinsic; - open Microsoft.Quantum.Measurement; // Verifies the use of the CNOT quantum gate from Q#'s Microsoft.Quantum.Intrinsic namespace. // Expected simulation output: ([0, 0], [1, 1]). @@ -1011,7 +1008,6 @@ fn custom_intrinsic_on_single_qubit() { check( indoc! {" namespace Test { - open Microsoft.Quantum.Measurement; @EntryPoint() operation Test() : (Result, Result) { use (q1, q2) = (Qubit(), Qubit()); @@ -1086,7 +1082,6 @@ fn multiple_custom_intrinsic_calls() { check( indoc! {" namespace Test { - open Microsoft.Quantum.Measurement; @EntryPoint() operation Test() : (Result, Result) { use (q0, q1) = (Qubit(), Qubit()); @@ -1173,7 +1168,6 @@ fn custom_intrinsic_on_qubit_and_double() { check( indoc! {" namespace Test { - open Microsoft.Quantum.Measurement; @EntryPoint() operation Test() : Result { use q = Qubit(); @@ -1244,7 +1238,6 @@ fn custom_intrinsic_on_qubit_and_bool() { check( indoc! {" namespace Test { - open Microsoft.Quantum.Measurement; @EntryPoint() operation Test() : Result { use q = Qubit(); @@ -1315,7 +1308,6 @@ fn custom_intrinsic_on_qubit_and_int() { check( indoc! {" namespace Test { - open Microsoft.Quantum.Measurement; @EntryPoint() operation Test() : Result { use q = Qubit(); @@ -1386,7 +1378,6 @@ fn custom_intrinsic_fail_on_result_arg() { check( indoc! {" namespace Test { - open Microsoft.Quantum.Measurement; @EntryPoint() operation Test() : Result { use q = Qubit(); @@ -1410,8 +1401,8 @@ fn custom_intrinsic_fail_on_result_arg() { 2, ), span: Span { - lo: 217, - hi: 301, + lo: 177, + hi: 261, }, }, ) @@ -1424,7 +1415,6 @@ fn custom_intrinsic_fail_on_bigint_arg() { check( indoc! {" namespace Test { - open Microsoft.Quantum.Measurement; @EntryPoint() operation Test() : Result { use q = Qubit(); @@ -1448,8 +1438,8 @@ fn custom_intrinsic_fail_on_bigint_arg() { 2, ), span: Span { - lo: 219, - hi: 303, + lo: 179, + hi: 263, }, }, ) @@ -1462,7 +1452,6 @@ fn custom_intrinsic_fail_on_string_arg() { check( indoc! {r#" namespace Test { - open Microsoft.Quantum.Measurement; @EntryPoint() operation Test() : Result { use q = Qubit(); @@ -1486,8 +1475,8 @@ fn custom_intrinsic_fail_on_string_arg() { 2, ), span: Span { - lo: 230, - hi: 314, + lo: 190, + hi: 274, }, }, ) @@ -1500,7 +1489,6 @@ fn custom_intrinsic_fail_on_array_arg() { check( indoc! {" namespace Test { - open Microsoft.Quantum.Measurement; @EntryPoint() operation Test() : Result { use q = Qubit(); @@ -1524,8 +1512,8 @@ fn custom_intrinsic_fail_on_array_arg() { 2, ), span: Span { - lo: 225, - hi: 308, + lo: 185, + hi: 268, }, }, ) @@ -1538,7 +1526,6 @@ fn custom_intrinsic_fail_on_tuple_arg() { check( indoc! {" namespace Test { - open Microsoft.Quantum.Measurement; @EntryPoint() operation Test() : Result { use q = Qubit(); @@ -1562,8 +1549,8 @@ fn custom_intrinsic_fail_on_tuple_arg() { 2, ), span: Span { - lo: 225, - hi: 318, + lo: 185, + hi: 278, }, }, ) @@ -1576,7 +1563,6 @@ fn custom_intrinsic_fail_on_non_unit_return() { check( indoc! {" namespace Test { - open Microsoft.Quantum.Measurement; @EntryPoint() operation Test() : Result { use q = Qubit(); @@ -1598,8 +1584,8 @@ fn custom_intrinsic_fail_on_non_unit_return() { 2, ), span: Span { - lo: 195, - hi: 265, + lo: 155, + hi: 225, }, }, ) diff --git a/compiler/qsc_eval/src/tests.rs b/compiler/qsc_eval/src/tests.rs index 9e35ebf5e8..17fcf1a4cd 100644 --- a/compiler/qsc_eval/src/tests.rs +++ b/compiler/qsc_eval/src/tests.rs @@ -3410,8 +3410,6 @@ fn lambda_operation_empty_closure() { check_expr( " namespace A { - open Microsoft.Quantum.Measurement; - operation Foo(op : Qubit => ()) : Result { use q = Qubit(); op(q); @@ -3431,7 +3429,6 @@ fn lambda_operation_closure() { check_expr( " namespace A { - open Microsoft.Quantum.Measurement; operation Foo(op : () => Result) : Result { op() } operation Bar() : Result { use q = Qubit(); @@ -3450,7 +3447,6 @@ fn lambda_operation_controlled() { check_expr( " namespace A { - open Microsoft.Quantum.Measurement; operation Foo(op : Qubit => Unit is Adj + Ctl, q : Qubit) : Unit is Adj + Ctl { op(q) } operation Bar() : Result[] { mutable output = []; @@ -3478,7 +3474,6 @@ fn lambda_operation_controlled_controlled() { check_expr( " namespace A { - open Microsoft.Quantum.Measurement; operation Foo(op : Qubit => Unit is Adj + Ctl, q : Qubit) : Unit is Adj + Ctl { op(q) } operation Bar() : Result[] { mutable output = []; diff --git a/compiler/qsc_frontend/src/resolve.rs b/compiler/qsc_frontend/src/resolve.rs index fd3ba3911e..98cd5249df 100644 --- a/compiler/qsc_frontend/src/resolve.rs +++ b/compiler/qsc_frontend/src/resolve.rs @@ -26,6 +26,7 @@ const PRELUDE: &[&str] = &[ "Microsoft.Quantum.Canon", "Microsoft.Quantum.Core", "Microsoft.Quantum.Intrinsic", + "Microsoft.Quantum.Measurement", ]; // All AST Path nodes get mapped diff --git a/library/src/tests/arithmetic.rs b/library/src/tests/arithmetic.rs index f25209b753..c93c34109a 100644 --- a/library/src/tests/arithmetic.rs +++ b/library/src/tests/arithmetic.rs @@ -11,7 +11,6 @@ fn check_maj() { test_expression( { "{ - open Microsoft.Quantum.Measurement; open Microsoft.Quantum.Unstable.Arithmetic; use q = Qubit[3]; mutable r = []; @@ -107,7 +106,6 @@ fn check_inc_by_le_general() { test_expression( { "{ // General cases for IncByLE - open Microsoft.Quantum.Measurement; open Microsoft.Quantum.Unstable.Arithmetic; use x1 = Qubit[10]; use y1 = Qubit[10]; @@ -173,7 +171,6 @@ fn check_ripple_carry_ttk_inc_by_le_general() { test_expression( { "{ // General cases for RippleCarryTTKIncByLE - open Microsoft.Quantum.Measurement; open Microsoft.Quantum.Unstable.Arithmetic; use x1 = Qubit[10]; @@ -279,7 +276,6 @@ fn check_ripple_carry_cg_inc_by_le_general() { test_expression( { "{ // General cases for RippleCarryCGIncByLE - open Microsoft.Quantum.Measurement; open Microsoft.Quantum.Unstable.Arithmetic; use x1 = Qubit[10]; @@ -436,7 +432,6 @@ fn check_inc_by_le_using_add_le_general() { test_expression( { "{ // General cases for IncByLEUsingAddLE - open Microsoft.Quantum.Measurement; open Microsoft.Quantum.Unstable.Arithmetic; use x1 = Qubit[10]; @@ -463,7 +458,6 @@ fn check_inc_by_i_general() { test_expression( { "{ // General cases for IncByI - open Microsoft.Quantum.Measurement; open Microsoft.Quantum.Unstable.Arithmetic; use y0 = Qubit[1]; @@ -519,7 +513,6 @@ fn check_ripple_carry_cg_inc_by_i_general() { test_expression( { "{ // General cases for IncByIUsingIncByLE - open Microsoft.Quantum.Measurement; open Microsoft.Quantum.Unstable.Arithmetic; use y0 = Qubit[10]; @@ -556,7 +549,6 @@ fn check_inc_by_l_general() { test_expression( { "{ // General cases for IncByL - open Microsoft.Quantum.Measurement; open Microsoft.Quantum.Unstable.Arithmetic; use y0 = Qubit[1]; @@ -612,7 +604,6 @@ fn check_ripple_carry_cg_inc_by_l_general() { test_expression( { "{ // Branching cases for IncByLUsingIncByLE - open Microsoft.Quantum.Measurement; open Microsoft.Quantum.Unstable.Arithmetic; use y0 = Qubit[10]; @@ -691,7 +682,6 @@ fn check_add_le_general() { test_expression( { "{ // General cases for AddLE - open Microsoft.Quantum.Measurement; open Microsoft.Quantum.Unstable.Arithmetic; use x1 = Qubit[10]; @@ -761,7 +751,6 @@ fn check_ripple_carry_cg_add_le_general() { test_expression( { "{ // General cases for RippleCarryAddLE - open Microsoft.Quantum.Measurement; open Microsoft.Quantum.Unstable.Arithmetic; use x1 = Qubit[10]; @@ -829,7 +818,6 @@ fn check_lookahead_dkrs_add_le_general() { test_expression( { "{ // General cases for LookAheadDKRSAddLE - open Microsoft.Quantum.Measurement; open Microsoft.Quantum.Unstable.Arithmetic; use x1 = Qubit[10]; @@ -965,7 +953,6 @@ fn check_apply_if_less_l_non_x_action() { test_expression( "{ open Microsoft.Quantum.Unstable.Arithmetic; - open Microsoft.Quantum.Measurement; use input = Qubit[10]; use output1 = Qubit[10]; use output2 = Qubit[10]; diff --git a/library/src/tests/canon.rs b/library/src/tests/canon.rs index 4d0c158f9b..7f617cd497 100644 --- a/library/src/tests/canon.rs +++ b/library/src/tests/canon.rs @@ -177,7 +177,6 @@ fn check_apply_p() { test_expression( { "{ - open Microsoft.Quantum.Measurement; use q = Qubit[3]; ApplyP(PauliX, q[0]); H(q[1]); ApplyP(PauliY, q[1]); @@ -194,7 +193,6 @@ fn check_apply_pauli() { test_expression( { "{ - open Microsoft.Quantum.Measurement; use q = Qubit[3]; H(q[1]); H(q[2]); S(q[2]); @@ -211,7 +209,6 @@ fn check_apply_pauli_from_bit_string() { test_expression( { "{ - open Microsoft.Quantum.Measurement; use q = Qubit[3]; ApplyPauliFromBitString(PauliX, false, [true, false, true], q); return MResetEachZ(q); @@ -226,7 +223,6 @@ fn check_apply_pauli_from_int() { test_expression( { "{ - open Microsoft.Quantum.Measurement; use q = Qubit[3]; ApplyPauliFromInt(PauliX, false, 5, q); return MResetEachZ(q); @@ -241,7 +237,6 @@ fn check_apply_controlled_on_int() { test_expression( { "{ - open Microsoft.Quantum.Measurement; use c = Qubit[3]; use t1 = Qubit(); use t2 = Qubit(); @@ -264,7 +259,6 @@ fn check_apply_controlled_on_bitstring() { test_expression( { "{ - open Microsoft.Quantum.Measurement; use c = Qubit[4]; use t1 = Qubit(); use t2 = Qubit(); @@ -323,7 +317,6 @@ fn check_swap_reverse_register() { test_expression( { "{ - open Microsoft.Quantum.Measurement; use q = Qubit[10]; ApplyXorInPlace(328, q); SwapReverseRegister(q); @@ -361,7 +354,6 @@ fn check_apply_xor_in_place_l() { test_expression( { "{ - open Microsoft.Quantum.Measurement; use q = Qubit[100]; ApplyXorInPlaceL(953L <<< 50, q); let result = MeasureInteger(q[50...]); diff --git a/library/src/tests/measurement.rs b/library/src/tests/measurement.rs index 8b36185f33..ef937de036 100644 --- a/library/src/tests/measurement.rs +++ b/library/src/tests/measurement.rs @@ -140,7 +140,6 @@ fn check_measure_integer() { test_expression( { "{ - open Microsoft.Quantum.Measurement; use q = Qubit[16]; ApplyXorInPlace(45967, q); let result = MeasureInteger(q); diff --git a/library/src/tests/resources/add_le.qs b/library/src/tests/resources/add_le.qs index b4cb2c85e5..948e57b5dc 100644 --- a/library/src/tests/resources/add_le.qs +++ b/library/src/tests/resources/add_le.qs @@ -2,7 +2,6 @@ namespace Test { open Microsoft.Quantum.Unstable.Arithmetic; open Microsoft.Quantum.Convert; open Microsoft.Quantum.Diagnostics; - open Microsoft.Quantum.Measurement; internal operation TestAddLE3( name : String, diff --git a/library/src/tests/resources/compare.qs b/library/src/tests/resources/compare.qs index 1f00db6986..6b85f448b7 100644 --- a/library/src/tests/resources/compare.qs +++ b/library/src/tests/resources/compare.qs @@ -1,5 +1,4 @@ namespace Test { - open Microsoft.Quantum.Measurement; open Microsoft.Quantum.Unstable.Arithmetic; open Microsoft.Quantum.Convert; open Microsoft.Quantum.Diagnostics; diff --git a/library/src/tests/resources/inc_by_le.qs b/library/src/tests/resources/inc_by_le.qs index d0797a5436..d8c54161a0 100644 --- a/library/src/tests/resources/inc_by_le.qs +++ b/library/src/tests/resources/inc_by_le.qs @@ -2,7 +2,6 @@ namespace Test { open Microsoft.Quantum.Unstable.Arithmetic; open Microsoft.Quantum.Convert; open Microsoft.Quantum.Diagnostics; - open Microsoft.Quantum.Measurement; internal operation TestIncByLE2( name : String, diff --git a/library/src/tests/resources/select.qs b/library/src/tests/resources/select.qs index 4848006a75..08087539ad 100644 --- a/library/src/tests/resources/select.qs +++ b/library/src/tests/resources/select.qs @@ -2,7 +2,6 @@ namespace Test { open Microsoft.Quantum.Arrays; open Microsoft.Quantum.Convert; open Microsoft.Quantum.Diagnostics; - open Microsoft.Quantum.Measurement; open Microsoft.Quantum.Random; open Microsoft.Quantum.Unstable.TableLookup; diff --git a/library/src/tests/resources/state_preparation.qs b/library/src/tests/resources/state_preparation.qs index 7e762ac903..3c80bb6934 100644 --- a/library/src/tests/resources/state_preparation.qs +++ b/library/src/tests/resources/state_preparation.qs @@ -1,5 +1,4 @@ namespace Test { - open Microsoft.Quantum.Measurement; open Microsoft.Quantum.Convert; open Microsoft.Quantum.Math; open Microsoft.Quantum.Diagnostics; diff --git a/library/std/internal.qs b/library/std/internal.qs index 5c8c27f47b..6a2f4dc4e4 100644 --- a/library/std/internal.qs +++ b/library/std/internal.qs @@ -2,7 +2,6 @@ // Licensed under the MIT License. namespace Microsoft.Quantum.Intrinsic { - open Microsoft.Quantum.Measurement; open Microsoft.Quantum.Arrays; open Microsoft.Quantum.Core; open Microsoft.Quantum.Math; diff --git a/library/std/unstable_table_lookup.qs b/library/std/unstable_table_lookup.qs index 74e5e6c62e..5cb064528c 100644 --- a/library/std/unstable_table_lookup.qs +++ b/library/std/unstable_table_lookup.qs @@ -6,7 +6,6 @@ namespace Microsoft.Quantum.Unstable.TableLookup { open Microsoft.Quantum.Convert; open Microsoft.Quantum.Diagnostics; open Microsoft.Quantum.Math; - open Microsoft.Quantum.Measurement; open Microsoft.Quantum.ResourceEstimation; open Microsoft.Quantum.Unstable.Arithmetic; diff --git a/resource_estimator/src/counts/tests.rs b/resource_estimator/src/counts/tests.rs index eb2fb6249d..0d563aa409 100644 --- a/resource_estimator/src/counts/tests.rs +++ b/resource_estimator/src/counts/tests.rs @@ -39,8 +39,6 @@ fn gates_are_counted() { verify_logical_counts( indoc! {" namespace Test { - open Microsoft.Quantum.Measurement; - operation Rotate(qs: Qubit[]) : Unit { for q in qs { Rx(1.0, q);