diff --git a/src/fsharp/TastOps.fs b/src/fsharp/TastOps.fs index 8b0b40299f8..53b92da0fb4 100644 --- a/src/fsharp/TastOps.fs +++ b/src/fsharp/TastOps.fs @@ -6140,22 +6140,84 @@ let mkCallNewQuerySource (g:TcGlobals) m ty1 ty2 e1 = m let mkCallCreateEvent (g:TcGlobals) m ty1 ty2 e1 e2 e3 = mkApps g (typedExprForIntrinsic g m g.create_event_info, [[ty1;ty2]], [ e1;e2;e3 ], m) let mkCallGenericComparisonWithComparerOuter (g:TcGlobals) m ty comp e1 e2 = mkApps g (typedExprForIntrinsic g m g.generic_comparison_withc_outer_info, [[ty]], [ comp;e1;e2 ], m) -let mkCallEqualsOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.equals_operator_info, [[ty]], [ e1;e2 ], m) let mkCallGenericEqualityEROuter (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.generic_equality_er_outer_info, [[ty]], [ e1;e2 ], m) let mkCallGenericEqualityWithComparerOuter (g:TcGlobals) m ty comp e1 e2 = mkApps g (typedExprForIntrinsic g m g.generic_equality_withc_outer_info, [[ty]], [comp;e1;e2], m) let mkCallGenericHashWithComparerOuter (g:TcGlobals) m ty comp e1 = mkApps g (typedExprForIntrinsic g m g.generic_hash_withc_outer_info, [[ty]], [comp;e1], m) -let mkCallSubtractionOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.unchecked_subtraction_info, [[ty; ty; ty]], [e1;e2], m) +let mkCallEqualsOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.equals_operator_info, [[ty]], [ e1;e2 ], m) +let mkCallNotEqualsOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.not_equals_operator, [[ty]], [ e1;e2 ], m) +let mkCallLessThanOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.less_than_operator, [[ty]], [ e1;e2 ], m) +let mkCallLessThanOrEqualsOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.less_than_or_equals_operator, [[ty]], [ e1;e2 ], m) +let mkCallGreaterThanOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.greater_than_operator, [[ty]], [ e1;e2 ], m) +let mkCallGreaterThanOrEqualsOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.greater_than_or_equals_operator, [[ty]], [ e1;e2 ], m) -let mkCallArrayLength (g:TcGlobals) m ty el = mkApps g (typedExprForIntrinsic g m g.array_length_info, [[ty]], [el], m) -let mkCallArrayGet (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.array_get_info, [[ty]], [ e1 ; e2 ], m) +let mkCallAdditionOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.unchecked_addition_info, [[ty; ty; ty]], [e1;e2], m) +let mkCallSubtractionOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.unchecked_subtraction_info, [[ty; ty; ty]], [e1;e2], m) +let mkCallMultiplyOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.unchecked_multiply_info, [[ty; ty; ty]], [e1;e2], m) +let mkCallDivisionOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.unchecked_division_info, [[ty; ty; ty]], [e1;e2], m) +let mkCallModulusOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.unchecked_modulus_info, [[ty; ty; ty]], [e1;e2], m) +let mkCallBitwiseAndOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.bitwise_and_info, [[ty]], [e1;e2], m) +let mkCallBitwiseOrOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.bitwise_or_info, [[ty]], [e1;e2], m) +let mkCallBitwiseXorOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.bitwise_xor_info, [[ty]], [e1;e2], m) +let mkCallShiftLeftOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.bitwise_shift_left_info, [[ty]], [e1;e2], m) +let mkCallShiftRightOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.bitwise_shift_right_info, [[ty]], [e1;e2], m) + +let mkCallUnaryNegOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.unchecked_unary_minus_info, [[ty]], [e1], m) +let mkCallUnaryNotOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.bitwise_unary_not_info, [[ty]], [e1], m) + +let mkCallAdditionChecked (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.checked_addition_info, [[ty; ty; ty]], [e1;e2], m) +let mkCallSubtractionChecked (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.checked_subtraction_info, [[ty; ty; ty]], [e1;e2], m) +let mkCallMultiplyChecked (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.checked_multiply_info, [[ty; ty; ty]], [e1;e2], m) +let mkCallUnaryNegChecked (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.checked_unary_minus_info, [[ty]], [e1], m) + +let mkCallToByteChecked (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.byte_checked_info, [[ty]], [e1], m) +let mkCallToSByteChecked (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.sbyte_checked_info, [[ty]], [e1], m) +let mkCallToInt16Checked (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.int16_checked_info, [[ty]], [e1], m) +let mkCallToUInt16Checked (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.uint16_checked_info, [[ty]], [e1], m) +let mkCallToIntChecked (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.int_checked_info, [[ty]], [e1], m) +let mkCallToInt32Checked (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.int32_checked_info, [[ty]], [e1], m) +let mkCallToUInt32Checked (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.uint32_checked_info, [[ty]], [e1], m) +let mkCallToInt64Checked (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.int64_checked_info, [[ty]], [e1], m) +let mkCallToUInt64Checked (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.uint64_checked_info, [[ty]], [e1], m) +let mkCallToIntPtrChecked (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.nativeint_checked_info, [[ty]], [e1], m) +let mkCallToUIntPtrChecked (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.unativeint_checked_info, [[ty]], [e1], m) + +let mkCallToByteOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.byte_operator_info, [[ty]], [e1], m) +let mkCallToSByteOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.sbyte_operator_info, [[ty]], [e1], m) +let mkCallToInt16Operator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.int16_operator_info, [[ty]], [e1], m) +let mkCallToUInt16Operator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.uint16_operator_info, [[ty]], [e1], m) +let mkCallToIntOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.int_operator_info, [[ty]], [e1], m) +let mkCallToInt32Operator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.int32_operator_info, [[ty]], [e1], m) +let mkCallToUInt32Operator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.uint32_operator_info, [[ty]], [e1], m) +let mkCallToInt64Operator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.int64_operator_info, [[ty]], [e1], m) +let mkCallToUInt64Operator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.uint64_operator_info, [[ty]], [e1], m) +let mkCallToSingleOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.float32_operator_info, [[ty]], [e1], m) +let mkCallToDoubleOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.float_operator_info, [[ty]], [e1], m) +let mkCallToIntPtrOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.nativeint_operator_info, [[ty]], [e1], m) +let mkCallToUIntPtrOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.unativeint_operator_info, [[ty]], [e1], m) + +let mkCallToCharOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.char_operator_info, [[ty]], [e1], m) +let mkCallToEnumOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.enum_operator_info, [[ty]], [e1], m) + +let mkCallArrayLength (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.array_length_info, [[ty]], [e1], m) +let mkCallArrayGet (g:TcGlobals) m ty e1 idx1 = mkApps g (typedExprForIntrinsic g m g.array_get_info, [[ty]], [ e1 ; idx1 ], m) let mkCallArray2DGet (g:TcGlobals) m ty e1 idx1 idx2 = mkApps g (typedExprForIntrinsic g m g.array2D_get_info, [[ty]], [ e1 ; idx1; idx2 ], m) let mkCallArray3DGet (g:TcGlobals) m ty e1 idx1 idx2 idx3 = mkApps g (typedExprForIntrinsic g m g.array3D_get_info, [[ty]], [ e1 ; idx1; idx2; idx3 ], m) let mkCallArray4DGet (g:TcGlobals) m ty e1 idx1 idx2 idx3 idx4 = mkApps g (typedExprForIntrinsic g m g.array4D_get_info, [[ty]], [ e1 ; idx1; idx2; idx3; idx4 ], m) +let mkCallArraySet (g:TcGlobals) m ty e1 idx1 v = mkApps g (typedExprForIntrinsic g m g.array_set_info, [[ty]], [ e1 ; idx1; v ], m) +let mkCallArray2DSet (g:TcGlobals) m ty e1 idx1 idx2 v = mkApps g (typedExprForIntrinsic g m g.array2D_set_info, [[ty]], [ e1 ; idx1; idx2; v ], m) +let mkCallArray3DSet (g:TcGlobals) m ty e1 idx1 idx2 idx3 v = mkApps g (typedExprForIntrinsic g m g.array3D_set_info, [[ty]], [ e1 ; idx1; idx2; idx3; v ], m) +let mkCallArray4DSet (g:TcGlobals) m ty e1 idx1 idx2 idx3 idx4 v = mkApps g (typedExprForIntrinsic g m g.array4D_set_info, [[ty]], [ e1 ; idx1; idx2; idx3; idx4; v ], m) + +let mkCallHash (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.hash_info, [[ty]], [ e1 ], m) +let mkCallBox (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.box_info, [[ty]], [ e1 ], m) +let mkCallIsNull (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.isnull_info, [[ty]], [ e1 ], m) +let mkCallIsNotNull (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.isnotnull_info, [[ty]], [ e1 ], m) +let mkCallRaise (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.raise_info, [[ty]], [ e1 ], m) + let mkCallNewDecimal (g:TcGlobals) m (e1, e2, e3, e4, e5) = mkApps g (typedExprForIntrinsic g m g.new_decimal_info, [], [ e1;e2;e3;e4;e5 ], m) let mkCallNewFormat (g:TcGlobals) m aty bty cty dty ety e1 = mkApps g (typedExprForIntrinsic g m g.new_format_info, [[aty;bty;cty;dty;ety]], [ e1 ], m) -let mkCallRaise (g:TcGlobals) m aty e1 = mkApps g (typedExprForIntrinsic g m g.raise_info, [[aty]], [ e1 ], m) let TryEliminateDesugaredConstants g m c = match c with diff --git a/src/fsharp/TastOps.fsi b/src/fsharp/TastOps.fsi index 467be96cddd..9f23629b25e 100755 --- a/src/fsharp/TastOps.fsi +++ b/src/fsharp/TastOps.fsi @@ -1221,15 +1221,77 @@ val mkCallArrayGet : TcGlobals -> range -> TType -> Expr -> Expr -> Ex val mkCallArray2DGet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr val mkCallArray3DGet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr val mkCallArray4DGet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr +val mkCallArraySet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr +val mkCallArray2DSet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr +val mkCallArray3DSet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr +val mkCallArray4DSet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr + +val mkCallHash : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallBox : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallIsNull : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallIsNotNull : TcGlobals -> range -> TType -> Expr -> Expr val mkCallRaise : TcGlobals -> range -> TType -> Expr -> Expr val mkCallGenericComparisonWithComparerOuter : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr val mkCallGenericEqualityEROuter : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -val mkCallEqualsOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -val mkCallSubtractionOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr val mkCallGenericEqualityWithComparerOuter : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr val mkCallGenericHashWithComparerOuter : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallEqualsOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallNotEqualsOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallLessThanOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallLessThanOrEqualsOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallGreaterThanOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallGreaterThanOrEqualsOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + +val mkCallAdditionOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallSubtractionOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallMultiplyOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallDivisionOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallModulusOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallBitwiseAndOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallBitwiseOrOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallBitwiseXorOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallShiftLeftOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallShiftRightOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + +val mkCallUnaryNegOperator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallUnaryNotOperator : TcGlobals -> range -> TType -> Expr -> Expr + +val mkCallAdditionChecked : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallSubtractionChecked : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallMultiplyChecked : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallUnaryNegChecked : TcGlobals -> range -> TType -> Expr -> Expr + +val mkCallToByteChecked : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToSByteChecked : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToInt16Checked : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToUInt16Checked : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToIntChecked : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToInt32Checked : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToUInt32Checked : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToInt64Checked : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToUInt64Checked : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToIntPtrChecked : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToUIntPtrChecked : TcGlobals -> range -> TType -> Expr -> Expr + +val mkCallToByteOperator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToSByteOperator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToInt16Operator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToUInt16Operator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToIntOperator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToInt32Operator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToUInt32Operator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToInt64Operator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToUInt64Operator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToSingleOperator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToDoubleOperator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToIntPtrOperator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToUIntPtrOperator : TcGlobals -> range -> TType -> Expr -> Expr + +val mkCallToCharOperator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToEnumOperator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallDeserializeQuotationFSharp20Plus : TcGlobals -> range -> Expr -> Expr -> Expr -> Expr -> Expr val mkCallDeserializeQuotationFSharp40Plus : TcGlobals -> range -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr val mkCallCastQuotation : TcGlobals -> range -> TType -> Expr -> Expr diff --git a/src/fsharp/TcGlobals.fs b/src/fsharp/TcGlobals.fs index 73434eb1002..72c8fbb0a75 100755 --- a/src/fsharp/TcGlobals.fs +++ b/src/fsharp/TcGlobals.fs @@ -290,12 +290,25 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d else "[" + (String.replicate (rank - 1) ",") + "]`1" mk_MFCore_tcref fslibCcu type_sig) + let v_byte_ty = mkNonGenericTy v_byte_tcr + let v_sbyte_ty = mkNonGenericTy v_sbyte_tcr + let v_int16_ty = mkNonGenericTy v_int16_tcr + let v_uint16_ty = mkNonGenericTy v_uint16_tcr + let v_int_ty = mkNonGenericTy v_int_tcr + let v_int32_ty = mkNonGenericTy v_int32_tcr + let v_uint32_ty = mkNonGenericTy v_uint32_tcr + let v_int64_ty = mkNonGenericTy v_int64_tcr + let v_uint64_ty = mkNonGenericTy v_uint64_tcr + let v_float32_ty = mkNonGenericTy v_float32_tcr + let v_float_ty = mkNonGenericTy v_float_tcr + let v_nativeint_ty = mkNonGenericTy v_nativeint_tcr + let v_unativeint_ty = mkNonGenericTy v_unativeint_tcr + + let v_enum_ty = mkNonGenericTy v_int_tcr let v_bool_ty = mkNonGenericTy v_bool_tcr - let v_int_ty = mkNonGenericTy v_int_tcr let v_char_ty = mkNonGenericTy v_char_tcr let v_obj_ty = mkNonGenericTy v_obj_tcr let v_string_ty = mkNonGenericTy v_string_tcr - let v_byte_ty = mkNonGenericTy v_byte_tcr let v_decimal_ty = mkSysNonGenericTy sys "Decimal" let v_unit_ty = mkNonGenericTy v_unit_tcr_nice let v_system_Type_typ = mkSysNonGenericTy sys "Type" @@ -510,7 +523,7 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d let v_greater_than_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, CompileOpName ">" , None , None , [vara], mk_rel_sig varaTy) let v_greater_than_or_equals_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, CompileOpName ">=" , None , None , [vara], mk_rel_sig varaTy) - let v_enumOfValue_info = makeIntrinsicValRef(fslib_MFLanguagePrimitives_nleref, "EnumOfValue" , None , None , [vara; varb], ([[varaTy]], varbTy)) + let v_enumOfValue_info = makeIntrinsicValRef(fslib_MFLanguagePrimitives_nleref, "EnumOfValue" , None , None , [vara; varb], ([[varaTy]], varbTy)) let v_generic_comparison_withc_outer_info = makeIntrinsicValRef(fslib_MFLanguagePrimitives_nleref, "GenericComparisonWithComparer" , None , None , [vara], mk_compare_withc_sig varaTy) let v_generic_hash_withc_tuple2_info = makeIntrinsicValRef(fslib_MFHashCompare_nleref, "FastHashTuple2" , None , None , [vara;varb], mk_hash_withc_sig (decodeTupleTy tupInfoRef [varaTy; varbTy])) @@ -566,10 +579,50 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d let v_unchecked_addition_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "op_Addition" , None , None , [vara;varb;varc], mk_binop_ty3 varaTy varbTy varcTy) let v_unchecked_subtraction_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "op_Subtraction" , None , None , [vara;varb;varc], mk_binop_ty3 varaTy varbTy varcTy) let v_unchecked_multiply_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "op_Multiply" , None , None , [vara;varb;varc], mk_binop_ty3 varaTy varbTy varcTy) + let v_unchecked_division_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "op_Division" , None , None , [vara;varb;varc], mk_binop_ty3 varaTy varbTy varcTy) + let v_unchecked_modulus_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "op_Modulus" , None , None , [vara;varb;varc], mk_binop_ty3 varaTy varbTy varcTy) let v_unchecked_unary_plus_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "op_UnaryPlus" , None , None , [vara], mk_unop_ty varaTy) let v_unchecked_unary_minus_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "op_UnaryNegation" , None , None , [vara], mk_unop_ty varaTy) let v_unchecked_unary_not_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "not" , None , Some "Not" , [], mk_unop_ty v_bool_ty) + let v_checked_addition_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "op_Addition" , None , None , [vara;varb;varc], mk_binop_ty3 varaTy varbTy varcTy) + let v_checked_subtraction_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "op_Subtraction" , None , None , [vara;varb;varc], mk_binop_ty3 varaTy varbTy varcTy) + let v_checked_multiply_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "op_Multiply" , None , None , [vara;varb;varc], mk_binop_ty3 varaTy varbTy varcTy) + let v_checked_unary_minus_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "op_UnaryNegation" , None , None , [vara], mk_unop_ty varaTy) + + let v_byte_checked_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "byte" , None , Some "ToByte", [vara], ([[varaTy]], v_byte_ty)) + let v_sbyte_checked_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "sbyte" , None , Some "ToSByte", [vara], ([[varaTy]], v_sbyte_ty)) + let v_int16_checked_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "int16" , None , Some "ToInt16", [vara], ([[varaTy]], v_int16_ty)) + let v_uint16_checked_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "uint16" , None , Some "ToUInt16", [vara], ([[varaTy]], v_uint16_ty)) + let v_int_checked_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "int" , None , Some "ToInt", [vara], ([[varaTy]], v_int_ty)) + let v_int32_checked_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "int32" , None , Some "ToInt32", [vara], ([[varaTy]], v_int32_ty)) + let v_uint32_checked_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "uint32" , None , Some "ToUInt32", [vara], ([[varaTy]], v_uint32_ty)) + let v_int64_checked_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "int64" , None , Some "ToInt64", [vara], ([[varaTy]], v_int64_ty)) + let v_uint64_checked_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "uint64" , None , Some "ToUInt64", [vara], ([[varaTy]], v_uint64_ty)) + let v_nativeint_checked_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "nativeint" , None , Some "ToIntPtr", [vara], ([[varaTy]], v_nativeint_ty)) + let v_unativeint_checked_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "unativeint" , None , Some "ToUIntPtr", [vara], ([[varaTy]], v_unativeint_ty)) + + let v_byte_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "byte" , None , Some "ToByte", [vara], ([[varaTy]], v_byte_ty)) + let v_sbyte_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "sbyte" , None , Some "ToSByte", [vara], ([[varaTy]], v_sbyte_ty)) + let v_int16_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "int16" , None , Some "ToInt16", [vara], ([[varaTy]], v_int16_ty)) + let v_uint16_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "uint16" , None , Some "ToUInt16", [vara], ([[varaTy]], v_uint16_ty)) + let v_int_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "int" , None , Some "ToInt", [vara], ([[varaTy]], v_int_ty)) + let v_int32_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "int32" , None , Some "ToInt32", [vara], ([[varaTy]], v_int32_ty)) + let v_uint32_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "uint32" , None , Some "ToUInt32", [vara], ([[varaTy]], v_uint32_ty)) + let v_int64_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "int64" , None , Some "ToInt64", [vara], ([[varaTy]], v_int64_ty)) + let v_uint64_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "uint64" , None , Some "ToUInt64", [vara], ([[varaTy]], v_uint64_ty)) + let v_float32_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "float32" , None , Some "ToSingle", [vara], ([[varaTy]], v_float32_ty)) + let v_float_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "float" , None , Some "ToDouble", [vara], ([[varaTy]], v_float_ty)) + let v_nativeint_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "nativeint" , None , Some "ToIntPtr", [vara], ([[varaTy]], v_nativeint_ty)) + let v_unativeint_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "unativeint" , None , Some "ToUIntPtr", [vara], ([[varaTy]], v_unativeint_ty)) + + let v_char_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "char" , None , Some "ToChar", [vara], ([[varaTy]], v_char_ty)) + let v_enum_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "enum" , None , Some "ToEnum", [vara], ([[varaTy]], v_enum_ty)) + + let v_hash_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "hash" , None , Some "Hash" , [vara], ([[varaTy]], v_int_ty)) + let v_box_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "box" , None , Some "Box" , [vara], ([[varaTy]], v_obj_ty)) + let v_isnull_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "isNull" , None , Some "IsNull" , [vara], ([[varaTy]], v_bool_ty)) + let v_isnotnull_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "isNotNull" , None , Some "IsNotNull" , [vara], ([[varaTy]], v_bool_ty)) let v_raise_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "raise" , None , Some "Raise" , [vara], ([[mkSysNonGenericTy sys "Exception"]], varaTy)) let v_failwith_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "failwith" , None , Some "FailWith" , [vara], ([[v_string_ty]], varaTy)) let v_invalid_arg_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "invalidArg" , None , Some "InvalidArg" , [vara], ([[v_string_ty]; [v_string_ty]], varaTy)) @@ -583,13 +636,19 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d let v_sizeof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "sizeof" , None , Some "SizeOf" , [vara], ([], v_int_ty)) let v_unchecked_defaultof_info = makeIntrinsicValRef(fslib_MFOperatorsUnchecked_nleref, "defaultof" , None , Some "DefaultOf", [vara], ([], varaTy)) let v_typedefof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "typedefof" , None , Some "TypeDefOf", [vara], ([], v_system_Type_typ)) - let v_enum_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "enum" , None , Some "ToEnum" , [vara], ([[v_int_ty]], varaTy)) let v_range_op_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "op_Range" , None , None , [vara], ([[varaTy];[varaTy]], mkSeqTy varaTy)) let v_range_step_op_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "op_RangeStep" , None , None , [vara;varb], ([[varaTy];[varbTy];[varaTy]], mkSeqTy varaTy)) let v_range_int32_op_info = makeIntrinsicValRef(fslib_MFOperatorIntrinsics_nleref, "RangeInt32" , None , None , [], ([[v_int_ty];[v_int_ty];[v_int_ty]], mkSeqTy v_int_ty)) + + let v_array_length_info = makeIntrinsicValRef(fslib_MFArrayModule_nleref, "length" , None , Some "Length" , [vara], ([[mkArrayType 1 varaTy]], v_int_ty)) + let v_array_get_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "GetArray" , None , None , [vara], ([[mkArrayType 1 varaTy]; [v_int_ty]], varaTy)) let v_array2D_get_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "GetArray2D" , None , None , [vara], ([[mkArrayType 2 varaTy];[v_int_ty]; [v_int_ty]], varaTy)) let v_array3D_get_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "GetArray3D" , None , None , [vara], ([[mkArrayType 3 varaTy];[v_int_ty]; [v_int_ty]; [v_int_ty]], varaTy)) let v_array4D_get_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "GetArray4D" , None , None , [vara], ([[mkArrayType 4 varaTy];[v_int_ty]; [v_int_ty]; [v_int_ty]; [v_int_ty]], varaTy)) + let v_array_set_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "SetArray" , None , None , [vara], ([[mkArrayType 1 varaTy]; [v_int_ty]; [varaTy]], v_unit_ty)) + let v_array2D_set_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "SetArray2D" , None , None , [vara], ([[mkArrayType 2 varaTy];[v_int_ty]; [v_int_ty]; [varaTy]], v_unit_ty)) + let v_array3D_set_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "SetArray3D" , None , None , [vara], ([[mkArrayType 3 varaTy];[v_int_ty]; [v_int_ty]; [v_int_ty]; [varaTy]], v_unit_ty)) + let v_array4D_set_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "SetArray4D" , None , None , [vara], ([[mkArrayType 4 varaTy];[v_int_ty]; [v_int_ty]; [v_int_ty]; [v_int_ty]; [varaTy]], v_unit_ty)) let v_seq_collect_info = makeIntrinsicValRef(fslib_MFSeqModule_nleref, "collect" , None , Some "Collect", [vara;varb;varc], ([[varaTy --> varbTy]; [mkSeqTy varaTy]], mkSeqTy varcTy)) let v_seq_delay_info = makeIntrinsicValRef(fslib_MFSeqModule_nleref, "delay" , None , Some "Delay" , [varb], ([[v_unit_ty --> mkSeqTy varbTy]], mkSeqTy varbTy)) @@ -616,14 +675,12 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d let v_splice_expr_info = makeIntrinsicValRef(fslib_MFExtraTopLevelOperators_nleref, "op_Splice" , None , None , [vara], ([[mkQuotedExprTy varaTy]], varaTy)) let v_splice_raw_expr_info = makeIntrinsicValRef(fslib_MFExtraTopLevelOperators_nleref, "op_SpliceUntyped" , None , None , [vara], ([[mkRawQuotedExprTy]], varaTy)) let v_new_decimal_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "MakeDecimal" , None , None , [], ([[v_int_ty]; [v_int_ty]; [v_int_ty]; [v_bool_ty]; [v_byte_ty]], v_decimal_ty)) - let v_array_get_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "GetArray" , None , None , [vara], ([[mkArrayType 1 varaTy]; [v_int_ty]], varaTy)) - let v_array_length_info = makeIntrinsicValRef(fslib_MFArrayModule_nleref, "length" , None , Some "Length" , [vara], ([[mkArrayType 1 varaTy]], v_int_ty)) let v_deserialize_quoted_FSharp_20_plus_info = makeIntrinsicValRef(fslib_MFQuotations_nleref, "Deserialize" , Some "Expr" , None , [], ([[v_system_Type_typ ;mkListTy v_system_Type_typ ;mkListTy mkRawQuotedExprTy ; mkArrayType 1 v_byte_ty]], mkRawQuotedExprTy )) let v_deserialize_quoted_FSharp_40_plus_info = makeIntrinsicValRef(fslib_MFQuotations_nleref, "Deserialize40" , Some "Expr" , None , [], ([[v_system_Type_typ ;mkArrayType 1 v_system_Type_typ; mkArrayType 1 v_system_Type_typ; mkArrayType 1 mkRawQuotedExprTy; mkArrayType 1 v_byte_ty]], mkRawQuotedExprTy )) let v_cast_quotation_info = makeIntrinsicValRef(fslib_MFQuotations_nleref, "Cast" , Some "Expr" , None , [vara], ([[mkRawQuotedExprTy]], mkQuotedExprTy varaTy)) let v_lift_value_info = makeIntrinsicValRef(fslib_MFQuotations_nleref, "Value" , Some "Expr" , None , [vara], ([[varaTy]], mkRawQuotedExprTy)) let v_lift_value_with_name_info = makeIntrinsicValRef(fslib_MFQuotations_nleref, "ValueWithName" , Some "Expr" , None , [vara], ([[varaTy; v_string_ty]], mkRawQuotedExprTy)) - let v_lift_value_with_defn_info = makeIntrinsicValRef(fslib_MFQuotations_nleref, "WithValue" , Some "Expr" , None , [vara], ([[varaTy; mkQuotedExprTy varaTy]], mkQuotedExprTy varaTy)) + let v_lift_value_with_defn_info = makeIntrinsicValRef(fslib_MFQuotations_nleref, "WithValue" , Some "Expr" , None , [vara], ([[varaTy; mkQuotedExprTy varaTy]], mkQuotedExprTy varaTy)) let v_query_value_info = makeIntrinsicValRef(fslib_MFExtraTopLevelOperators_nleref, "query" , None , None , [], ([], mkQueryBuilderTy) ) let v_query_run_value_info = makeIntrinsicValRef(fslib_MFQueryRunExtensionsLowPriority_nleref, "Run" , Some "QueryBuilder" , None , [vara], ([[mkQueryBuilderTy];[mkQuotedExprTy varaTy]], varaTy) ) let v_query_run_enumerable_info = makeIntrinsicValRef(fslib_MFQueryRunExtensionsHighPriority_nleref, "Run" , Some "QueryBuilder" , None , [vara], ([[mkQueryBuilderTy];[mkQuotedExprTy (mkQuerySourceTy varaTy (mkNonGenericTy v_tcref_System_Collections_IEnumerable)) ]], mkSeqTy varaTy) ) @@ -831,6 +888,8 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member __.expr_tcr = v_expr_tcr member __.raw_expr_tcr = v_raw_expr_tcr member __.nativeint_tcr = v_nativeint_tcr + member __.unativeint_tcr = v_unativeint_tcr + member __.int_tcr = v_int_tcr member __.int32_tcr = v_int32_tcr member __.int16_tcr = v_int16_tcr member __.int64_tcr = v_int64_tcr @@ -892,15 +951,15 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member __.choice5_tcr = v_choice5_tcr member __.choice6_tcr = v_choice6_tcr member __.choice7_tcr = v_choice7_tcr - member val nativeint_ty = mkNonGenericTy v_nativeint_tcr - member val unativeint_ty = mkNonGenericTy v_unativeint_tcr - member val int32_ty = mkNonGenericTy v_int32_tcr - member val int16_ty = mkNonGenericTy v_int16_tcr - member val int64_ty = mkNonGenericTy v_int64_tcr - member val uint16_ty = mkNonGenericTy v_uint16_tcr - member val uint32_ty = mkNonGenericTy v_uint32_tcr - member val uint64_ty = mkNonGenericTy v_uint64_tcr - member val sbyte_ty = mkNonGenericTy v_sbyte_tcr + member val nativeint_ty = v_nativeint_ty + member val unativeint_ty = v_unativeint_ty + member val int32_ty = v_int32_ty + member val int16_ty = v_int16_ty + member val int64_ty = v_int64_ty + member val uint16_ty = v_uint16_ty + member val uint32_ty = v_uint32_ty + member val uint64_ty = v_uint64_ty + member val sbyte_ty = v_sbyte_ty member __.byte_ty = v_byte_ty member __.bool_ty = v_bool_ty member __.int_ty = v_int_ty @@ -911,8 +970,8 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member __.decimal_ty = v_decimal_ty member val exn_ty = mkNonGenericTy v_exn_tcr - member val float_ty = mkNonGenericTy v_float_tcr - member val float32_ty = mkNonGenericTy v_float32_tcr + member val float_ty = v_float_ty + member val float32_ty = v_float32_ty /// Memoization table to help minimize the number of ILSourceDocument objects we create member __.memoize_file x = v_memoize_file.Apply x @@ -1134,7 +1193,56 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member val unchecked_subtraction_vref = ValRefForIntrinsic v_unchecked_subtraction_info member val unchecked_multiply_vref = ValRefForIntrinsic v_unchecked_multiply_info member val unchecked_defaultof_vref = ValRefForIntrinsic v_unchecked_defaultof_info + + member __.bitwise_or_info = v_bitwise_or_info + member __.bitwise_and_info = v_bitwise_and_info + member __.bitwise_xor_info = v_bitwise_xor_info + member __.bitwise_unary_not_info = v_bitwise_unary_not_info + member __.bitwise_shift_left_info = v_bitwise_shift_left_info + member __.bitwise_shift_right_info = v_bitwise_shift_right_info + member __.unchecked_addition_info = v_unchecked_addition_info member __.unchecked_subtraction_info = v_unchecked_subtraction_info + member __.unchecked_multiply_info = v_unchecked_multiply_info + member __.unchecked_division_info = v_unchecked_division_info + member __.unchecked_modulus_info = v_unchecked_modulus_info + member __.unchecked_unary_plus_info = v_unchecked_unary_plus_info + member __.unchecked_unary_minus_info = v_unchecked_unary_minus_info + member __.unchecked_unary_not_info = v_unchecked_unary_not_info + + member __.checked_addition_info = v_checked_addition_info + member __.checked_subtraction_info = v_checked_subtraction_info + member __.checked_multiply_info = v_checked_multiply_info + member __.checked_unary_minus_info = v_checked_unary_minus_info + + member __.byte_checked_info = v_byte_checked_info + member __.sbyte_checked_info = v_sbyte_checked_info + member __.int16_checked_info = v_int16_checked_info + member __.uint16_checked_info = v_uint16_checked_info + member __.int_checked_info = v_int_checked_info + member __.int32_checked_info = v_int32_checked_info + member __.uint32_checked_info = v_uint32_checked_info + member __.int64_checked_info = v_int64_checked_info + member __.uint64_checked_info = v_uint64_checked_info + member __.nativeint_checked_info = v_nativeint_checked_info + member __.unativeint_checked_info = v_unativeint_checked_info + + member __.byte_operator_info = v_byte_operator_info + member __.sbyte_operator_info = v_sbyte_operator_info + member __.int16_operator_info = v_int16_operator_info + member __.uint16_operator_info = v_uint16_operator_info + member __.int_operator_info = v_int_operator_info + member __.int32_operator_info = v_int32_operator_info + member __.uint32_operator_info = v_uint32_operator_info + member __.int64_operator_info = v_int64_operator_info + member __.uint64_operator_info = v_uint64_operator_info + member __.float32_operator_info = v_float32_operator_info + member __.float_operator_info = v_float_operator_info + member __.nativeint_operator_info = v_nativeint_operator_info + member __.unativeint_operator_info = v_unativeint_operator_info + + member __.char_operator_info = v_char_operator_info + member __.enum_operator_info = v_enum_operator_info + member val compare_operator_vref = ValRefForIntrinsic v_compare_operator_info member val equals_operator_vref = ValRefForIntrinsic v_equals_operator_info member val equals_nullable_operator_vref = ValRefForIntrinsic v_equals_nullable_operator_info @@ -1153,7 +1261,17 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member val invalid_op_vref = ValRefForIntrinsic v_invalid_op_info member val failwithf_vref = ValRefForIntrinsic v_failwithf_info - member __.equals_operator_info = v_equals_operator_info + member __.equals_operator_info = v_equals_operator_info + member __.not_equals_operator = v_not_equals_operator_info + member __.less_than_operator = v_less_than_operator_info + member __.less_than_or_equals_operator = v_less_than_or_equals_operator_info + member __.greater_than_operator = v_greater_than_operator_info + member __.greater_than_or_equals_operator = v_greater_than_or_equals_operator_info + + member __.hash_info = v_hash_info + member __.box_info = v_box_info + member __.isnull_info = v_isnull_info + member __.isnotnull_info = v_isnotnull_info member __.raise_info = v_raise_info member __.failwith_info = v_failwith_info member __.invalid_arg_info = v_invalid_arg_info @@ -1164,14 +1282,13 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member __.methodhandleof_info = v_methodhandleof_info member __.typeof_info = v_typeof_info member __.typedefof_info = v_typedefof_info - member __.array_length_info = v_array_length_info member val reraise_vref = ValRefForIntrinsic v_reraise_info member val methodhandleof_vref = ValRefForIntrinsic v_methodhandleof_info member val typeof_vref = ValRefForIntrinsic v_typeof_info member val sizeof_vref = ValRefForIntrinsic v_sizeof_info member val typedefof_vref = ValRefForIntrinsic v_typedefof_info - member val enum_vref = ValRefForIntrinsic v_enum_info + member val enum_vref = ValRefForIntrinsic v_enum_operator_info member val enumOfValue_vref = ValRefForIntrinsic v_enumOfValue_info member val range_op_vref = ValRefForIntrinsic v_range_op_info member val range_step_op_vref = ValRefForIntrinsic v_range_step_op_info @@ -1233,10 +1350,17 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member __.create_event_info = v_create_event_info member __.seq_to_list_info = v_seq_to_list_info member __.seq_to_array_info = v_seq_to_array_info + + member __.array_length_info = v_array_length_info member __.array_get_info = v_array_get_info - member __.array2D_get_info = v_array2D_get_info - member __.array3D_get_info = v_array3D_get_info - member __.array4D_get_info = v_array4D_get_info + member __.array2D_get_info = v_array2D_get_info + member __.array3D_get_info = v_array3D_get_info + member __.array4D_get_info = v_array4D_get_info + member __.array_set_info = v_array_set_info + member __.array2D_set_info = v_array2D_set_info + member __.array3D_set_info = v_array3D_set_info + member __.array4D_set_info = v_array4D_set_info + member __.deserialize_quoted_FSharp_20_plus_info = v_deserialize_quoted_FSharp_20_plus_info member __.deserialize_quoted_FSharp_40_plus_info = v_deserialize_quoted_FSharp_40_plus_info member __.cast_quotation_info = v_cast_quotation_info diff --git a/src/fsharp/service/service.fs b/src/fsharp/service/service.fs index a2dca027e44..79610d4bee2 100644 --- a/src/fsharp/service/service.fs +++ b/src/fsharp/service/service.fs @@ -1810,11 +1810,16 @@ type FSharpProjectContext(thisCcu: CcuThunk, assemblies: FSharpAssembly list, ad [] // 'details' is an option because the creation of the tcGlobals etc. for the project may have failed. -type FSharpCheckProjectResults(projectFileName:string, keepAssemblyContents, errors: FSharpErrorInfo[], details:(TcGlobals*TcImports*CcuThunk*ModuleOrNamespaceType*TcSymbolUses list*TopAttribs option*CompileOps.IRawFSharpAssemblyData option * ILAssemblyRef * AccessorDomain * TypedImplFile list option * string[]) option, _reactorOps: IReactorOperations) = +type FSharpCheckProjectResults(projectFileName:string, tcConfigOption, keepAssemblyContents, errors: FSharpErrorInfo[], details:(TcGlobals*TcImports*CcuThunk*ModuleOrNamespaceType*TcSymbolUses list*TopAttribs option*CompileOps.IRawFSharpAssemblyData option * ILAssemblyRef * AccessorDomain * TypedImplFile list option * string[]) option, _reactorOps: IReactorOperations) = let getDetails() = match details with - | None -> invalidOp ("The project has no results due to critical errors in the project options. Check the HasCriticalErrors before accessing the detaild results. Errors: " + String.concat "\n" [ for e in errors -> e.Message ]) + | None -> invalidOp ("The project has no results due to critical errors in the project options. Check the HasCriticalErrors before accessing the detailed results. Errors: " + String.concat "\n" [ for e in errors -> e.Message ]) + | Some d -> d + + let getTcConfig() = + match tcConfigOption with + | None -> invalidOp ("The project has no results due to critical errors in the project options. Check the HasCriticalErrors before accessing the detailed results. Errors: " + String.concat "\n" [ for e in errors -> e.Message ]) | Some d -> d member info.Errors = errors @@ -1825,13 +1830,29 @@ type FSharpCheckProjectResults(projectFileName:string, keepAssemblyContents, err let (tcGlobals, tcImports, thisCcu, ccuSig, _tcSymbolUses, topAttribs, _tcAssemblyData, _ilAssemRef, _ad, _tcAssemblyExpr, _dependencyFiles) = getDetails() FSharpAssemblySignature(tcGlobals, thisCcu, tcImports, topAttribs, ccuSig) - member info.AssemblyContents = + member info.TypedImplementionFiles = if not keepAssemblyContents then invalidOp "The 'keepAssemblyContents' flag must be set to true on the FSharpChecker in order to access the checked contents of assemblies" let (tcGlobals, tcImports, thisCcu, _ccuSig, _tcSymbolUses, _topAttribs, _tcAssemblyData, _ilAssemRef, _ad, tcAssemblyExpr, _dependencyFiles) = getDetails() let mimpls = match tcAssemblyExpr with | None -> [] | Some mimpls -> mimpls + tcGlobals, thisCcu, tcImports, mimpls + + member info.AssemblyContents = FSharpAssemblyContents(info.TypedImplementionFiles) + + member info.GetOptimizedAssemblyContents() = + let tcGlobals, thisCcu, tcImports, mimpls = info.TypedImplementionFiles + let outfile = "" // only used if tcConfig.writeTermsToFiles is true + let importMap = tcImports.GetImportMap() + let optEnv0 = GetInitialOptimizationEnv (tcImports, tcGlobals) + let tcConfig = getTcConfig() + let optimizedImpls, _optimizationData, _ = ApplyAllOptimizations (tcConfig, tcGlobals, (LightweightTcValForUsingInBuildMethodCall tcGlobals), outfile, importMap, false, optEnv0, thisCcu, mimpls) + let mimpls = + match optimizedImpls with + | TypedAssemblyAfterOptimization files -> + files |> List.map fst + FSharpAssemblyContents(tcGlobals, thisCcu, tcImports, mimpls) // Not, this does not have to be a SyncOp, it can be called from any thread @@ -2710,13 +2731,13 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC use _unwind = decrement match builderOpt with | None -> - return FSharpCheckProjectResults (options.ProjectFileName, keepAssemblyContents, Array.ofList creationErrors, None, reactorOps) + return FSharpCheckProjectResults (options.ProjectFileName, None, keepAssemblyContents, Array.ofList creationErrors, None, reactorOps) | Some builder -> let! (tcProj, ilAssemRef, tcAssemblyDataOpt, tcAssemblyExprOpt) = builder.GetCheckResultsAndImplementationsForProject(ctok) let errorOptions = tcProj.TcConfig.errorSeverityOptions let fileName = TcGlobals.DummyFileNameForRangesWithoutASpecificLocation let errors = [| yield! creationErrors; yield! ErrorHelpers.CreateErrorInfos (errorOptions, true, fileName, tcProj.Errors) |] - return FSharpCheckProjectResults (options.ProjectFileName, keepAssemblyContents, errors, Some(tcProj.TcGlobals, tcProj.TcImports, tcProj.TcState.Ccu, tcProj.TcState.PartialAssemblySignature, tcProj.TcSymbolUses, tcProj.TopAttribs, tcAssemblyDataOpt, ilAssemRef, tcProj.TcEnvAtEnd.AccessRights, tcAssemblyExprOpt, Array.ofList tcProj.TcDependencyFiles), reactorOps) + return FSharpCheckProjectResults (options.ProjectFileName, Some tcProj.TcConfig, keepAssemblyContents, errors, Some(tcProj.TcGlobals, tcProj.TcImports, tcProj.TcState.Ccu, tcProj.TcState.PartialAssemblySignature, tcProj.TcSymbolUses, tcProj.TopAttribs, tcAssemblyDataOpt, ilAssemRef, tcProj.TcEnvAtEnd.AccessRights, tcAssemblyExprOpt, Array.ofList tcProj.TcDependencyFiles), reactorOps) } /// Get the timestamp that would be on the output if fully built immediately @@ -3235,7 +3256,7 @@ type FsiInteractiveChecker(legacyReferenceResolver, reactorOps: IReactorOperatio | Parser.TypeCheckAborted.No scope -> let errors = [| yield! parseErrors; yield! tcErrors |] let typeCheckResults = FSharpCheckFileResults (filename, errors, Some scope, dependencyFiles, None, reactorOps, false) - let projectResults = FSharpCheckProjectResults (filename, keepAssemblyContents, errors, Some(tcGlobals, tcImports, scope.ThisCcu, scope.CcuSig, [scope.ScopeSymbolUses], None, None, mkSimpleAssRef "stdin", tcState.TcEnvFromImpls.AccessRights, None, dependencyFiles), reactorOps) + let projectResults = FSharpCheckProjectResults (filename, Some tcConfig, keepAssemblyContents, errors, Some(tcGlobals, tcImports, scope.ThisCcu, scope.CcuSig, [scope.ScopeSymbolUses], None, None, mkSimpleAssRef "stdin", tcState.TcEnvFromImpls.AccessRights, None, dependencyFiles), reactorOps) parseResults, typeCheckResults, projectResults | _ -> failwith "unexpected aborted" diff --git a/src/fsharp/service/service.fsi b/src/fsharp/service/service.fsi index 2bc107b8925..82a1a563ea8 100755 --- a/src/fsharp/service/service.fsi +++ b/src/fsharp/service/service.fsi @@ -269,6 +269,9 @@ type public FSharpCheckProjectResults = /// Get a view of the overall contents of the assembly. Only valid to use if HasCriticalErrors is false. member AssemblyContents: FSharpAssemblyContents + /// Get an optimized view of the overall contents of the assembly. Only valid to use if HasCriticalErrors is false. + member GetOptimizedAssemblyContents: unit -> FSharpAssemblyContents + /// Get the resolution of the ProjectOptions member ProjectContext: FSharpProjectContext diff --git a/src/fsharp/symbols/Exprs.fs b/src/fsharp/symbols/Exprs.fs index 405ae4e7e96..d818cf956a1 100644 --- a/src/fsharp/symbols/Exprs.fs +++ b/src/fsharp/symbols/Exprs.fs @@ -197,6 +197,98 @@ module FSharpExprConvert = | Expr.Op(TOp.ValFieldSet rfref, _, _, _) when IsStaticInitializationField rfref -> Some () | _ -> None + let (|ILUnaryOp|_|) e = + match e with + | AI_neg -> Some mkCallUnaryNegOperator + | AI_not -> Some mkCallUnaryNotOperator + | _ -> None + + let (|ILBinaryOp|_|) e = + match e with + | AI_add -> Some mkCallAdditionOperator + | AI_add_ovf + | AI_add_ovf_un -> Some mkCallAdditionChecked + | AI_sub -> Some mkCallSubtractionOperator + | AI_sub_ovf + | AI_sub_ovf_un -> Some mkCallSubtractionChecked + | AI_mul -> Some mkCallMultiplyOperator + | AI_mul_ovf + | AI_mul_ovf_un -> Some mkCallMultiplyChecked + | AI_div + | AI_div_un -> Some mkCallDivisionOperator + | AI_rem + | AI_rem_un -> Some mkCallModulusOperator + | AI_ceq -> Some mkCallEqualsOperator + | AI_clt + | AI_clt_un -> Some mkCallLessThanOperator + | AI_cgt + | AI_cgt_un -> Some mkCallGreaterThanOperator + | AI_and -> Some mkCallBitwiseAndOperator + | AI_or -> Some mkCallBitwiseOrOperator + | AI_xor -> Some mkCallBitwiseXorOperator + | AI_shl -> Some mkCallShiftLeftOperator + | AI_shr + | AI_shr_un -> Some mkCallShiftRightOperator + | _ -> None + + let (|ILConvertOp|_|) e = + match e with + | AI_conv basicTy -> + match basicTy with + | DT_R -> Some mkCallToDoubleOperator + | DT_I1 -> Some mkCallToSByteOperator + | DT_U1 -> Some mkCallToByteOperator + | DT_I2 -> Some mkCallToInt16Operator + | DT_U2 -> Some mkCallToUInt16Operator + | DT_I4 -> Some mkCallToInt32Operator + | DT_U4 -> Some mkCallToUInt32Operator + | DT_I8 -> Some mkCallToInt64Operator + | DT_U8 -> Some mkCallToUInt64Operator + | DT_R4 -> Some mkCallToSingleOperator + | DT_R8 -> Some mkCallToDoubleOperator + | DT_I -> Some mkCallToIntPtrOperator + | DT_U -> Some mkCallToUIntPtrOperator + | DT_REF -> None + | AI_conv_ovf basicTy + | AI_conv_ovf_un basicTy -> + match basicTy with + | DT_R -> Some mkCallToDoubleOperator + | DT_I1 -> Some mkCallToSByteChecked + | DT_U1 -> Some mkCallToByteChecked + | DT_I2 -> Some mkCallToInt16Checked + | DT_U2 -> Some mkCallToUInt16Checked + | DT_I4 -> Some mkCallToInt32Checked + | DT_U4 -> Some mkCallToUInt32Checked + | DT_I8 -> Some mkCallToInt64Checked + | DT_U8 -> Some mkCallToUInt64Checked + | DT_R4 -> Some mkCallToSingleOperator + | DT_R8 -> Some mkCallToDoubleOperator + | DT_I -> Some mkCallToIntPtrChecked + | DT_U -> Some mkCallToUIntPtrChecked + | DT_REF -> None + | _ -> None + + let (|TTypeConvOp|_|) (cenv:Impl.cenv) ty = + let g = cenv.g + match ty with + | TType_app (tcref,_) -> + match tcref with + | _ when tyconRefEq g tcref g.sbyte_tcr -> Some mkCallToSByteOperator + | _ when tyconRefEq g tcref g.byte_tcr -> Some mkCallToByteOperator + | _ when tyconRefEq g tcref g.int16_tcr -> Some mkCallToInt16Operator + | _ when tyconRefEq g tcref g.uint16_tcr -> Some mkCallToUInt16Operator + | _ when tyconRefEq g tcref g.int_tcr -> Some mkCallToIntOperator + | _ when tyconRefEq g tcref g.int32_tcr -> Some mkCallToInt32Operator + | _ when tyconRefEq g tcref g.uint32_tcr -> Some mkCallToUInt32Operator + | _ when tyconRefEq g tcref g.int64_tcr -> Some mkCallToInt64Operator + | _ when tyconRefEq g tcref g.uint64_tcr -> Some mkCallToUInt64Operator + | _ when tyconRefEq g tcref g.float32_tcr -> Some mkCallToSingleOperator + | _ when tyconRefEq g tcref g.float_tcr -> Some mkCallToDoubleOperator + | _ when tyconRefEq g tcref g.nativeint_tcr -> Some mkCallToIntPtrOperator + | _ when tyconRefEq g tcref g.unativeint_tcr -> Some mkCallToUIntPtrOperator + | _ -> None + | _ -> None + let ConvType cenv typ = FSharpType(cenv, typ) let ConvTypes cenv typs = List.map (ConvType cenv) typs let ConvILTypeRefApp (cenv:Impl.cenv) m tref tyargs = @@ -530,11 +622,89 @@ module FSharpExprConvert = let argR = ConvExpr cenv env arg E.ILFieldSet(None, typR, fspec.Name, argR) - - | TOp.ILAsm([ AI_ceq ], _), _, [arg1;arg2] -> + | TOp.ILAsm([ ], [tty]), _, [arg] -> + match tty with + | TTypeConvOp cenv convOp -> + let ty = tyOfExpr cenv.g arg + let op = convOp cenv.g m ty arg + ConvExprPrim cenv env op + | _ -> + ConvExprPrim cenv env arg + + | TOp.ILAsm([ I_box _ ], _), [ty], [arg] -> + let op = mkCallBox cenv.g m ty arg + ConvExprPrim cenv env op + + | TOp.ILAsm([ I_unbox_any _ ], _), [ty], [arg] -> + let op = mkCallUnbox cenv.g m ty arg + ConvExprPrim cenv env op + + | TOp.ILAsm([ I_isinst _ ], _), [ty], [arg] -> + let op = mkCallTypeTest cenv.g m ty arg + ConvExprPrim cenv env op + + | TOp.ILAsm ([ I_call (Normalcall, mspec, None) ], _), _, [arg] + when mspec.MethodRef.DeclaringTypeRef.Name = "System.String" && mspec.Name = "GetHashCode" -> + let ty = tyOfExpr cenv.g arg + let op = mkCallHash cenv.g m ty arg + ConvExprPrim cenv env op + + | TOp.ILCall(_, _, _, _, _, _, _, mref, _, _, _), [], + [Expr.Op(TOp.ILAsm([ I_ldtoken (ILToken.ILType _) ], _), [ty], _, _)] + when mref.DeclaringTypeRef.Name = "System.Type" && mref.Name = "GetTypeFromHandle" -> + let op = mkCallTypeOf cenv.g m ty + ConvExprPrim cenv env op + + | TOp.ILAsm([ EI_ilzero _ ], _), [ty], _ -> + E.DefaultValue (ConvType cenv ty) + + | TOp.ILAsm([ AI_ldnull; AI_cgt_un ], _), _, [arg] -> + let elemTy = tyOfExpr cenv.g arg + let nullVal = mkNull m elemTy + let op = mkCallNotEqualsOperator cenv.g m elemTy arg nullVal + ConvExprPrim cenv env op + + | TOp.ILAsm([ I_ldlen; AI_conv DT_I4 ], _), _, [arr] -> + let arrayTy = tyOfExpr cenv.g arr + let elemTy = destArrayTy cenv.g arrayTy + let op = mkCallArrayLength cenv.g m elemTy arr + ConvExprPrim cenv env op + + | TOp.ILAsm([ I_newarr (ILArrayShape [(Some 0, None)], _)], _), [elemTy], xa -> + E.NewArray(ConvType cenv elemTy, ConvExprs cenv env xa) + + | TOp.ILAsm([ I_ldelem_any (ILArrayShape [(Some 0, None)], _)], _), [elemTy], [arr; idx1] -> + let op = mkCallArrayGet cenv.g m elemTy arr idx1 + ConvExprPrim cenv env op + + | TOp.ILAsm([ I_stelem_any (ILArrayShape [(Some 0, None)], _)], _), [elemTy], [arr; idx1; v] -> + let op = mkCallArraySet cenv.g m elemTy arr idx1 v + ConvExprPrim cenv env op + + | TOp.ILAsm([ ILUnaryOp unaryOp ], _), _, [arg] -> + let ty = tyOfExpr cenv.g arg + let op = unaryOp cenv.g m ty arg + ConvExprPrim cenv env op + + | TOp.ILAsm([ ILBinaryOp binaryOp ], _), _, [arg1;arg2] -> let ty = tyOfExpr cenv.g arg1 - let eq = mkCallEqualsOperator cenv.g m ty arg1 arg2 - ConvExprPrim cenv env eq + let op = binaryOp cenv.g m ty arg1 arg2 + ConvExprPrim cenv env op + + | TOp.ILAsm([ ILConvertOp convertOp1; ILConvertOp convertOp2 ], _), _, [arg] -> + let ty1 = tyOfExpr cenv.g arg + let op1 = convertOp1 cenv.g m ty1 arg + let ty2 = tyOfExpr cenv.g op1 + let op2 = convertOp2 cenv.g m ty2 op1 + ConvExprPrim cenv env op2 + + | TOp.ILAsm([ ILConvertOp convertOp ], [TType_app (tcref,_)]), _, [arg] -> + let ty = tyOfExpr cenv.g arg + let op = + if tyconRefEq cenv.g tcref cenv.g.char_tcr + then mkCallToCharOperator cenv.g m ty arg + else convertOp cenv.g m ty arg + ConvExprPrim cenv env op | TOp.ILAsm([ I_throw ], _), _, [arg1] -> let raiseExpr = mkCallRaise cenv.g m (tyOfExpr cenv.g expr) arg1 @@ -603,17 +773,18 @@ module FSharpExprConvert = | TOp.While _, [], [Expr.Lambda(_, _, _, [_], test, _, _);Expr.Lambda(_, _, _, [_], body, _, _)] -> E.WhileLoop(ConvExpr cenv env test, ConvExpr cenv env body) - | TOp.For(_, (FSharpForLoopUp |FSharpForLoopDown as dir) ), [], [Expr.Lambda(_, _, _, [_], lim0, _, _); Expr.Lambda(_, _, _, [_], SimpleArrayLoopUpperBound, lm, _); SimpleArrayLoopBody cenv.g (arr, elemTy, body)] -> + | TOp.For(_, dir), [], [Expr.Lambda(_, _, _, [_], lim0, _, _); Expr.Lambda(_, _, _, [_], SimpleArrayLoopUpperBound, lm, _); SimpleArrayLoopBody cenv.g (arr, elemTy, body)] -> let lim1 = let len = mkCallArrayLength cenv.g lm elemTy arr // Array.length arr - mkCallSubtractionOperator cenv.g lm cenv.g.int32_ty len (Expr.Const(Const.Int32 1, m, cenv.g.int32_ty)) // len - 1 - E.FastIntegerForLoop(ConvExpr cenv env lim0, ConvExpr cenv env lim1, ConvExpr cenv env body, (dir = FSharpForLoopUp)) - - | TOp.For(_, dir), [], [Expr.Lambda(_, _, _, [_], lim0, _, _);Expr.Lambda(_, _, _, [_], lim1, _, _);body] -> - match dir with - | FSharpForLoopUp -> E.FastIntegerForLoop(ConvExpr cenv env lim0, ConvExpr cenv env lim1, ConvExpr cenv env body, true) - | FSharpForLoopDown -> E.FastIntegerForLoop(ConvExpr cenv env lim0, ConvExpr cenv env lim1, ConvExpr cenv env body, false) - | _ -> failwith "unexpected for-loop form" + mkCallSubtractionOperator cenv.g lm cenv.g.int32_ty len (mkOne cenv.g lm) // len - 1 + E.FastIntegerForLoop(ConvExpr cenv env lim0, ConvExpr cenv env lim1, ConvExpr cenv env body, dir <> FSharpForLoopDown) + + | TOp.For(_, dir), [], [Expr.Lambda(_, _, _, [_], lim0, _, _); Expr.Lambda(_, _, _, [_], lim1, lm, _); body] -> + let lim1 = + if dir = CSharpForLoopUp then + mkCallSubtractionOperator cenv.g lm cenv.g.int32_ty lim1 (mkOne cenv.g lm) // len - 1 + else lim1 + E.FastIntegerForLoop(ConvExpr cenv env lim0, ConvExpr cenv env lim1, ConvExpr cenv env body, dir <> FSharpForLoopDown) | TOp.ILCall(_, _, _, isNewObj, valUseFlags, _isProp, _, ilMethRef, enclTypeArgs, methTypeArgs, _tys), [], callArgs -> ConvILCall cenv env (isNewObj, valUseFlags, ilMethRef, enclTypeArgs, methTypeArgs, callArgs, m) diff --git a/tests/service/Common.fs b/tests/service/Common.fs index e3378e77b43..b00ab51e5db 100644 --- a/tests/service/Common.fs +++ b/tests/service/Common.fs @@ -112,7 +112,7 @@ let mkStandardProjectReferences () = yield fsCoreDefaultReference() ] #endif -let mkProjectCommandLineArgs (dllName, fileNames) = +let mkProjectCommandLineArgsSilent (dllName, fileNames) = let args = [| yield "--simpleresolution" yield "--noframework" @@ -134,6 +134,10 @@ let mkProjectCommandLineArgs (dllName, fileNames) = for r in references do yield "-r:" + r |] + args + +let mkProjectCommandLineArgs (dllName, fileNames) = + let args = mkProjectCommandLineArgsSilent (dllName, fileNames) printfn "dllName = %A, args = %A" dllName args args diff --git a/tests/service/ExprTests.fs b/tests/service/ExprTests.fs index 5eea4c1a6e1..1d3e9675b12 100644 --- a/tests/service/ExprTests.fs +++ b/tests/service/ExprTests.fs @@ -96,6 +96,33 @@ module internal Utils = and printIimpls iis = String.concat ";" (List.map printImlementation iis) and printImlementation (i, ors) = "interface " + printTy i + " with " + printOverrides ors + let rec printFSharpDecls prefix decls = + seq { + let mutable i = 0 + for decl in decls do + i <- i + 1 + match decl with + | FSharpImplementationFileDeclaration.Entity (e, sub) -> + yield sprintf "%s%i) ENTITY: %s %A" prefix i e.CompiledName (attribsOfSymbol e) + if not (Seq.isEmpty e.Attributes) then + yield sprintf "%sattributes: %A" prefix (Seq.toList e.Attributes) + if not (Seq.isEmpty e.DeclaredInterfaces) then + yield sprintf "%sinterfaces: %A" prefix (Seq.toList e.DeclaredInterfaces) + yield "" + yield! printFSharpDecls (prefix + "\t") sub + | FSharpImplementationFileDeclaration.MemberOrFunctionOrValue (meth, args, body) -> + yield sprintf "%s%i) METHOD: %s %A" prefix i meth.CompiledName (attribsOfSymbol meth) + yield sprintf "%stype: %A" prefix meth.FullType + yield sprintf "%sargs: %A" prefix args + // if not meth.IsCompilerGenerated then + yield sprintf "%sbody: %A" prefix body + yield "" + | FSharpImplementationFileDeclaration.InitAction (expr) -> + yield sprintf "%s%i) ACTION" prefix i + yield sprintf "%s%A" prefix expr + yield "" + } + let rec printDeclaration (excludes:HashSet<_> option) (d: FSharpImplementationFileDeclaration) = seq { match d with @@ -283,7 +310,7 @@ let localGenericFunctionExample() = let funcEx1 (x:int) = x let genericFuncEx1 (x:'T) = x let (topPair1a, topPair1b) = (1,2) -let tyfuncEx1<'T> = typeof<'T> + let testILCall1 = new obj() let testILCall2 = System.Console.WriteLine("176") @@ -517,20 +544,89 @@ module N type IntAbbrev = int - let bool2 = false +let testHashChar (x:char) = hash x +let testHashSByte (x:sbyte) = hash x +let testHashInt16 (x:int16) = hash x +let testHashInt64 (x:int64) = hash x +let testHashUInt64 (x:uint64) = hash x +let testHashIntPtr (x:nativeint) = hash x +let testHashUIntPtr (x:unativeint) = hash x + +let testHashString (x:string) = hash x +let testTypeOf (x:'T) = typeof<'T> + """ + File.WriteAllText(fileName2, fileSource2) let fileNames = [fileName1; fileName2] let args = mkProjectCommandLineArgs (dllName, fileNames) let options = checker.GetProjectOptionsFromCommandLineArgs (projFileName, args) + let operatorTests = """ +module OperatorTests{0} + +let test{0}EqualsOperator (e1:{1}) (e2:{1}) = (=) e1 e2 +let test{0}NotEqualsOperator (e1:{1}) (e2:{1}) = (<>) e1 e2 +let test{0}LessThanOperator (e1:{1}) (e2:{1}) = (<) e1 e2 +let test{0}LessThanOrEqualsOperator (e1:{1}) (e2:{1}) = (<=) e1 e2 +let test{0}GreaterThanOperator (e1:{1}) (e2:{1}) = (>) e1 e2 +let test{0}GreaterThanOrEqualsOperator (e1:{1}) (e2:{1}) = (>=) e1 e2 + +let test{0}AdditionOperator (e1:{1}) (e2:{1}) = (+) e1 e2 +let test{0}SubtractionOperator (e1:{1}) (e2:{1}) = (-) e1 e2 +let test{0}MultiplyOperator (e1:{1}) (e2:{1}) = (*) e1 e2 +let test{0}DivisionOperator (e1:{1}) (e2:{1}) = (/) e1 e2 +let test{0}ModulusOperator (e1:{1}) (e2:{1}) = (%) e1 e2 +let test{0}BitwiseAndOperator (e1:{1}) (e2:{1}) = (&&&) e1 e2 +let test{0}BitwiseOrOperator (e1:{1}) (e2:{1}) = (|||) e1 e2 +let test{0}BitwiseXorOperator (e1:{1}) (e2:{1}) = (^^^) e1 e2 +let test{0}ShiftLeftOperator (e1:{1}) (e2:int) = (<<<) e1 e2 +let test{0}ShiftRightOperator (e1:{1}) (e2:int) = (>>>) e1 e2 + +let test{0}UnaryNegOperator (e1:{1}) = (~-) e1 + +let test{0}AdditionChecked (e1:{1}) (e2:{1}) = Checked.(+) e1 e2 +let test{0}SubtractionChecked (e1:{1}) (e2:{1}) = Checked.(-) e1 e2 +let test{0}MultiplyChecked (e1:{1}) (e2:{1}) = Checked.(*) e1 e2 +let test{0}UnaryNegChecked (e1:{1}) = Checked.(~-) e1 + +let test{0}ToByteChecked (e1:{1}) = Checked.byte e1 +let test{0}ToSByteChecked (e1:{1}) = Checked.sbyte e1 +let test{0}ToInt16Checked (e1:{1}) = Checked.int16 e1 +let test{0}ToUInt16Checked (e1:{1}) = Checked.uint16 e1 +let test{0}ToIntChecked (e1:{1}) = Checked.int e1 +let test{0}ToInt32Checked (e1:{1}) = Checked.int32 e1 +let test{0}ToUInt32Checked (e1:{1}) = Checked.uint32 e1 +let test{0}ToInt64Checked (e1:{1}) = Checked.int64 e1 +let test{0}ToUInt64Checked (e1:{1}) = Checked.uint64 e1 +let test{0}ToIntPtrChecked (e1:{1}) = Checked.nativeint e1 +let test{0}ToUIntPtrChecked (e1:{1}) = Checked.unativeint e1 + +let test{0}ToByteOperator (e1:{1}) = byte e1 +let test{0}ToSByteOperator (e1:{1}) = sbyte e1 +let test{0}ToInt16Operator (e1:{1}) = int16 e1 +let test{0}ToUInt16Operator (e1:{1}) = uint16 e1 +let test{0}ToIntOperator (e1:{1}) = int e1 +let test{0}ToInt32Operator (e1:{1}) = int32 e1 +let test{0}ToUInt32Operator (e1:{1}) = uint32 e1 +let test{0}ToInt64Operator (e1:{1}) = int64 e1 +let test{0}ToUInt64Operator (e1:{1}) = uint64 e1 +let test{0}ToIntPtrOperator (e1:{1}) = nativeint e1 +let test{0}ToUIntPtrOperator (e1:{1}) = unativeint e1 +let test{0}ToSingleOperator (e1:{1}) = float32 e1 +let test{0}ToDoubleOperator (e1:{1}) = float e1 +let test{0}ToDecimalOperator (e1:{1}) = decimal e1 +let test{0}ToCharOperator (e1:{1}) = char e1 +let test{0}ToStringOperator (e1:{1}) = string e1 + +""" + //<@ let x = Some(3) in x.IsSome @> -#if !NO_EXTENSIONTYPING [] -let ``Test Declarations project1`` () = +let ``Test Unoptimized Declarations Project1`` () = let wholeProjectResults = exprChecker.ParseAndCheckProject(Project1.options) |> Async.RunSynchronously for e in wholeProjectResults.Errors do @@ -553,102 +649,2011 @@ let ``Test Declarations project1`` () = s.Replace("ILArrayShape [(Some 0, None)]", "ILArrayShapeFIX") .Replace("ILArrayShape [(Some 0, null)]", "ILArrayShapeFIX")) - let expected = - ["type M"; "type IntAbbrev"; "let boolEx1 = True @ (6,14--6,18)"; - "let intEx1 = 1 @ (7,13--7,14)"; "let int64Ex1 = 1 @ (8,15--8,17)"; - "let tupleEx1 = (1,1) @ (9,16--9,21)"; - "let tupleEx2 = (1,1,1) @ (10,16--10,25)"; - "let tupleEx3 = (1,1,1,1) @ (11,16--11,29)"; - "let localExample = let y: Microsoft.FSharp.Core.int = 1 in let z: Microsoft.FSharp.Core.int = 1 in (y,z) @ (14,7--14,8)"; - "let localGenericFunctionExample(unitVar0) = let y: Microsoft.FSharp.Core.int = 1 in let compiledAsLocalGenericFunction: 'a -> 'a = FUN ... -> fun x -> x in (compiledAsLocalGenericFunction y,compiledAsLocalGenericFunction 1) @ (19,7--19,8)"; - "let funcEx1(x) = x @ (23,23--23,24)"; - "let genericFuncEx1(x) = x @ (24,29--24,30)"; - "let topPair1b = M.patternInput@25 ().Item1 @ (25,4--25,26)"; - "let topPair1a = M.patternInput@25 ().Item0 @ (25,4--25,26)"; - "let tyfuncEx1 = Operators.TypeOf<'T> () @ (26,20--26,26)"; - "let testILCall1 = new Object() @ (27,18--27,27)"; - "let testILCall2 = Console.WriteLine (\"176\") @ (28,18--28,49)"; - "let recValNeverUsedAtRuntime = recValNeverUsedAtRuntime@31.Force(()) @ (31,8--31,32)"; - "let recFuncIgnoresFirstArg(g) (v) = v @ (32,33--32,34)"; - "let testFun4(unitVar0) = let rec ... in recValNeverUsedAtRuntime @ (36,4--39,28)"; - "type ClassWithImplicitConstructor"; - "member .ctor(compiledAsArg) = (new Object(); (this.compiledAsArg <- compiledAsArg; (this.compiledAsField <- 1; let compiledAsLocal: Microsoft.FSharp.Core.int = 1 in let compiledAsLocal2: Microsoft.FSharp.Core.int = Operators.op_Addition (compiledAsLocal,compiledAsLocal) in ()))) @ (41,5--41,33)"; - "member .cctor(unitVar) = (compiledAsStaticField <- 1; let compiledAsStaticLocal: Microsoft.FSharp.Core.int = 1 in let compiledAsStaticLocal2: Microsoft.FSharp.Core.int = Operators.op_Addition (compiledAsStaticLocal,compiledAsStaticLocal) in ()) @ (49,11--49,40)"; - "member M1(__) (unitVar1) = Operators.op_Addition (Operators.op_Addition (__.compiledAsField,let x: Microsoft.FSharp.Core.int = __.compiledAsField in __.compiledAsGenericInstanceMethod(x)),__.compiledAsArg) @ (55,21--55,102)"; - "member M2(__) (unitVar1) = __.compiledAsInstanceMethod(()) @ (56,21--56,47)"; - "member SM1(unitVar0) = Operators.op_Addition (compiledAsStaticField,let x: Microsoft.FSharp.Core.int = compiledAsStaticField in ClassWithImplicitConstructor.compiledAsGenericStaticMethod (x)) @ (57,26--57,101)"; - "member SM2(unitVar0) = ClassWithImplicitConstructor.compiledAsStaticMethod (()) @ (58,26--58,50)"; - "member ToString(__) (unitVar1) = Operators.op_Addition (base.ToString(),Operators.ToString (999)) @ (59,29--59,57)"; - "member TestCallinToString(this) (unitVar1) = this.ToString() @ (60,39--60,54)"; - "type Error"; "let err = {Data0 = 3; Data1 = 4} @ (64,10--64,20)"; - "let matchOnException(err) = match (if err :? M.Error then $0 else $1) targets ... @ (66,33--66,36)"; - "let upwardForLoop(unitVar0) = let mutable a: Microsoft.FSharp.Core.int = 1 in (for-loop; a) @ (69,16--69,17)"; - "let upwardForLoop2(unitVar0) = let mutable a: Microsoft.FSharp.Core.int = 1 in (for-loop; a) @ (74,16--74,17)"; - "let downwardForLoop(unitVar0) = let mutable a: Microsoft.FSharp.Core.int = 1 in (for-loop; a) @ (79,16--79,17)"; - "let quotationTest1(unitVar0) = quote(Operators.op_Addition (1,1)) @ (83,24--83,35)"; - "let quotationTest2(v) = quote(Operators.op_Addition (ExtraTopLevelOperators.SpliceExpression (v),1)) @ (84,24--84,36)"; - "type RecdType"; "type UnionType"; "type ClassWithEventsAndProperties"; - "member .ctor(unitVar0) = (new Object(); (this.ev <- new FSharpEvent`1(()); ())) @ (89,5--89,33)"; - "member .cctor(unitVar) = (sev <- new FSharpEvent`1(()); ()) @ (91,11--91,35)"; - "member get_InstanceProperty(x) (unitVar1) = (x.ev.Trigger(1); 1) @ (92,32--92,48)"; - "member get_StaticProperty(unitVar0) = (sev.Trigger(1); 1) @ (93,35--93,52)"; - "member get_InstanceEvent(x) (unitVar1) = x.ev.get_Publish(()) @ (94,29--94,39)"; - "member get_StaticEvent(x) (unitVar1) = sev.get_Publish(()) @ (95,27--95,38)"; - "let c = new ClassWithEventsAndProperties(()) @ (97,8--97,38)"; - "let v = M.c ().get_InstanceProperty(()) @ (98,8--98,26)"; - "do Console.WriteLine (\"777\")"; - "let functionWithSubmsumption(x) = IntrinsicFunctions.UnboxGeneric (x) @ (102,40--102,52)"; - "let functionWithCoercion(x) = Operators.op_PipeRight (Operators.op_PipeRight (IntrinsicFunctions.UnboxGeneric (x :> Microsoft.FSharp.Core.obj),fun x -> M.functionWithSubmsumption (x :> Microsoft.FSharp.Core.obj)),fun x -> M.functionWithSubmsumption (x :> Microsoft.FSharp.Core.obj)) @ (103,39--103,116)"; - "type MultiArgMethods"; - "member .ctor(c,d) = (new Object(); ()) @ (105,5--105,20)"; - "member Method(x) (a,b) = 1 @ (106,37--106,38)"; - "member CurriedMethod(x) (a1,b1) (a2,b2) = 1 @ (107,63--107,64)"; - "let testFunctionThatCallsMultiArgMethods(unitVar0) = let m: M.MultiArgMethods = new MultiArgMethods(3,4) in Operators.op_Addition (m.Method(7,8),fun tupledArg -> let arg00: Microsoft.FSharp.Core.int = tupledArg.Item0 in let arg01: Microsoft.FSharp.Core.int = tupledArg.Item1 in fun tupledArg -> let arg10: Microsoft.FSharp.Core.int = tupledArg.Item0 in let arg11: Microsoft.FSharp.Core.int = tupledArg.Item1 in m.CurriedMethod(arg00,arg01,arg10,arg11) (9,10) (11,12)) @ (110,8--110,9)"; - "let functionThatUsesObjectExpression(unitVar0) = { new Object() with member x.ToString(unitVar1) = Operators.ToString (888) } @ (114,3--114,55)"; - "let functionThatUsesObjectExpressionWithInterfaceImpl(unitVar0) = { new Object() with member x.ToString(unitVar1) = Operators.ToString (888) interface System.IComparable with member x.CompareTo(y) = 0 } :> System.IComparable @ (117,3--120,38)"; - "let testFunctionThatUsesUnitsOfMeasure(x) (y) = Operators.op_Addition,Microsoft.FSharp.Core.float<'u>,Microsoft.FSharp.Core.float<'u>> (x,y) @ (122,70--122,75)"; - "let testFunctionThatUsesAddressesAndByrefs(x) = let mutable w: Microsoft.FSharp.Core.int = 4 in let y1: Microsoft.FSharp.Core.byref = x in let y2: Microsoft.FSharp.Core.byref = &w in let arr: Microsoft.FSharp.Core.int Microsoft.FSharp.Core.[] = [|3; 4|] in let r: Microsoft.FSharp.Core.int Microsoft.FSharp.Core.ref = Operators.Ref (3) in let y3: Microsoft.FSharp.Core.byref = [I_ldelema (NormalAddress,false,ILArrayShape [(Some 0, None)],TypeVar 0us)](arr,0) in let y4: Microsoft.FSharp.Core.byref = &r.contents in let z: Microsoft.FSharp.Core.int = Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (x,y1),y2),y3) in (w <- 3; (x <- 4; (y2 <- 4; (y3 <- 5; Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (z,x),y1),y2),y3),y4),IntrinsicFunctions.GetArray (arr,0)),r.contents))))) @ (125,16--125,17)"; - "let testFunctionThatUsesStructs1(dt) = dt.AddDays(3) @ (139,57--139,72)"; - "let testFunctionThatUsesStructs2(unitVar0) = let dt1: System.DateTime = DateTime.get_Now () in let mutable dt2: System.DateTime = DateTime.get_Now () in let dt3: System.TimeSpan = Operators.op_Subtraction (dt1,dt2) in let dt4: System.DateTime = dt1.AddDays(3) in let dt5: Microsoft.FSharp.Core.int = dt1.get_Millisecond() in let dt6: Microsoft.FSharp.Core.byref = &dt2 in let dt7: System.TimeSpan = Operators.op_Subtraction (dt6,dt4) in dt7 @ (142,7--142,10)"; - "let testFunctionThatUsesWhileLoop(unitVar0) = let mutable x: Microsoft.FSharp.Core.int = 1 in (while Operators.op_LessThan (x,100) do x <- Operators.op_Addition (x,1) done; x) @ (152,15--152,16)"; - "let testFunctionThatUsesTryWith(unitVar0) = try M.testFunctionThatUsesWhileLoop (()) with matchValue -> match (if matchValue :? System.ArgumentException then $0 else $1) targets ... @ (158,3--160,60)"; - "let testFunctionThatUsesTryFinally(unitVar0) = try M.testFunctionThatUsesWhileLoop (()) finally Console.WriteLine (\"8888\") @ (164,3--167,37)"; - "member Console.WriteTwoLines.Static(unitVar0) = (Console.WriteLine (); Console.WriteLine ()) @ (170,36--170,90)"; - "member DateTime.get_TwoMinute(x) (unitVar1) = Operators.op_Addition (x.get_Minute(),x.get_Minute()) @ (173,25--173,44)"; - "let testFunctionThatUsesExtensionMembers(unitVar0) = (M.Console.WriteTwoLines.Static (()); let v: Microsoft.FSharp.Core.int = DateTime.get_Now ().DateTime.get_TwoMinute(()) in M.Console.WriteTwoLines.Static (())) @ (176,3--178,33)"; - "let testFunctionThatUsesOptionMembers(unitVar0) = let x: Microsoft.FSharp.Core.int Microsoft.FSharp.Core.option = Some(3) in (x.get_IsSome() (),x.get_IsNone() ()) @ (181,7--181,8)"; - "let testFunctionThatUsesOverAppliedFunction(unitVar0) = Operators.Identity Microsoft.FSharp.Core.int> (fun x -> Operators.Identity (x)) 3 @ (185,3--185,10)"; - "let testFunctionThatUsesPatternMatchingOnLists(x) = match (if x.Isop_ColonColon then (if x.Tail.Isop_ColonColon then (if x.Tail.Tail.Isop_Nil then $2 else $3) else $1) else $0) targets ... @ (188,10--188,11)"; - "let testFunctionThatUsesPatternMatchingOnOptions(x) = match (if x.IsSome then $1 else $0) targets ... @ (195,10--195,11)"; - "let testFunctionThatUsesPatternMatchingOnOptions2(x) = match (if x.IsSome then $1 else $0) targets ... @ (200,10--200,11)"; - "let testFunctionThatUsesConditionalOnOptions2(x) = (if x.get_IsSome() () then 1 else 2) @ (205,4--205,29)"; - "let f(x) (y) = Operators.op_Addition (x,y) @ (207,12--207,15)"; - "let g = let x: Microsoft.FSharp.Core.int = 1 in fun y -> M.f (x,y) @ (208,8--208,11)"; - "let h = Operators.op_Addition (M.g () 2,3) @ (209,8--209,17)"; - "type TestFuncProp"; - "member .ctor(unitVar0) = (new Object(); ()) @ (211,5--211,17)"; - "member get_Id(this) (unitVar1) = fun x -> x @ (212,21--212,31)"; - "let wrong = Operators.op_Equality (new TestFuncProp(()).get_Id(()) 0,0) @ (214,12--214,35)"; - "let start(name) = (name,name) @ (217,4--217,14)"; - "let last(name,values) = Operators.Identity ((name,values)) @ (220,4--220,21)"; - "let last2(name) = Operators.Identity (name) @ (223,4--223,11)"; - "let test7(s) = Operators.op_PipeRight (M.start (s),fun tupledArg -> let name: Microsoft.FSharp.Core.string = tupledArg.Item0 in let values: Microsoft.FSharp.Core.string = tupledArg.Item1 in M.last (name,values)) @ (226,4--226,19)"; - "let test8(unitVar0) = fun tupledArg -> let name: Microsoft.FSharp.Core.string = tupledArg.Item0 in let values: Microsoft.FSharp.Core.string = tupledArg.Item1 in M.last (name,values) @ (229,4--229,8)"; - "let test9(s) = Operators.op_PipeRight ((s,s),fun tupledArg -> let name: Microsoft.FSharp.Core.string = tupledArg.Item0 in let values: Microsoft.FSharp.Core.string = tupledArg.Item1 in M.last (name,values)) @ (232,4--232,17)"; - "let test10(unitVar0) = fun name -> M.last2 (name) @ (235,4--235,9)"; - "let test11(s) = Operators.op_PipeRight (s,fun name -> M.last2 (name)) @ (238,4--238,14)"; - "let badLoop = badLoop@240.Force Microsoft.FSharp.Core.int>(()) @ (240,8--240,15)"; - "type LetLambda"; - "let f = ((); fun a -> fun b -> Operators.op_Addition (a,b)) @ (246,8--247,24)"; - "let letLambdaRes = Operators.op_PipeRight<(Microsoft.FSharp.Core.int * Microsoft.FSharp.Core.int) Microsoft.FSharp.Collections.list,Microsoft.FSharp.Core.int Microsoft.FSharp.Collections.list> (Cons((1,2),Empty()),let mapping: Microsoft.FSharp.Core.int * Microsoft.FSharp.Core.int -> Microsoft.FSharp.Core.int = fun tupledArg -> let a: Microsoft.FSharp.Core.int = tupledArg.Item0 in let b: Microsoft.FSharp.Core.int = tupledArg.Item1 in (LetLambda.f () a) b in fun list -> ListModule.Map (mapping,list)) @ (249,19--249,71)"] + let expected = [ + "type M"; "type IntAbbrev"; "let boolEx1 = True @ (6,14--6,18)"; + "let intEx1 = 1 @ (7,13--7,14)"; "let int64Ex1 = 1 @ (8,15--8,17)"; + "let tupleEx1 = (1,1) @ (9,16--9,21)"; + "let tupleEx2 = (1,1,1) @ (10,16--10,25)"; + "let tupleEx3 = (1,1,1,1) @ (11,16--11,29)"; + "let localExample = let y: Microsoft.FSharp.Core.int = 1 in let z: Microsoft.FSharp.Core.int = 1 in (y,z) @ (14,7--14,8)"; + "let localGenericFunctionExample(unitVar0) = let y: Microsoft.FSharp.Core.int = 1 in let compiledAsLocalGenericFunction: 'a -> 'a = FUN ... -> fun x -> x in (compiledAsLocalGenericFunction y,compiledAsLocalGenericFunction 1) @ (19,7--19,8)"; + "let funcEx1(x) = x @ (23,23--23,24)"; + "let genericFuncEx1(x) = x @ (24,29--24,30)"; + "let topPair1b = M.patternInput@25 ().Item1 @ (25,4--25,26)"; + "let topPair1a = M.patternInput@25 ().Item0 @ (25,4--25,26)"; + "let testILCall1 = new Object() @ (27,18--27,27)"; + "let testILCall2 = Console.WriteLine (\"176\") @ (28,18--28,49)"; + "let recValNeverUsedAtRuntime = recValNeverUsedAtRuntime@31.Force(()) @ (31,8--31,32)"; + "let recFuncIgnoresFirstArg(g) (v) = v @ (32,33--32,34)"; + "let testFun4(unitVar0) = let rec ... in recValNeverUsedAtRuntime @ (36,4--39,28)"; + "type ClassWithImplicitConstructor"; + "member .ctor(compiledAsArg) = (new Object(); (this.compiledAsArg <- compiledAsArg; (this.compiledAsField <- 1; let compiledAsLocal: Microsoft.FSharp.Core.int = 1 in let compiledAsLocal2: Microsoft.FSharp.Core.int = Operators.op_Addition (compiledAsLocal,compiledAsLocal) in ()))) @ (41,5--41,33)"; + "member .cctor(unitVar) = (compiledAsStaticField <- 1; let compiledAsStaticLocal: Microsoft.FSharp.Core.int = 1 in let compiledAsStaticLocal2: Microsoft.FSharp.Core.int = Operators.op_Addition (compiledAsStaticLocal,compiledAsStaticLocal) in ()) @ (49,11--49,40)"; + "member M1(__) (unitVar1) = Operators.op_Addition (Operators.op_Addition (__.compiledAsField,let x: Microsoft.FSharp.Core.int = __.compiledAsField in __.compiledAsGenericInstanceMethod(x)),__.compiledAsArg) @ (55,21--55,102)"; + "member M2(__) (unitVar1) = __.compiledAsInstanceMethod(()) @ (56,21--56,47)"; + "member SM1(unitVar0) = Operators.op_Addition (compiledAsStaticField,let x: Microsoft.FSharp.Core.int = compiledAsStaticField in ClassWithImplicitConstructor.compiledAsGenericStaticMethod (x)) @ (57,26--57,101)"; + "member SM2(unitVar0) = ClassWithImplicitConstructor.compiledAsStaticMethod (()) @ (58,26--58,50)"; + "member ToString(__) (unitVar1) = Operators.op_Addition (base.ToString(),Operators.ToString (999)) @ (59,29--59,57)"; + "member TestCallinToString(this) (unitVar1) = this.ToString() @ (60,39--60,54)"; + "type Error"; "let err = {Data0 = 3; Data1 = 4} @ (64,10--64,20)"; + "let matchOnException(err) = match (if err :? M.Error then $0 else $1) targets ... @ (66,33--66,36)"; + "let upwardForLoop(unitVar0) = let mutable a: Microsoft.FSharp.Core.int = 1 in (for-loop; a) @ (69,16--69,17)"; + "let upwardForLoop2(unitVar0) = let mutable a: Microsoft.FSharp.Core.int = 1 in (for-loop; a) @ (74,16--74,17)"; + "let downwardForLoop(unitVar0) = let mutable a: Microsoft.FSharp.Core.int = 1 in (for-loop; a) @ (79,16--79,17)"; + "let quotationTest1(unitVar0) = quote(Operators.op_Addition (1,1)) @ (83,24--83,35)"; + "let quotationTest2(v) = quote(Operators.op_Addition (ExtraTopLevelOperators.SpliceExpression (v),1)) @ (84,24--84,36)"; + "type RecdType"; "type UnionType"; "type ClassWithEventsAndProperties"; + "member .ctor(unitVar0) = (new Object(); (this.ev <- new FSharpEvent`1(()); ())) @ (89,5--89,33)"; + "member .cctor(unitVar) = (sev <- new FSharpEvent`1(()); ()) @ (91,11--91,35)"; + "member get_InstanceProperty(x) (unitVar1) = (x.ev.Trigger(1); 1) @ (92,32--92,48)"; + "member get_StaticProperty(unitVar0) = (sev.Trigger(1); 1) @ (93,35--93,52)"; + "member get_InstanceEvent(x) (unitVar1) = x.ev.get_Publish(()) @ (94,29--94,39)"; + "member get_StaticEvent(x) (unitVar1) = sev.get_Publish(()) @ (95,27--95,38)"; + "let c = new ClassWithEventsAndProperties(()) @ (97,8--97,38)"; + "let v = M.c ().get_InstanceProperty(()) @ (98,8--98,26)"; + "do Console.WriteLine (\"777\")"; + "let functionWithSubmsumption(x) = IntrinsicFunctions.UnboxGeneric (x) @ (102,40--102,52)"; + "let functionWithCoercion(x) = Operators.op_PipeRight (Operators.op_PipeRight (IntrinsicFunctions.UnboxGeneric (x :> Microsoft.FSharp.Core.obj),fun x -> M.functionWithSubmsumption (x :> Microsoft.FSharp.Core.obj)),fun x -> M.functionWithSubmsumption (x :> Microsoft.FSharp.Core.obj)) @ (103,39--103,116)"; + "type MultiArgMethods"; + "member .ctor(c,d) = (new Object(); ()) @ (105,5--105,20)"; + "member Method(x) (a,b) = 1 @ (106,37--106,38)"; + "member CurriedMethod(x) (a1,b1) (a2,b2) = 1 @ (107,63--107,64)"; + "let testFunctionThatCallsMultiArgMethods(unitVar0) = let m: M.MultiArgMethods = new MultiArgMethods(3,4) in Operators.op_Addition (m.Method(7,8),fun tupledArg -> let arg00: Microsoft.FSharp.Core.int = tupledArg.Item0 in let arg01: Microsoft.FSharp.Core.int = tupledArg.Item1 in fun tupledArg -> let arg10: Microsoft.FSharp.Core.int = tupledArg.Item0 in let arg11: Microsoft.FSharp.Core.int = tupledArg.Item1 in m.CurriedMethod(arg00,arg01,arg10,arg11) (9,10) (11,12)) @ (110,8--110,9)"; + "let functionThatUsesObjectExpression(unitVar0) = { new Object() with member x.ToString(unitVar1) = Operators.ToString (888) } @ (114,3--114,55)"; + "let functionThatUsesObjectExpressionWithInterfaceImpl(unitVar0) = { new Object() with member x.ToString(unitVar1) = Operators.ToString (888) interface System.IComparable with member x.CompareTo(y) = 0 } :> System.IComparable @ (117,3--120,38)"; + "let testFunctionThatUsesUnitsOfMeasure(x) (y) = Operators.op_Addition,Microsoft.FSharp.Core.float<'u>,Microsoft.FSharp.Core.float<'u>> (x,y) @ (122,70--122,75)"; + "let testFunctionThatUsesAddressesAndByrefs(x) = let mutable w: Microsoft.FSharp.Core.int = 4 in let y1: Microsoft.FSharp.Core.byref = x in let y2: Microsoft.FSharp.Core.byref = &w in let arr: Microsoft.FSharp.Core.int Microsoft.FSharp.Core.[] = [|3; 4|] in let r: Microsoft.FSharp.Core.int Microsoft.FSharp.Core.ref = Operators.Ref (3) in let y3: Microsoft.FSharp.Core.byref = [I_ldelema (NormalAddress,false,ILArrayShape [(Some 0, None)],TypeVar 0us)](arr,0) in let y4: Microsoft.FSharp.Core.byref = &r.contents in let z: Microsoft.FSharp.Core.int = Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (x,y1),y2),y3) in (w <- 3; (x <- 4; (y2 <- 4; (y3 <- 5; Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (z,x),y1),y2),y3),y4),IntrinsicFunctions.GetArray (arr,0)),r.contents))))) @ (125,16--125,17)"; + "let testFunctionThatUsesStructs1(dt) = dt.AddDays(3) @ (139,57--139,72)"; + "let testFunctionThatUsesStructs2(unitVar0) = let dt1: System.DateTime = DateTime.get_Now () in let mutable dt2: System.DateTime = DateTime.get_Now () in let dt3: System.TimeSpan = Operators.op_Subtraction (dt1,dt2) in let dt4: System.DateTime = dt1.AddDays(3) in let dt5: Microsoft.FSharp.Core.int = dt1.get_Millisecond() in let dt6: Microsoft.FSharp.Core.byref = &dt2 in let dt7: System.TimeSpan = Operators.op_Subtraction (dt6,dt4) in dt7 @ (142,7--142,10)"; + "let testFunctionThatUsesWhileLoop(unitVar0) = let mutable x: Microsoft.FSharp.Core.int = 1 in (while Operators.op_LessThan (x,100) do x <- Operators.op_Addition (x,1) done; x) @ (152,15--152,16)"; + "let testFunctionThatUsesTryWith(unitVar0) = try M.testFunctionThatUsesWhileLoop (()) with matchValue -> match (if matchValue :? System.ArgumentException then $0 else $1) targets ... @ (158,3--160,60)"; + "let testFunctionThatUsesTryFinally(unitVar0) = try M.testFunctionThatUsesWhileLoop (()) finally Console.WriteLine (\"8888\") @ (164,3--167,37)"; + "member Console.WriteTwoLines.Static(unitVar0) = (Console.WriteLine (); Console.WriteLine ()) @ (170,36--170,90)"; + "member DateTime.get_TwoMinute(x) (unitVar1) = Operators.op_Addition (x.get_Minute(),x.get_Minute()) @ (173,25--173,44)"; + "let testFunctionThatUsesExtensionMembers(unitVar0) = (M.Console.WriteTwoLines.Static (()); let v: Microsoft.FSharp.Core.int = DateTime.get_Now ().DateTime.get_TwoMinute(()) in M.Console.WriteTwoLines.Static (())) @ (176,3--178,33)"; + "let testFunctionThatUsesOptionMembers(unitVar0) = let x: Microsoft.FSharp.Core.int Microsoft.FSharp.Core.option = Some(3) in (x.get_IsSome() (),x.get_IsNone() ()) @ (181,7--181,8)"; + "let testFunctionThatUsesOverAppliedFunction(unitVar0) = Operators.Identity Microsoft.FSharp.Core.int> (fun x -> Operators.Identity (x)) 3 @ (185,3--185,10)"; + "let testFunctionThatUsesPatternMatchingOnLists(x) = match (if x.Isop_ColonColon then (if x.Tail.Isop_ColonColon then (if x.Tail.Tail.Isop_Nil then $2 else $3) else $1) else $0) targets ... @ (188,10--188,11)"; + "let testFunctionThatUsesPatternMatchingOnOptions(x) = match (if x.IsSome then $1 else $0) targets ... @ (195,10--195,11)"; + "let testFunctionThatUsesPatternMatchingOnOptions2(x) = match (if x.IsSome then $1 else $0) targets ... @ (200,10--200,11)"; + "let testFunctionThatUsesConditionalOnOptions2(x) = (if x.get_IsSome() () then 1 else 2) @ (205,4--205,29)"; + "let f(x) (y) = Operators.op_Addition (x,y) @ (207,12--207,15)"; + "let g = let x: Microsoft.FSharp.Core.int = 1 in fun y -> M.f (x,y) @ (208,8--208,11)"; + "let h = Operators.op_Addition (M.g () 2,3) @ (209,8--209,17)"; + "type TestFuncProp"; + "member .ctor(unitVar0) = (new Object(); ()) @ (211,5--211,17)"; + "member get_Id(this) (unitVar1) = fun x -> x @ (212,21--212,31)"; + "let wrong = Operators.op_Equality (new TestFuncProp(()).get_Id(()) 0,0) @ (214,12--214,35)"; + "let start(name) = (name,name) @ (217,4--217,14)"; + "let last(name,values) = Operators.Identity ((name,values)) @ (220,4--220,21)"; + "let last2(name) = Operators.Identity (name) @ (223,4--223,11)"; + "let test7(s) = Operators.op_PipeRight (M.start (s),fun tupledArg -> let name: Microsoft.FSharp.Core.string = tupledArg.Item0 in let values: Microsoft.FSharp.Core.string = tupledArg.Item1 in M.last (name,values)) @ (226,4--226,19)"; + "let test8(unitVar0) = fun tupledArg -> let name: Microsoft.FSharp.Core.string = tupledArg.Item0 in let values: Microsoft.FSharp.Core.string = tupledArg.Item1 in M.last (name,values) @ (229,4--229,8)"; + "let test9(s) = Operators.op_PipeRight ((s,s),fun tupledArg -> let name: Microsoft.FSharp.Core.string = tupledArg.Item0 in let values: Microsoft.FSharp.Core.string = tupledArg.Item1 in M.last (name,values)) @ (232,4--232,17)"; + "let test10(unitVar0) = fun name -> M.last2 (name) @ (235,4--235,9)"; + "let test11(s) = Operators.op_PipeRight (s,fun name -> M.last2 (name)) @ (238,4--238,14)"; + "let badLoop = badLoop@240.Force Microsoft.FSharp.Core.int>(()) @ (240,8--240,15)"; + "type LetLambda"; + "let f = ((); fun a -> fun b -> Operators.op_Addition (a,b)) @ (246,8--247,24)"; + "let letLambdaRes = Operators.op_PipeRight<(Microsoft.FSharp.Core.int * Microsoft.FSharp.Core.int) Microsoft.FSharp.Collections.list,Microsoft.FSharp.Core.int Microsoft.FSharp.Collections.list> (Cons((1,2),Empty()),let mapping: Microsoft.FSharp.Core.int * Microsoft.FSharp.Core.int -> Microsoft.FSharp.Core.int = fun tupledArg -> let a: Microsoft.FSharp.Core.int = tupledArg.Item0 in let b: Microsoft.FSharp.Core.int = tupledArg.Item1 in (LetLambda.f () a) b in fun list -> ListModule.Map (mapping,list)) @ (249,19--249,71)"; + ] + + let expected2 = [ + "type N"; "type IntAbbrev"; "let bool2 = False @ (6,12--6,17)"; + "let testHashChar(x) = Operators.Hash (x) @ (8,28--8,34)"; + "let testHashSByte(x) = Operators.Hash (x) @ (9,30--9,36)"; + "let testHashInt16(x) = Operators.Hash (x) @ (10,30--10,36)"; + "let testHashInt64(x) = Operators.Hash (x) @ (11,30--11,36)"; + "let testHashUInt64(x) = Operators.Hash (x) @ (12,32--12,38)"; + "let testHashIntPtr(x) = Operators.Hash (x) @ (13,35--13,41)"; + "let testHashUIntPtr(x) = Operators.Hash (x) @ (14,37--14,43)"; + "let testHashString(x) = Operators.Hash (x) @ (16,32--16,38)"; + "let testTypeOf(x) = Operators.TypeOf<'T> () @ (17,24--17,30)"; + ] printDeclarations None (List.ofSeq file1.Declarations) |> Seq.toList |> filterHack |> shouldEqual (filterHack expected) + printDeclarations None (List.ofSeq file2.Declarations) + |> Seq.toList + |> filterHack + |> shouldEqual (filterHack expected2) + () + + +[] +let ``Test Optimized Declarations Project1`` () = + let wholeProjectResults = exprChecker.ParseAndCheckProject(Project1.options) |> Async.RunSynchronously + + for e in wholeProjectResults.Errors do + printfn "Project1 error: <<<%s>>>" e.Message + + wholeProjectResults.Errors.Length |> shouldEqual 3 // recursive value warning + wholeProjectResults.Errors.[0].Severity |> shouldEqual FSharpErrorSeverity.Warning + wholeProjectResults.Errors.[1].Severity |> shouldEqual FSharpErrorSeverity.Warning + wholeProjectResults.Errors.[2].Severity |> shouldEqual FSharpErrorSeverity.Warning + + wholeProjectResults.GetOptimizedAssemblyContents().ImplementationFiles.Length |> shouldEqual 2 + let file1 = wholeProjectResults.GetOptimizedAssemblyContents().ImplementationFiles.[0] + let file2 = wholeProjectResults.GetOptimizedAssemblyContents().ImplementationFiles.[1] + + // This behaves slightly differently on Mono versions, 'null' is printed somethimes, 'None' other times + // Presumably this is very small differences in Mono reflection causing F# printing to change behavious + // For now just disabling this test. See https://github.com/fsharp/FSharp.Compiler.Service/pull/766 + let filterHack l = + l |> List.map (fun (s:string) -> + s.Replace("ILArrayShape [(Some 0, None)]", "ILArrayShapeFIX") + .Replace("ILArrayShape [(Some 0, null)]", "ILArrayShapeFIX")) + + let expected = [ + "type M"; "type IntAbbrev"; "let boolEx1 = True @ (6,14--6,18)"; + "let intEx1 = 1 @ (7,13--7,14)"; "let int64Ex1 = 1 @ (8,15--8,17)"; + "let tupleEx1 = (1,1) @ (9,16--9,21)"; + "let tupleEx2 = (1,1,1) @ (10,16--10,25)"; + "let tupleEx3 = (1,1,1,1) @ (11,16--11,29)"; + "let localExample = let y: Microsoft.FSharp.Core.int = 1 in let z: Microsoft.FSharp.Core.int = 1 in (y,z) @ (14,7--14,8)"; + "let localGenericFunctionExample(unitVar0) = let y: Microsoft.FSharp.Core.int = 1 in let compiledAsLocalGenericFunction: 'a -> 'a = FUN ... -> fun x -> x in (compiledAsLocalGenericFunction y,compiledAsLocalGenericFunction 1) @ (19,7--19,8)"; + "let funcEx1(x) = x @ (23,23--23,24)"; + "let genericFuncEx1(x) = x @ (24,29--24,30)"; + "let topPair1b = M.patternInput@25 ().Item1 @ (25,4--25,26)"; + "let topPair1a = M.patternInput@25 ().Item0 @ (25,4--25,26)"; + "let testILCall1 = new Object() @ (27,18--27,27)"; + "let testILCall2 = Console.WriteLine (\"176\") @ (28,18--28,49)"; + "let recValNeverUsedAtRuntime = recValNeverUsedAtRuntime@31.Force(()) @ (31,8--31,32)"; + "let recFuncIgnoresFirstArg(g) (v) = v @ (32,33--32,34)"; + "let testFun4(unitVar0) = let rec ... in recValNeverUsedAtRuntime @ (36,4--39,28)"; + "type ClassWithImplicitConstructor"; + "member .ctor(compiledAsArg) = (new Object(); (this.compiledAsArg <- compiledAsArg; (this.compiledAsField <- 1; let compiledAsLocal: Microsoft.FSharp.Core.int = 1 in let compiledAsLocal2: Microsoft.FSharp.Core.int = Operators.op_Addition (compiledAsLocal,compiledAsLocal) in ()))) @ (41,5--41,33)"; + "member .cctor(unitVar) = (compiledAsStaticField <- 1; let compiledAsStaticLocal: Microsoft.FSharp.Core.int = 1 in let compiledAsStaticLocal2: Microsoft.FSharp.Core.int = Operators.op_Addition (compiledAsStaticLocal,compiledAsStaticLocal) in ()) @ (49,11--49,40)"; + "member M1(__) (unitVar1) = Operators.op_Addition (Operators.op_Addition (__.compiledAsField,__.compiledAsGenericInstanceMethod(__.compiledAsField)),__.compiledAsArg) @ (55,21--55,102)"; + "member M2(__) (unitVar1) = __.compiledAsInstanceMethod(()) @ (56,21--56,47)"; + "member SM1(unitVar0) = Operators.op_Addition (compiledAsStaticField,ClassWithImplicitConstructor.compiledAsGenericStaticMethod (compiledAsStaticField)) @ (57,26--57,101)"; + "member SM2(unitVar0) = ClassWithImplicitConstructor.compiledAsStaticMethod (()) @ (58,26--58,50)"; +#if NO_PROJECTCRACKER // proxy for COMPILER + "member ToString(__) (unitVar1) = String.Concat (base.ToString(),let value: Microsoft.FSharp.Core.int = 999 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (value) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ...) @ (59,29--59,57)"; +#else + "member ToString(__) (unitVar1) = String.Concat (base.ToString(),let x: Microsoft.FSharp.Core.int = 999 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ...) @ (59,29--59,57)"; +#endif + "member TestCallinToString(this) (unitVar1) = this.ToString() @ (60,39--60,54)"; + "type Error"; "let err = {Data0 = 3; Data1 = 4} @ (64,10--64,20)"; + "let matchOnException(err) = match (if err :? M.Error then $0 else $1) targets ... @ (66,33--66,36)"; + "let upwardForLoop(unitVar0) = let mutable a: Microsoft.FSharp.Core.int = 1 in (for-loop; a) @ (69,16--69,17)"; + "let upwardForLoop2(unitVar0) = let mutable a: Microsoft.FSharp.Core.int = 1 in (for-loop; a) @ (74,16--74,17)"; + "let downwardForLoop(unitVar0) = let mutable a: Microsoft.FSharp.Core.int = 1 in (for-loop; a) @ (79,16--79,17)"; + "let quotationTest1(unitVar0) = quote(Operators.op_Addition (1,1)) @ (83,24--83,35)"; + "let quotationTest2(v) = quote(Operators.op_Addition (ExtraTopLevelOperators.SpliceExpression (v),1)) @ (84,24--84,36)"; + "type RecdType"; "type UnionType"; "type ClassWithEventsAndProperties"; + "member .ctor(unitVar0) = (new Object(); (this.ev <- new FSharpEvent`1(()); ())) @ (89,5--89,33)"; + "member .cctor(unitVar) = (sev <- new FSharpEvent`1(()); ()) @ (91,11--91,35)"; + "member get_InstanceProperty(x) (unitVar1) = (x.ev.Trigger(1); 1) @ (92,32--92,48)"; + "member get_StaticProperty(unitVar0) = (sev.Trigger(1); 1) @ (93,35--93,52)"; + "member get_InstanceEvent(x) (unitVar1) = x.ev.get_Publish(()) @ (94,29--94,39)"; + "member get_StaticEvent(x) (unitVar1) = sev.get_Publish(()) @ (95,27--95,38)"; + "let c = new ClassWithEventsAndProperties(()) @ (97,8--97,38)"; + "let v = M.c ().get_InstanceProperty(()) @ (98,8--98,26)"; + "do Console.WriteLine (\"777\")"; + "let functionWithSubmsumption(x) = IntrinsicFunctions.UnboxGeneric (x) @ (102,40--102,52)"; +#if NO_PROJECTCRACKER // proxy for COMPILER + "let functionWithCoercion(x) = let arg: Microsoft.FSharp.Core.string = let arg: Microsoft.FSharp.Core.string = IntrinsicFunctions.UnboxGeneric (x :> Microsoft.FSharp.Core.obj) in M.functionWithSubmsumption (arg :> Microsoft.FSharp.Core.obj) in M.functionWithSubmsumption (arg :> Microsoft.FSharp.Core.obj) @ (103,39--103,116)"; +#else + "let functionWithCoercion(x) = let x: Microsoft.FSharp.Core.string = let x: Microsoft.FSharp.Core.string = IntrinsicFunctions.UnboxGeneric (x :> Microsoft.FSharp.Core.obj) in M.functionWithSubmsumption (x :> Microsoft.FSharp.Core.obj) in M.functionWithSubmsumption (x :> Microsoft.FSharp.Core.obj) @ (103,39--103,116)"; +#endif + "type MultiArgMethods"; + "member .ctor(c,d) = (new Object(); ()) @ (105,5--105,20)"; + "member Method(x) (a,b) = 1 @ (106,37--106,38)"; + "member CurriedMethod(x) (a1,b1) (a2,b2) = 1 @ (107,63--107,64)"; + "let testFunctionThatCallsMultiArgMethods(unitVar0) = let m: M.MultiArgMethods = new MultiArgMethods(3,4) in Operators.op_Addition (m.Method(7,8),let arg00: Microsoft.FSharp.Core.int = 9 in let arg01: Microsoft.FSharp.Core.int = 10 in let arg10: Microsoft.FSharp.Core.int = 11 in let arg11: Microsoft.FSharp.Core.int = 12 in m.CurriedMethod(arg00,arg01,arg10,arg11)) @ (110,8--110,9)"; +#if NO_PROJECTCRACKER // proxy for COMPILER + "let functionThatUsesObjectExpression(unitVar0) = { new Object() with member x.ToString(unitVar1) = let value: Microsoft.FSharp.Core.int = 888 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (value) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... } @ (114,3--114,55)"; + "let functionThatUsesObjectExpressionWithInterfaceImpl(unitVar0) = { new Object() with member x.ToString(unitVar1) = let value: Microsoft.FSharp.Core.int = 888 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (value) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... interface System.IComparable with member x.CompareTo(y) = 0 } :> System.IComparable @ (117,3--120,38)"; +#else + "let functionThatUsesObjectExpression(unitVar0) = { new Object() with member x.ToString(unitVar1) = let x: Microsoft.FSharp.Core.int = 888 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... } @ (114,3--114,55)"; + "let functionThatUsesObjectExpressionWithInterfaceImpl(unitVar0) = { new Object() with member x.ToString(unitVar1) = let x: Microsoft.FSharp.Core.int = 888 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... interface System.IComparable with member x.CompareTo(y) = 0 } :> System.IComparable @ (117,3--120,38)"; #endif + "let testFunctionThatUsesUnitsOfMeasure(x) (y) = Operators.op_Addition,Microsoft.FSharp.Core.float<'u>,Microsoft.FSharp.Core.float<'u>> (x,y) @ (122,70--122,75)"; + "let testFunctionThatUsesAddressesAndByrefs(x) = let mutable w: Microsoft.FSharp.Core.int = 4 in let y1: Microsoft.FSharp.Core.byref = x in let y2: Microsoft.FSharp.Core.byref = &w in let arr: Microsoft.FSharp.Core.int Microsoft.FSharp.Core.[] = [|3; 4|] in let r: Microsoft.FSharp.Core.int Microsoft.FSharp.Core.ref = Operators.Ref (3) in let y3: Microsoft.FSharp.Core.byref = [I_ldelema (NormalAddress,false,ILArrayShapeFIX,TypeVar 0us)](arr,0) in let y4: Microsoft.FSharp.Core.byref = &r.contents in let z: Microsoft.FSharp.Core.int = Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (x,y1),y2),y3) in (w <- 3; (x <- 4; (y2 <- 4; (y3 <- 5; Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (z,x),y1),y2),y3),y4),IntrinsicFunctions.GetArray (arr,0)),r.contents))))) @ (125,16--125,17)"; + "let testFunctionThatUsesStructs1(dt) = dt.AddDays(3) @ (139,57--139,72)"; + "let testFunctionThatUsesStructs2(unitVar0) = let dt1: System.DateTime = DateTime.get_Now () in let mutable dt2: System.DateTime = DateTime.get_Now () in let dt3: System.TimeSpan = DateTime.op_Subtraction (dt1,dt2) in let dt4: System.DateTime = dt1.AddDays(3) in let dt5: Microsoft.FSharp.Core.int = dt1.get_Millisecond() in let dt6: Microsoft.FSharp.Core.byref = &dt2 in let dt7: System.TimeSpan = DateTime.op_Subtraction (dt6,dt4) in dt7 @ (142,7--142,10)"; + "let testFunctionThatUsesWhileLoop(unitVar0) = let mutable x: Microsoft.FSharp.Core.int = 1 in (while Operators.op_LessThan (x,100) do x <- Operators.op_Addition (x,1) done; x) @ (152,15--152,16)"; + "let testFunctionThatUsesTryWith(unitVar0) = try M.testFunctionThatUsesWhileLoop (()) with matchValue -> match (if matchValue :? System.ArgumentException then $0 else $1) targets ... @ (158,3--160,60)"; + "let testFunctionThatUsesTryFinally(unitVar0) = try M.testFunctionThatUsesWhileLoop (()) finally Console.WriteLine (\"8888\") @ (164,3--167,37)"; + "member Console.WriteTwoLines.Static(unitVar0) = (Console.WriteLine (); Console.WriteLine ()) @ (170,36--170,90)"; + "member DateTime.get_TwoMinute(x) (unitVar1) = Operators.op_Addition (x.get_Minute(),x.get_Minute()) @ (173,25--173,44)"; + "let testFunctionThatUsesExtensionMembers(unitVar0) = (M.Console.WriteTwoLines.Static (()); let v: Microsoft.FSharp.Core.int = DateTime.get_Now ().DateTime.get_TwoMinute(()) in M.Console.WriteTwoLines.Static (())) @ (176,3--178,33)"; + "let testFunctionThatUsesOptionMembers(unitVar0) = let x: Microsoft.FSharp.Core.int Microsoft.FSharp.Core.option = Some(3) in (x.get_IsSome() (),x.get_IsNone() ()) @ (181,7--181,8)"; + "let testFunctionThatUsesOverAppliedFunction(unitVar0) = Operators.Identity Microsoft.FSharp.Core.int> (fun x -> Operators.Identity (x)) 3 @ (185,3--185,10)"; + "let testFunctionThatUsesPatternMatchingOnLists(x) = match (if x.Isop_ColonColon then (if x.Tail.Isop_ColonColon then (if x.Tail.Tail.Isop_Nil then $2 else $3) else $1) else $0) targets ... @ (188,10--188,11)"; + "let testFunctionThatUsesPatternMatchingOnOptions(x) = match (if x.IsSome then $1 else $0) targets ... @ (195,10--195,11)"; + "let testFunctionThatUsesPatternMatchingOnOptions2(x) = match (if x.IsSome then $1 else $0) targets ... @ (200,10--200,11)"; + "let testFunctionThatUsesConditionalOnOptions2(x) = (if x.get_IsSome() () then 1 else 2) @ (205,4--205,29)"; + "let f(x) (y) = Operators.op_Addition (x,y) @ (207,12--207,15)"; + "let g = let x: Microsoft.FSharp.Core.int = 1 in fun y -> M.f (x,y) @ (208,8--208,11)"; + "let h = Operators.op_Addition (M.g () 2,3) @ (209,8--209,17)"; + "type TestFuncProp"; + "member .ctor(unitVar0) = (new Object(); ()) @ (211,5--211,17)"; + "member get_Id(this) (unitVar1) = fun x -> x @ (212,21--212,31)"; + "let wrong = Operators.op_Equality (new TestFuncProp(()).get_Id(()) 0,0) @ (214,12--214,35)"; + "let start(name) = (name,name) @ (217,4--217,14)"; + "let last(name,values) = Operators.Identity ((name,values)) @ (220,4--220,21)"; + "let last2(name) = Operators.Identity (name) @ (223,4--223,11)"; + "let test7(s) = let tupledArg: Microsoft.FSharp.Core.string * Microsoft.FSharp.Core.string = M.start (s) in let name: Microsoft.FSharp.Core.string = tupledArg.Item0 in let values: Microsoft.FSharp.Core.string = tupledArg.Item1 in M.last (name,values) @ (226,4--226,19)"; + "let test8(unitVar0) = fun tupledArg -> let name: Microsoft.FSharp.Core.string = tupledArg.Item0 in let values: Microsoft.FSharp.Core.string = tupledArg.Item1 in M.last (name,values) @ (229,4--229,8)"; + "let test9(s) = M.last (s,s) @ (232,4--232,17)"; + "let test10(unitVar0) = fun name -> M.last2 (name) @ (235,4--235,9)"; + "let test11(s) = M.last2 (s) @ (238,4--238,14)"; + "let badLoop = badLoop@240.Force Microsoft.FSharp.Core.int>(()) @ (240,8--240,15)"; + "type LetLambda"; + "let f = fun a -> fun b -> Operators.op_Addition (a,b) @ (247,8--247,24)"; + "let letLambdaRes = ListModule.Map (fun tupledArg -> let a: Microsoft.FSharp.Core.int = tupledArg.Item0 in let b: Microsoft.FSharp.Core.int = tupledArg.Item1 in (LetLambda.f () a) b,Cons((1,2),Empty())) @ (249,19--249,71)"; + ] + + let expected2 = [ + "type N"; "type IntAbbrev"; "let bool2 = False @ (6,12--6,17)"; + "let testHashChar(x) = Operators.op_BitwiseOr (Operators.op_LeftShift (x,16),x) @ (8,28--8,34)"; + "let testHashSByte(x) = Operators.op_ExclusiveOr (Operators.op_LeftShift (x,8),x) @ (9,30--9,36)"; + "let testHashInt16(x) = Operators.op_BitwiseOr (Operators.ToUInt16 (x),Operators.op_LeftShift (x,16)) @ (10,30--10,36)"; + "let testHashInt64(x) = Operators.op_ExclusiveOr (Operators.ToInt32 (x),Operators.ToInt32 (Operators.op_RightShift (x,32))) @ (11,30--11,36)"; + "let testHashUInt64(x) = Operators.op_ExclusiveOr (Operators.ToInt32 (x),Operators.ToInt32 (Operators.op_RightShift (x,32))) @ (12,32--12,38)"; + "let testHashIntPtr(x) = Operators.ToInt32 (Operators.ToUInt64 (x)) @ (13,35--13,41)"; + "let testHashUIntPtr(x) = Operators.op_BitwiseAnd (Operators.ToInt32 (Operators.ToUInt64 (x)),2147483647) @ (14,37--14,43)"; + "let testHashString(x) = (if Operators.op_Equality (x,dflt) then 0 else Operators.Hash (x)) @ (16,32--16,38)"; + "let testTypeOf(x) = Operators.TypeOf<'T> () @ (17,24--17,30)"; + ] + + // printFSharpDecls "" file2.Declarations |> Seq.iter (printfn "%s") + + printDeclarations None (List.ofSeq file1.Declarations) + |> Seq.toList + |> filterHack + |> shouldEqual (filterHack expected) + + printDeclarations None (List.ofSeq file2.Declarations) + |> Seq.toList + |> filterHack + |> shouldEqual (filterHack expected2) + + () + + +let testOperators dnName fsName excludedTests expectedUnoptimized expectedOptimized = + let basePath = Path.GetTempFileName() + let fileName = Path.ChangeExtension(basePath, ".fs") + let dllName = Path.ChangeExtension(basePath, ".dll") + let projFileName = Path.ChangeExtension(basePath, ".fsproj") + let source = System.String.Format(Project1.operatorTests, dnName, fsName) + let replace (s:string) r = s.Replace("let " + r, "// let " + r) + let fileSource = excludedTests |> List.fold replace source + File.WriteAllText(fileName, fileSource) + + let args = mkProjectCommandLineArgsSilent (dllName, [fileName]) + let options = checker.GetProjectOptionsFromCommandLineArgs (projFileName, args) + let wholeProjectResults = exprChecker.ParseAndCheckProject(options) |> Async.RunSynchronously + + for e in wholeProjectResults.Errors do + printfn "%s Operator Tests error: <<<%s>>>" dnName e.Message + + wholeProjectResults.Errors.Length |> shouldEqual 0 + + let fileUnoptimized = wholeProjectResults.AssemblyContents.ImplementationFiles.[0] + let fileOptimized = wholeProjectResults.GetOptimizedAssemblyContents().ImplementationFiles.[0] + + printDeclarations None (List.ofSeq fileUnoptimized.Declarations) + |> Seq.toList |> shouldEqual expectedUnoptimized + + printDeclarations None (List.ofSeq fileOptimized.Declarations) + |> Seq.toList |> shouldEqual expectedOptimized + + () + +[] +let ``Test Operator Declarations for Byte`` () = + let excludedTests = [ + "testByteUnaryNegOperator"; + "testByteUnaryNegChecked"; + ] + + let expectedUnoptimized = [ + "type OperatorTestsByte"; + "let testByteEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,64--4,72)"; + "let testByteNotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,64--5,73)"; + "let testByteLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,64--6,72)"; + "let testByteLessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,64--7,73)"; + "let testByteGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,64--8,72)"; + "let testByteGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,64--9,73)"; + "let testByteAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,56--11,64)"; + "let testByteSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,56--12,64)"; + "let testByteMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,55--13,64)"; + "let testByteDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,56--14,64)"; + "let testByteModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,56--15,64)"; + "let testByteBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,56--16,66)"; + "let testByteBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,56--17,66)"; + "let testByteBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,56--18,66)"; + "let testByteShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (19,55--19,65)"; + "let testByteShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (20,55--20,65)"; + "let testByteAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,53--24,70)"; + "let testByteSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,53--25,70)"; + "let testByteMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,53--26,70)"; + "let testByteToByteChecked(e1) = Checked.ToByte (e1) @ (29,43--29,58)"; + "let testByteToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,43--30,59)"; + "let testByteToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,43--31,59)"; + "let testByteToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,43--32,60)"; + "let testByteToIntChecked(e1) = Checked.ToInt (e1) @ (33,43--33,57)"; + "let testByteToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,43--34,59)"; + "let testByteToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,43--35,60)"; + "let testByteToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,43--36,59)"; + "let testByteToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,43--37,60)"; + "let testByteToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,43--38,63)"; + "let testByteToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,43--39,64)"; + "let testByteToByteOperator(e1) = Operators.ToByte (e1) @ (41,43--41,50)"; + "let testByteToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,43--42,51)"; + "let testByteToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,43--43,51)"; + "let testByteToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,43--44,52)"; + "let testByteToIntOperator(e1) = Operators.ToInt (e1) @ (45,43--45,49)"; + "let testByteToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,43--46,51)"; + "let testByteToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,43--47,52)"; + "let testByteToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,43--48,51)"; + "let testByteToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,43--49,52)"; + "let testByteToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,43--50,55)"; + "let testByteToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,43--51,56)"; + "let testByteToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,43--52,53)"; + "let testByteToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,43--53,51)"; + "let testByteToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,43--54,53)"; + "let testByteToCharOperator(e1) = Operators.ToChar (e1) @ (55,43--55,50)"; + "let testByteToStringOperator(e1) = Operators.ToString (e1) @ (56,43--56,52)"; + ] + + let expectedOptimized = [ + "type OperatorTestsByte"; + "let testByteEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,64--4,72)"; + "let testByteNotEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_Equality (e1,e2),False) @ (5,64--5,73)"; + "let testByteLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,64--6,72)"; + "let testByteLessThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_GreaterThan (e1,e2),False) @ (7,64--7,73)"; + "let testByteGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,64--8,72)"; + "let testByteGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_LessThan (e1,e2),False) @ (9,64--9,73)"; + "let testByteAdditionOperator(e1) (e2) = Operators.ToByte (Operators.op_Addition (e1,e2)) @ (11,56--11,64)"; + "let testByteSubtractionOperator(e1) (e2) = Operators.ToByte (Operators.op_Subtraction (e1,e2)) @ (12,56--12,64)"; + "let testByteMultiplyOperator(e1) (e2) = Operators.ToByte (Operators.op_Multiply (e1,e2)) @ (13,55--13,64)"; + "let testByteDivisionOperator(e1) (e2) = Operators.ToByte (Operators.op_Division (e1,e2)) @ (14,56--14,64)"; + "let testByteModulusOperator(e1) (e2) = Operators.ToByte (Operators.op_Modulus (e1,e2)) @ (15,56--15,64)"; + "let testByteBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,56--16,66)"; + "let testByteBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,56--17,66)"; + "let testByteBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,56--18,66)"; + "let testByteShiftLeftOperator(e1) (e2) = Operators.ToByte (Operators.op_LeftShift (e1,Operators.op_BitwiseAnd (e2,7))) @ (19,55--19,65)"; + "let testByteShiftRightOperator(e1) (e2) = Operators.ToByte (Operators.op_RightShift (e1,Operators.op_BitwiseAnd (e2,7))) @ (20,55--20,65)"; + "let testByteAdditionChecked(e1) (e2) = Checked.ToByte (Checked.op_Addition (e1,e2)) @ (24,53--24,70)"; + "let testByteSubtractionChecked(e1) (e2) = Checked.ToByte (Checked.op_Subtraction (e1,e2)) @ (25,53--25,70)"; + "let testByteMultiplyChecked(e1) (e2) = Checked.ToByte (Checked.op_Multiply (e1,e2)) @ (26,53--26,70)"; + "let testByteToByteChecked(e1) = Checked.ToByte (e1) @ (29,43--29,58)"; + "let testByteToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,43--30,59)"; + "let testByteToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,43--31,59)"; + "let testByteToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,43--32,60)"; + "let testByteToIntChecked(e1) = Checked.ToInt32 (e1) @ (33,43--33,57)"; + "let testByteToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,43--34,59)"; + "let testByteToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,43--35,60)"; + "let testByteToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,43--36,59)"; + "let testByteToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,43--37,60)"; + "let testByteToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,43--38,63)"; + "let testByteToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,43--39,64)"; + "let testByteToByteOperator(e1) = Operators.ToByte (e1) @ (41,43--41,50)"; + "let testByteToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,43--42,51)"; + "let testByteToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,43--43,51)"; + "let testByteToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,43--44,52)"; + "let testByteToIntOperator(e1) = Operators.ToInt32 (e1) @ (45,43--45,49)"; + "let testByteToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,43--46,51)"; + "let testByteToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,43--47,52)"; + "let testByteToInt64Operator(e1) = Operators.ToUInt64 (e1) @ (48,43--48,51)"; + "let testByteToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,43--49,52)"; + "let testByteToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,43--50,55)"; + "let testByteToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,43--51,56)"; + "let testByteToSingleOperator(e1) = Operators.ToSingle (Operators.ToDouble (e1)) @ (52,43--52,53)"; + "let testByteToDoubleOperator(e1) = Operators.ToDouble (Operators.ToDouble (e1)) @ (53,43--53,51)"; + "let testByteToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,43--54,53)"; + "let testByteToCharOperator(e1) = Operators.ToChar (e1) @ (55,43--55,50)"; + "let testByteToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,43--56,52)"; + ] + + testOperators "Byte" "byte" excludedTests expectedUnoptimized expectedOptimized + + +[] +let ``Test Operator Declarations for SByte`` () = + let excludedTests = [ ] + + let expectedUnoptimized = [ + "type OperatorTestsSByte"; + "let testSByteEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,67--4,75)"; + "let testSByteNotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,67--5,76)"; + "let testSByteLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,67--6,75)"; + "let testSByteLessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,67--7,76)"; + "let testSByteGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,67--8,75)"; + "let testSByteGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,67--9,76)"; + "let testSByteAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,59--11,67)"; "let testSByteSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,59--12,67)"; + "let testSByteMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,58--13,67)"; + "let testSByteDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,59--14,67)"; + "let testSByteModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,59--15,67)"; + "let testSByteBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,59--16,69)"; + "let testSByteBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,59--17,69)"; + "let testSByteBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,59--18,69)"; + "let testSByteShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (19,57--19,67)"; + "let testSByteShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (20,57--20,67)"; + "let testSByteUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,46--22,52)"; + "let testSByteAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,56--24,73)"; + "let testSByteSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,56--25,73)"; + "let testSByteMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,56--26,73)"; + "let testSByteUnaryNegChecked(e1) = Checked.op_UnaryNegation (e1) @ (27,45--27,60)"; + "let testSByteToByteChecked(e1) = Checked.ToByte (e1) @ (29,45--29,60)"; + "let testSByteToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,45--30,61)"; + "let testSByteToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,45--31,61)"; + "let testSByteToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,45--32,62)"; + "let testSByteToIntChecked(e1) = Checked.ToInt (e1) @ (33,45--33,59)"; + "let testSByteToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,45--34,61)"; + "let testSByteToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,45--35,62)"; + "let testSByteToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,45--36,61)"; + "let testSByteToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,45--37,62)"; + "let testSByteToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,45--38,65)"; + "let testSByteToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,45--39,66)"; + "let testSByteToByteOperator(e1) = Operators.ToByte (e1) @ (41,45--41,52)"; + "let testSByteToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,45--42,53)"; + "let testSByteToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,45--43,53)"; + "let testSByteToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,45--44,54)"; + "let testSByteToIntOperator(e1) = Operators.ToInt (e1) @ (45,45--45,51)"; + "let testSByteToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,45--46,53)"; + "let testSByteToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,45--47,54)"; + "let testSByteToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,45--48,53)"; + "let testSByteToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,45--49,54)"; + "let testSByteToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,45--50,57)"; + "let testSByteToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,45--51,58)"; + "let testSByteToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,45--52,55)"; + "let testSByteToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,45--53,53)"; + "let testSByteToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,45--54,55)"; + "let testSByteToCharOperator(e1) = Operators.ToChar (e1) @ (55,45--55,52)"; + "let testSByteToStringOperator(e1) = Operators.ToString (e1) @ (56,45--56,54)"; + ] + + let expectedOptimized = [ + "type OperatorTestsSByte"; + "let testSByteEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,67--4,75)"; + "let testSByteNotEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_Equality (e1,e2),False) @ (5,67--5,76)"; + "let testSByteLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,67--6,75)"; + "let testSByteLessThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_GreaterThan (e1,e2),False) @ (7,67--7,76)"; + "let testSByteGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,67--8,75)"; + "let testSByteGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_LessThan (e1,e2),False) @ (9,67--9,76)"; + "let testSByteAdditionOperator(e1) (e2) = Operators.ToSByte (Operators.op_Addition (e1,e2)) @ (11,59--11,67)"; + "let testSByteSubtractionOperator(e1) (e2) = Operators.ToSByte (Operators.op_Subtraction (e1,e2)) @ (12,59--12,67)"; + "let testSByteMultiplyOperator(e1) (e2) = Operators.ToSByte (Operators.op_Multiply (e1,e2)) @ (13,58--13,67)"; + "let testSByteDivisionOperator(e1) (e2) = Operators.ToSByte (Operators.op_Division (e1,e2)) @ (14,59--14,67)"; + "let testSByteModulusOperator(e1) (e2) = Operators.ToSByte (Operators.op_Modulus (e1,e2)) @ (15,59--15,67)"; + "let testSByteBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,59--16,69)"; + "let testSByteBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,59--17,69)"; + "let testSByteBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,59--18,69)"; + "let testSByteShiftLeftOperator(e1) (e2) = Operators.ToSByte (Operators.op_LeftShift (e1,Operators.op_BitwiseAnd (e2,7))) @ (19,57--19,67)"; + "let testSByteShiftRightOperator(e1) (e2) = Operators.ToSByte (Operators.op_RightShift (e1,Operators.op_BitwiseAnd (e2,7))) @ (20,57--20,67)"; + "let testSByteUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,46--22,52)"; + "let testSByteAdditionChecked(e1) (e2) = Checked.ToSByte (Checked.op_Addition (e1,e2)) @ (24,56--24,73)"; + "let testSByteSubtractionChecked(e1) (e2) = Checked.ToSByte (Checked.op_Subtraction (e1,e2)) @ (25,56--25,73)"; + "let testSByteMultiplyChecked(e1) (e2) = Checked.ToSByte (Checked.op_Multiply (e1,e2)) @ (26,56--26,73)"; + "let testSByteUnaryNegChecked(e1) = Checked.op_Subtraction (0,e1) @ (27,45--27,60)"; + "let testSByteToByteChecked(e1) = Checked.ToByte (e1) @ (29,45--29,60)"; + "let testSByteToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,45--30,61)"; + "let testSByteToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,45--31,61)"; + "let testSByteToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,45--32,62)"; + "let testSByteToIntChecked(e1) = Checked.ToInt32 (e1) @ (33,45--33,59)"; + "let testSByteToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,45--34,61)"; + "let testSByteToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,45--35,62)"; + "let testSByteToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,45--36,61)"; + "let testSByteToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,45--37,62)"; + "let testSByteToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,45--38,65)"; + "let testSByteToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,45--39,66)"; + "let testSByteToByteOperator(e1) = Operators.ToByte (e1) @ (41,45--41,52)"; + "let testSByteToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,45--42,53)"; + "let testSByteToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,45--43,53)"; + "let testSByteToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,45--44,54)"; + "let testSByteToIntOperator(e1) = Operators.ToInt32 (e1) @ (45,45--45,51)"; + "let testSByteToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,45--46,53)"; + "let testSByteToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,45--47,54)"; + "let testSByteToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,45--48,53)"; + "let testSByteToUInt64Operator(e1) = Operators.ToInt64 (e1) @ (49,45--49,54)"; + "let testSByteToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,45--50,57)"; + "let testSByteToUIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (51,45--51,58)"; + "let testSByteToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,45--52,55)"; + "let testSByteToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,45--53,53)"; + "let testSByteToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,45--54,55)"; + "let testSByteToCharOperator(e1) = Operators.ToChar (e1) @ (55,45--55,52)"; + "let testSByteToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,45--56,54)"; + ] + + testOperators "SByte" "sbyte" excludedTests expectedUnoptimized expectedOptimized + +[] +let ``Test Operator Declarations for Int16`` () = + let excludedTests = [ ] + + let expectedUnoptimized = [ + "type OperatorTestsInt16"; + "let testInt16EqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,67--4,75)"; + "let testInt16NotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,67--5,76)"; + "let testInt16LessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,67--6,75)"; + "let testInt16LessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,67--7,76)"; + "let testInt16GreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,67--8,75)"; + "let testInt16GreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,67--9,76)"; + "let testInt16AdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,59--11,67)"; + "let testInt16SubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,59--12,67)"; + "let testInt16MultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,58--13,67)"; + "let testInt16DivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,59--14,67)"; + "let testInt16ModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,59--15,67)"; + "let testInt16BitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,59--16,69)"; + "let testInt16BitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,59--17,69)"; + "let testInt16BitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,59--18,69)"; + "let testInt16ShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (19,57--19,67)"; + "let testInt16ShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (20,57--20,67)"; + "let testInt16UnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,46--22,52)"; + "let testInt16AdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,56--24,73)"; + "let testInt16SubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,56--25,73)"; + "let testInt16MultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,56--26,73)"; + "let testInt16UnaryNegChecked(e1) = Checked.op_UnaryNegation (e1) @ (27,45--27,60)"; + "let testInt16ToByteChecked(e1) = Checked.ToByte (e1) @ (29,45--29,60)"; + "let testInt16ToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,45--30,61)"; + "let testInt16ToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,45--31,61)"; + "let testInt16ToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,45--32,62)"; + "let testInt16ToIntChecked(e1) = Checked.ToInt (e1) @ (33,45--33,59)"; + "let testInt16ToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,45--34,61)"; + "let testInt16ToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,45--35,62)"; + "let testInt16ToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,45--36,61)"; + "let testInt16ToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,45--37,62)"; + "let testInt16ToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,45--38,65)"; + "let testInt16ToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,45--39,66)"; + "let testInt16ToByteOperator(e1) = Operators.ToByte (e1) @ (41,45--41,52)"; + "let testInt16ToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,45--42,53)"; + "let testInt16ToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,45--43,53)"; + "let testInt16ToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,45--44,54)"; + "let testInt16ToIntOperator(e1) = Operators.ToInt (e1) @ (45,45--45,51)"; + "let testInt16ToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,45--46,53)"; + "let testInt16ToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,45--47,54)"; + "let testInt16ToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,45--48,53)"; + "let testInt16ToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,45--49,54)"; + "let testInt16ToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,45--50,57)"; + "let testInt16ToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,45--51,58)"; + "let testInt16ToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,45--52,55)"; + "let testInt16ToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,45--53,53)"; + "let testInt16ToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,45--54,55)"; + "let testInt16ToCharOperator(e1) = Operators.ToChar (e1) @ (55,45--55,52)"; + "let testInt16ToStringOperator(e1) = Operators.ToString (e1) @ (56,45--56,54)"; + ] + + let expectedOptimized = [ + "type OperatorTestsInt16"; + "let testInt16EqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,67--4,75)"; + "let testInt16NotEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_Equality (e1,e2),False) @ (5,67--5,76)"; + "let testInt16LessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,67--6,75)"; + "let testInt16LessThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_GreaterThan (e1,e2),False) @ (7,67--7,76)"; + "let testInt16GreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,67--8,75)"; + "let testInt16GreaterThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_LessThan (e1,e2),False) @ (9,67--9,76)"; + "let testInt16AdditionOperator(e1) (e2) = Operators.ToInt16 (Operators.op_Addition (e1,e2)) @ (11,59--11,67)"; + "let testInt16SubtractionOperator(e1) (e2) = Operators.ToInt16 (Operators.op_Subtraction (e1,e2)) @ (12,59--12,67)"; + "let testInt16MultiplyOperator(e1) (e2) = Operators.ToInt16 (Operators.op_Multiply (e1,e2)) @ (13,58--13,67)"; + "let testInt16DivisionOperator(e1) (e2) = Operators.ToInt16 (Operators.op_Division (e1,e2)) @ (14,59--14,67)"; + "let testInt16ModulusOperator(e1) (e2) = Operators.ToInt16 (Operators.op_Modulus (e1,e2)) @ (15,59--15,67)"; + "let testInt16BitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,59--16,69)"; + "let testInt16BitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,59--17,69)"; + "let testInt16BitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,59--18,69)"; + "let testInt16ShiftLeftOperator(e1) (e2) = Operators.ToInt16 (Operators.op_LeftShift (e1,Operators.op_BitwiseAnd (e2,15))) @ (19,57--19,67)"; + "let testInt16ShiftRightOperator(e1) (e2) = Operators.ToInt16 (Operators.op_RightShift (e1,Operators.op_BitwiseAnd (e2,15))) @ (20,57--20,67)"; + "let testInt16UnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,46--22,52)"; + "let testInt16AdditionChecked(e1) (e2) = Checked.ToInt16 (Checked.op_Addition (e1,e2)) @ (24,56--24,73)"; + "let testInt16SubtractionChecked(e1) (e2) = Checked.ToInt16 (Checked.op_Subtraction (e1,e2)) @ (25,56--25,73)"; + "let testInt16MultiplyChecked(e1) (e2) = Checked.ToInt16 (Checked.op_Multiply (e1,e2)) @ (26,56--26,73)"; + "let testInt16UnaryNegChecked(e1) = Checked.op_Subtraction (0,e1) @ (27,45--27,60)"; + "let testInt16ToByteChecked(e1) = Checked.ToByte (e1) @ (29,45--29,60)"; + "let testInt16ToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,45--30,61)"; + "let testInt16ToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,45--31,61)"; + "let testInt16ToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,45--32,62)"; + "let testInt16ToIntChecked(e1) = Checked.ToInt32 (e1) @ (33,45--33,59)"; + "let testInt16ToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,45--34,61)"; + "let testInt16ToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,45--35,62)"; + "let testInt16ToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,45--36,61)"; + "let testInt16ToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,45--37,62)"; + "let testInt16ToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,45--38,65)"; + "let testInt16ToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,45--39,66)"; + "let testInt16ToByteOperator(e1) = Operators.ToByte (e1) @ (41,45--41,52)"; + "let testInt16ToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,45--42,53)"; + "let testInt16ToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,45--43,53)"; + "let testInt16ToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,45--44,54)"; + "let testInt16ToIntOperator(e1) = Operators.ToInt32 (e1) @ (45,45--45,51)"; + "let testInt16ToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,45--46,53)"; + "let testInt16ToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,45--47,54)"; + "let testInt16ToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,45--48,53)"; + "let testInt16ToUInt64Operator(e1) = Operators.ToInt64 (e1) @ (49,45--49,54)"; + "let testInt16ToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,45--50,57)"; + "let testInt16ToUIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (51,45--51,58)"; + "let testInt16ToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,45--52,55)"; + "let testInt16ToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,45--53,53)"; + "let testInt16ToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,45--54,55)"; + "let testInt16ToCharOperator(e1) = Operators.ToChar (e1) @ (55,45--55,52)"; + "let testInt16ToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,45--56,54)"; + ] + + testOperators "Int16" "int16" excludedTests expectedUnoptimized expectedOptimized + +[] +let ``Test Operator Declarations for UInt16`` () = + let excludedTests = [ + "testUInt16UnaryNegOperator"; + "testUInt16UnaryNegChecked"; + ] + + let expectedUnoptimized = [ + "type OperatorTestsUInt16"; + "let testUInt16EqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,70--4,78)"; + "let testUInt16NotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,70--5,79)"; + "let testUInt16LessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,70--6,78)"; + "let testUInt16LessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,70--7,79)"; + "let testUInt16GreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,70--8,78)"; + "let testUInt16GreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,70--9,79)"; + "let testUInt16AdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,62--11,70)"; + "let testUInt16SubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,62--12,70)"; + "let testUInt16MultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,61--13,70)"; + "let testUInt16DivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,62--14,70)"; + "let testUInt16ModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,62--15,70)"; + "let testUInt16BitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,62--16,72)"; + "let testUInt16BitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,62--17,72)"; + "let testUInt16BitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,62--18,72)"; + "let testUInt16ShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (19,59--19,69)"; + "let testUInt16ShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (20,59--20,69)"; + "let testUInt16AdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,59--24,76)"; + "let testUInt16SubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,59--25,76)"; + "let testUInt16MultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,59--26,76)"; + "let testUInt16ToByteChecked(e1) = Checked.ToByte (e1) @ (29,47--29,62)"; + "let testUInt16ToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,47--30,63)"; + "let testUInt16ToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,47--31,63)"; + "let testUInt16ToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,47--32,64)"; + "let testUInt16ToIntChecked(e1) = Checked.ToInt (e1) @ (33,47--33,61)"; + "let testUInt16ToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,47--34,63)"; + "let testUInt16ToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,47--35,64)"; + "let testUInt16ToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,47--36,63)"; + "let testUInt16ToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,47--37,64)"; + "let testUInt16ToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,47--38,67)"; + "let testUInt16ToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,47--39,68)"; + "let testUInt16ToByteOperator(e1) = Operators.ToByte (e1) @ (41,47--41,54)"; + "let testUInt16ToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,47--42,55)"; + "let testUInt16ToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,47--43,55)"; + "let testUInt16ToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,47--44,56)"; + "let testUInt16ToIntOperator(e1) = Operators.ToInt (e1) @ (45,47--45,53)"; + "let testUInt16ToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,47--46,55)"; + "let testUInt16ToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,47--47,56)"; + "let testUInt16ToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,47--48,55)"; + "let testUInt16ToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,47--49,56)"; + "let testUInt16ToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,47--50,59)"; + "let testUInt16ToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,47--51,60)"; + "let testUInt16ToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,47--52,57)"; + "let testUInt16ToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,47--53,55)"; + "let testUInt16ToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,47--54,57)"; + "let testUInt16ToCharOperator(e1) = Operators.ToChar (e1) @ (55,47--55,54)"; + "let testUInt16ToStringOperator(e1) = Operators.ToString (e1) @ (56,47--56,56)"; + ] + + let expectedOptimized = [ + "type OperatorTestsUInt16"; + "let testUInt16EqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,70--4,78)"; + "let testUInt16NotEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_Equality (e1,e2),False) @ (5,70--5,79)"; + "let testUInt16LessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,70--6,78)"; + "let testUInt16LessThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_GreaterThan (e1,e2),False) @ (7,70--7,79)"; + "let testUInt16GreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,70--8,78)"; + "let testUInt16GreaterThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_LessThan (e1,e2),False) @ (9,70--9,79)"; + "let testUInt16AdditionOperator(e1) (e2) = Operators.ToUInt16 (Operators.op_Addition (e1,e2)) @ (11,62--11,70)"; + "let testUInt16SubtractionOperator(e1) (e2) = Operators.ToUInt16 (Operators.op_Subtraction (e1,e2)) @ (12,62--12,70)"; + "let testUInt16MultiplyOperator(e1) (e2) = Operators.ToUInt16 (Operators.op_Multiply (e1,e2)) @ (13,61--13,70)"; + "let testUInt16DivisionOperator(e1) (e2) = Operators.ToUInt16 (Operators.op_Division (e1,e2)) @ (14,62--14,70)"; + "let testUInt16ModulusOperator(e1) (e2) = Operators.ToUInt16 (Operators.op_Modulus (e1,e2)) @ (15,62--15,70)"; + "let testUInt16BitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,62--16,72)"; + "let testUInt16BitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,62--17,72)"; + "let testUInt16BitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,62--18,72)"; + "let testUInt16ShiftLeftOperator(e1) (e2) = Operators.ToUInt16 (Operators.op_LeftShift (e1,Operators.op_BitwiseAnd (e2,15))) @ (19,59--19,69)"; + "let testUInt16ShiftRightOperator(e1) (e2) = Operators.ToUInt16 (Operators.op_RightShift (e1,Operators.op_BitwiseAnd (e2,15))) @ (20,59--20,69)"; + "let testUInt16AdditionChecked(e1) (e2) = Checked.ToUInt16 (Checked.op_Addition (e1,e2)) @ (24,59--24,76)"; + "let testUInt16SubtractionChecked(e1) (e2) = Checked.ToUInt16 (Checked.op_Subtraction (e1,e2)) @ (25,59--25,76)"; + "let testUInt16MultiplyChecked(e1) (e2) = Checked.ToUInt16 (Checked.op_Multiply (e1,e2)) @ (26,59--26,76)"; + "let testUInt16ToByteChecked(e1) = Checked.ToByte (e1) @ (29,47--29,62)"; + "let testUInt16ToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,47--30,63)"; + "let testUInt16ToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,47--31,63)"; + "let testUInt16ToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,47--32,64)"; + "let testUInt16ToIntChecked(e1) = Checked.ToInt32 (e1) @ (33,47--33,61)"; + "let testUInt16ToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,47--34,63)"; + "let testUInt16ToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,47--35,64)"; + "let testUInt16ToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,47--36,63)"; + "let testUInt16ToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,47--37,64)"; + "let testUInt16ToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,47--38,67)"; + "let testUInt16ToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,47--39,68)"; + "let testUInt16ToByteOperator(e1) = Operators.ToByte (e1) @ (41,47--41,54)"; + "let testUInt16ToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,47--42,55)"; + "let testUInt16ToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,47--43,55)"; + "let testUInt16ToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,47--44,56)"; + "let testUInt16ToIntOperator(e1) = Operators.ToInt32 (e1) @ (45,47--45,53)"; + "let testUInt16ToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,47--46,55)"; + "let testUInt16ToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,47--47,56)"; + "let testUInt16ToInt64Operator(e1) = Operators.ToUInt64 (e1) @ (48,47--48,55)"; + "let testUInt16ToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,47--49,56)"; + "let testUInt16ToIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (50,47--50,59)"; + "let testUInt16ToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,47--51,60)"; + "let testUInt16ToSingleOperator(e1) = Operators.ToSingle (Operators.ToDouble (e1)) @ (52,47--52,57)"; + "let testUInt16ToDoubleOperator(e1) = Operators.ToDouble (Operators.ToDouble (e1)) @ (53,47--53,55)"; + "let testUInt16ToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,47--54,57)"; + "let testUInt16ToCharOperator(e1) = Operators.ToChar (e1) @ (55,47--55,54)"; + "let testUInt16ToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,47--56,56)"; + ] + + testOperators "UInt16" "uint16" excludedTests expectedUnoptimized expectedOptimized + +[] +let ``Test Operator Declarations for Int`` () = + let excludedTests = [ ] + + let expectedUnoptimized = [ + "type OperatorTestsInt"; + "let testIntEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,61--4,69)"; + "let testIntNotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,61--5,70)"; + "let testIntLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,61--6,69)"; + "let testIntLessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,61--7,70)"; + "let testIntGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,61--8,69)"; + "let testIntGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,61--9,70)"; + "let testIntAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,53--11,61)"; + "let testIntSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,53--12,61)"; + "let testIntMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,52--13,61)"; + "let testIntDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,53--14,61)"; + "let testIntModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,53--15,61)"; + "let testIntBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,53--16,63)"; + "let testIntBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,53--17,63)"; + "let testIntBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,53--18,63)"; + "let testIntShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (19,53--19,63)"; + "let testIntShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (20,53--20,63)"; + "let testIntUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,42--22,48)"; + "let testIntAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,50--24,67)"; + "let testIntSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,50--25,67)"; + "let testIntMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,50--26,67)"; + "let testIntUnaryNegChecked(e1) = Checked.op_UnaryNegation (e1) @ (27,41--27,56)"; + "let testIntToByteChecked(e1) = Checked.ToByte (e1) @ (29,41--29,56)"; + "let testIntToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,41--30,57)"; + "let testIntToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,41--31,57)"; + "let testIntToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,41--32,58)"; + "let testIntToIntChecked(e1) = Checked.ToInt (e1) @ (33,41--33,55)"; + "let testIntToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,41--34,57)"; + "let testIntToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,41--35,58)"; + "let testIntToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,41--36,57)"; + "let testIntToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,41--37,58)"; + "let testIntToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,41--38,61)"; + "let testIntToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,41--39,62)"; + "let testIntToByteOperator(e1) = Operators.ToByte (e1) @ (41,41--41,48)"; + "let testIntToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,41--42,49)"; + "let testIntToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,41--43,49)"; + "let testIntToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,41--44,50)"; + "let testIntToIntOperator(e1) = Operators.ToInt (e1) @ (45,41--45,47)"; + "let testIntToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,41--46,49)"; + "let testIntToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,41--47,50)"; + "let testIntToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,41--48,49)"; + "let testIntToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,41--49,50)"; + "let testIntToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,41--50,53)"; + "let testIntToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,41--51,54)"; + "let testIntToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,41--52,51)"; + "let testIntToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,41--53,49)"; + "let testIntToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,41--54,51)"; + "let testIntToCharOperator(e1) = Operators.ToChar (e1) @ (55,41--55,48)"; + "let testIntToStringOperator(e1) = Operators.ToString (e1) @ (56,41--56,50)"; + ] + + let expectedOptimized = [ + "type OperatorTestsInt"; + "let testIntEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,61--4,69)"; + "let testIntNotEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_Equality (e1,e2),False) @ (5,61--5,70)"; + "let testIntLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,61--6,69)"; + "let testIntLessThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_GreaterThan (e1,e2),False) @ (7,61--7,70)"; + "let testIntGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,61--8,69)"; + "let testIntGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_LessThan (e1,e2),False) @ (9,61--9,70)"; + "let testIntAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,53--11,61)"; + "let testIntSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,53--12,61)"; + "let testIntMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,52--13,61)"; + "let testIntDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,53--14,61)"; + "let testIntModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,53--15,61)"; + "let testIntBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,53--16,63)"; + "let testIntBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,53--17,63)"; + "let testIntBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,53--18,63)"; + "let testIntShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,Operators.op_BitwiseAnd (e2,31)) @ (19,53--19,63)"; + "let testIntShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,Operators.op_BitwiseAnd (e2,31)) @ (20,53--20,63)"; + "let testIntUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,42--22,48)"; + "let testIntAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,50--24,67)"; + "let testIntSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,50--25,67)"; + "let testIntMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,50--26,67)"; + "let testIntUnaryNegChecked(e1) = Checked.op_Subtraction (0,e1) @ (27,41--27,56)"; + "let testIntToByteChecked(e1) = Checked.ToByte (e1) @ (29,41--29,56)"; + "let testIntToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,41--30,57)"; + "let testIntToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,41--31,57)"; + "let testIntToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,41--32,58)"; + "let testIntToIntChecked(e1) = Checked.ToInt32 (e1) @ (33,41--33,55)"; + "let testIntToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,41--34,57)"; + "let testIntToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,41--35,58)"; + "let testIntToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,41--36,57)"; + "let testIntToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,41--37,58)"; + "let testIntToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,41--38,61)"; + "let testIntToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,41--39,62)"; + "let testIntToByteOperator(e1) = Operators.ToByte (e1) @ (41,41--41,48)"; + "let testIntToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,41--42,49)"; + "let testIntToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,41--43,49)"; + "let testIntToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,41--44,50)"; + "let testIntToIntOperator(e1) = e1 @ (45,45--45,47)"; + "let testIntToInt32Operator(e1) = e1 @ (46,47--46,49)"; + "let testIntToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,41--47,50)"; + "let testIntToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,41--48,49)"; + "let testIntToUInt64Operator(e1) = Operators.ToInt64 (e1) @ (49,41--49,50)"; + "let testIntToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,41--50,53)"; + "let testIntToUIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (51,41--51,54)"; + "let testIntToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,41--52,51)"; + "let testIntToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,41--53,49)"; + "let testIntToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,41--54,51)"; + "let testIntToCharOperator(e1) = Operators.ToChar (e1) @ (55,41--55,48)"; + "let testIntToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,41--56,50)"; + ] + + testOperators "Int" "int" excludedTests expectedUnoptimized expectedOptimized + +[] +let ``Test Operator Declarations for Int32`` () = + let excludedTests = [ ] + + let expectedUnoptimized = [ + "type OperatorTestsInt32"; + "let testInt32EqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,67--4,75)"; + "let testInt32NotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,67--5,76)"; + "let testInt32LessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,67--6,75)"; + "let testInt32LessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,67--7,76)"; + "let testInt32GreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,67--8,75)"; + "let testInt32GreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,67--9,76)"; + "let testInt32AdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,59--11,67)"; + "let testInt32SubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,59--12,67)"; + "let testInt32MultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,58--13,67)"; + "let testInt32DivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,59--14,67)"; + "let testInt32ModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,59--15,67)"; + "let testInt32BitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,59--16,69)"; + "let testInt32BitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,59--17,69)"; + "let testInt32BitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,59--18,69)"; + "let testInt32ShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (19,57--19,67)"; + "let testInt32ShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (20,57--20,67)"; + "let testInt32UnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,46--22,52)"; + "let testInt32AdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,56--24,73)"; + "let testInt32SubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,56--25,73)"; + "let testInt32MultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,56--26,73)"; + "let testInt32UnaryNegChecked(e1) = Checked.op_UnaryNegation (e1) @ (27,45--27,60)"; + "let testInt32ToByteChecked(e1) = Checked.ToByte (e1) @ (29,45--29,60)"; + "let testInt32ToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,45--30,61)"; + "let testInt32ToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,45--31,61)"; + "let testInt32ToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,45--32,62)"; + "let testInt32ToIntChecked(e1) = Checked.ToInt (e1) @ (33,45--33,59)"; + "let testInt32ToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,45--34,61)"; + "let testInt32ToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,45--35,62)"; + "let testInt32ToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,45--36,61)"; + "let testInt32ToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,45--37,62)"; + "let testInt32ToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,45--38,65)"; + "let testInt32ToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,45--39,66)"; + "let testInt32ToByteOperator(e1) = Operators.ToByte (e1) @ (41,45--41,52)"; + "let testInt32ToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,45--42,53)"; + "let testInt32ToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,45--43,53)"; + "let testInt32ToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,45--44,54)"; + "let testInt32ToIntOperator(e1) = Operators.ToInt (e1) @ (45,45--45,51)"; + "let testInt32ToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,45--46,53)"; + "let testInt32ToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,45--47,54)"; + "let testInt32ToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,45--48,53)"; + "let testInt32ToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,45--49,54)"; + "let testInt32ToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,45--50,57)"; + "let testInt32ToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,45--51,58)"; + "let testInt32ToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,45--52,55)"; + "let testInt32ToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,45--53,53)"; + "let testInt32ToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,45--54,55)"; + "let testInt32ToCharOperator(e1) = Operators.ToChar (e1) @ (55,45--55,52)"; + "let testInt32ToStringOperator(e1) = Operators.ToString (e1) @ (56,45--56,54)"; + ] + + let expectedOptimized = [ + "type OperatorTestsInt32"; + "let testInt32EqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,67--4,75)"; + "let testInt32NotEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_Equality (e1,e2),False) @ (5,67--5,76)"; + "let testInt32LessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,67--6,75)"; + "let testInt32LessThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_GreaterThan (e1,e2),False) @ (7,67--7,76)"; + "let testInt32GreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,67--8,75)"; + "let testInt32GreaterThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_LessThan (e1,e2),False) @ (9,67--9,76)"; + "let testInt32AdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,59--11,67)"; + "let testInt32SubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,59--12,67)"; + "let testInt32MultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,58--13,67)"; + "let testInt32DivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,59--14,67)"; + "let testInt32ModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,59--15,67)"; + "let testInt32BitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,59--16,69)"; + "let testInt32BitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,59--17,69)"; + "let testInt32BitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,59--18,69)"; + "let testInt32ShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,Operators.op_BitwiseAnd (e2,31)) @ (19,57--19,67)"; + "let testInt32ShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,Operators.op_BitwiseAnd (e2,31)) @ (20,57--20,67)"; + "let testInt32UnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,46--22,52)"; + "let testInt32AdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,56--24,73)"; + "let testInt32SubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,56--25,73)"; + "let testInt32MultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,56--26,73)"; + "let testInt32UnaryNegChecked(e1) = Checked.op_Subtraction (0,e1) @ (27,45--27,60)"; + "let testInt32ToByteChecked(e1) = Checked.ToByte (e1) @ (29,45--29,60)"; + "let testInt32ToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,45--30,61)"; + "let testInt32ToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,45--31,61)"; + "let testInt32ToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,45--32,62)"; + "let testInt32ToIntChecked(e1) = Checked.ToInt32 (e1) @ (33,45--33,59)"; + "let testInt32ToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,45--34,61)"; + "let testInt32ToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,45--35,62)"; + "let testInt32ToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,45--36,61)"; + "let testInt32ToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,45--37,62)"; + "let testInt32ToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,45--38,65)"; + "let testInt32ToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,45--39,66)"; + "let testInt32ToByteOperator(e1) = Operators.ToByte (e1) @ (41,45--41,52)"; + "let testInt32ToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,45--42,53)"; + "let testInt32ToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,45--43,53)"; + "let testInt32ToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,45--44,54)"; + "let testInt32ToIntOperator(e1) = e1 @ (45,49--45,51)"; + "let testInt32ToInt32Operator(e1) = e1 @ (46,51--46,53)"; + "let testInt32ToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,45--47,54)"; + "let testInt32ToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,45--48,53)"; + "let testInt32ToUInt64Operator(e1) = Operators.ToInt64 (e1) @ (49,45--49,54)"; + "let testInt32ToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,45--50,57)"; + "let testInt32ToUIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (51,45--51,58)"; + "let testInt32ToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,45--52,55)"; + "let testInt32ToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,45--53,53)"; + "let testInt32ToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,45--54,55)"; + "let testInt32ToCharOperator(e1) = Operators.ToChar (e1) @ (55,45--55,52)"; + "let testInt32ToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,45--56,54)"; + ] + + testOperators "Int32" "int32" excludedTests expectedUnoptimized expectedOptimized + +[] +let ``Test Operator Declarations for UInt32`` () = + let excludedTests = [ + "testUInt32UnaryNegOperator"; + "testUInt32UnaryNegChecked"; + ] + + let expectedUnoptimized = [ + "type OperatorTestsUInt32"; + "let testUInt32EqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,70--4,78)"; + "let testUInt32NotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,70--5,79)"; + "let testUInt32LessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,70--6,78)"; + "let testUInt32LessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,70--7,79)"; + "let testUInt32GreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,70--8,78)"; + "let testUInt32GreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,70--9,79)"; + "let testUInt32AdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,62--11,70)"; + "let testUInt32SubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,62--12,70)"; + "let testUInt32MultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,61--13,70)"; + "let testUInt32DivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,62--14,70)"; + "let testUInt32ModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,62--15,70)"; + "let testUInt32BitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,62--16,72)"; + "let testUInt32BitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,62--17,72)"; + "let testUInt32BitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,62--18,72)"; + "let testUInt32ShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (19,59--19,69)"; + "let testUInt32ShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (20,59--20,69)"; + "let testUInt32AdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,59--24,76)"; + "let testUInt32SubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,59--25,76)"; + "let testUInt32MultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,59--26,76)"; + "let testUInt32ToByteChecked(e1) = Checked.ToByte (e1) @ (29,47--29,62)"; + "let testUInt32ToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,47--30,63)"; + "let testUInt32ToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,47--31,63)"; + "let testUInt32ToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,47--32,64)"; + "let testUInt32ToIntChecked(e1) = Checked.ToInt (e1) @ (33,47--33,61)"; + "let testUInt32ToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,47--34,63)"; + "let testUInt32ToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,47--35,64)"; + "let testUInt32ToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,47--36,63)"; + "let testUInt32ToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,47--37,64)"; + "let testUInt32ToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,47--38,67)"; + "let testUInt32ToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,47--39,68)"; + "let testUInt32ToByteOperator(e1) = Operators.ToByte (e1) @ (41,47--41,54)"; + "let testUInt32ToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,47--42,55)"; + "let testUInt32ToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,47--43,55)"; + "let testUInt32ToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,47--44,56)"; + "let testUInt32ToIntOperator(e1) = Operators.ToInt (e1) @ (45,47--45,53)"; + "let testUInt32ToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,47--46,55)"; + "let testUInt32ToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,47--47,56)"; + "let testUInt32ToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,47--48,55)"; + "let testUInt32ToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,47--49,56)"; + "let testUInt32ToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,47--50,59)"; + "let testUInt32ToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,47--51,60)"; + "let testUInt32ToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,47--52,57)"; + "let testUInt32ToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,47--53,55)"; + "let testUInt32ToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,47--54,57)"; + "let testUInt32ToCharOperator(e1) = Operators.ToChar (e1) @ (55,47--55,54)"; + "let testUInt32ToStringOperator(e1) = Operators.ToString (e1) @ (56,47--56,56)"; + ] + + let expectedOptimized = [ + "type OperatorTestsUInt32"; + "let testUInt32EqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,70--4,78)"; + "let testUInt32NotEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_Equality (e1,e2),False) @ (5,70--5,79)"; + "let testUInt32LessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,70--6,78)"; + "let testUInt32LessThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_GreaterThan (e1,e2),False) @ (7,70--7,79)"; + "let testUInt32GreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,70--8,78)"; + "let testUInt32GreaterThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_LessThan (e1,e2),False) @ (9,70--9,79)"; + "let testUInt32AdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,62--11,70)"; + "let testUInt32SubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,62--12,70)"; + "let testUInt32MultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,61--13,70)"; + "let testUInt32DivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,62--14,70)"; + "let testUInt32ModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,62--15,70)"; + "let testUInt32BitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,62--16,72)"; + "let testUInt32BitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,62--17,72)"; + "let testUInt32BitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,62--18,72)"; + "let testUInt32ShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,Operators.op_BitwiseAnd (e2,31)) @ (19,59--19,69)"; + "let testUInt32ShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,Operators.op_BitwiseAnd (e2,31)) @ (20,59--20,69)"; + "let testUInt32AdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,59--24,76)"; + "let testUInt32SubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,59--25,76)"; + "let testUInt32MultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,59--26,76)"; + "let testUInt32ToByteChecked(e1) = Checked.ToByte (e1) @ (29,47--29,62)"; + "let testUInt32ToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,47--30,63)"; + "let testUInt32ToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,47--31,63)"; + "let testUInt32ToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,47--32,64)"; + "let testUInt32ToIntChecked(e1) = Checked.ToInt32 (e1) @ (33,47--33,61)"; + "let testUInt32ToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,47--34,63)"; + "let testUInt32ToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,47--35,64)"; + "let testUInt32ToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,47--36,63)"; + "let testUInt32ToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,47--37,64)"; + "let testUInt32ToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,47--38,67)"; + "let testUInt32ToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,47--39,68)"; + "let testUInt32ToByteOperator(e1) = Operators.ToByte (e1) @ (41,47--41,54)"; + "let testUInt32ToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,47--42,55)"; + "let testUInt32ToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,47--43,55)"; + "let testUInt32ToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,47--44,56)"; + "let testUInt32ToIntOperator(e1) = Operators.ToInt32 (e1) @ (45,47--45,53)"; + "let testUInt32ToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,47--46,55)"; + "let testUInt32ToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,47--47,56)"; + "let testUInt32ToInt64Operator(e1) = Operators.ToUInt64 (e1) @ (48,47--48,55)"; + "let testUInt32ToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,47--49,56)"; + "let testUInt32ToIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (50,47--50,59)"; + "let testUInt32ToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,47--51,60)"; + "let testUInt32ToSingleOperator(e1) = Operators.ToSingle (Operators.ToDouble (e1)) @ (52,47--52,57)"; + "let testUInt32ToDoubleOperator(e1) = Operators.ToDouble (Operators.ToDouble (e1)) @ (53,47--53,55)"; + "let testUInt32ToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,47--54,57)"; + "let testUInt32ToCharOperator(e1) = Operators.ToChar (e1) @ (55,47--55,54)"; + "let testUInt32ToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,47--56,56)"; + ] + + testOperators "UInt32" "uint32" excludedTests expectedUnoptimized expectedOptimized + +[] +let ``Test Operator Declarations for Int64`` () = + let excludedTests = [ ] + + let expectedUnoptimized = [ + "type OperatorTestsInt64"; + "let testInt64EqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,67--4,75)"; + "let testInt64NotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,67--5,76)"; + "let testInt64LessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,67--6,75)"; + "let testInt64LessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,67--7,76)"; + "let testInt64GreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,67--8,75)"; + "let testInt64GreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,67--9,76)"; + "let testInt64AdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,59--11,67)"; + "let testInt64SubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,59--12,67)"; + "let testInt64MultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,58--13,67)"; + "let testInt64DivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,59--14,67)"; + "let testInt64ModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,59--15,67)"; + "let testInt64BitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,59--16,69)"; + "let testInt64BitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,59--17,69)"; + "let testInt64BitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,59--18,69)"; + "let testInt64ShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (19,57--19,67)"; + "let testInt64ShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (20,57--20,67)"; + "let testInt64UnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,46--22,52)"; + "let testInt64AdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,56--24,73)"; + "let testInt64SubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,56--25,73)"; + "let testInt64MultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,56--26,73)"; + "let testInt64UnaryNegChecked(e1) = Checked.op_UnaryNegation (e1) @ (27,45--27,60)"; + "let testInt64ToByteChecked(e1) = Checked.ToByte (e1) @ (29,45--29,60)"; + "let testInt64ToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,45--30,61)"; + "let testInt64ToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,45--31,61)"; + "let testInt64ToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,45--32,62)"; + "let testInt64ToIntChecked(e1) = Checked.ToInt (e1) @ (33,45--33,59)"; + "let testInt64ToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,45--34,61)"; + "let testInt64ToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,45--35,62)"; + "let testInt64ToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,45--36,61)"; + "let testInt64ToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,45--37,62)"; + "let testInt64ToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,45--38,65)"; + "let testInt64ToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,45--39,66)"; + "let testInt64ToByteOperator(e1) = Operators.ToByte (e1) @ (41,45--41,52)"; + "let testInt64ToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,45--42,53)"; + "let testInt64ToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,45--43,53)"; + "let testInt64ToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,45--44,54)"; + "let testInt64ToIntOperator(e1) = Operators.ToInt (e1) @ (45,45--45,51)"; + "let testInt64ToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,45--46,53)"; + "let testInt64ToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,45--47,54)"; + "let testInt64ToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,45--48,53)"; + "let testInt64ToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,45--49,54)"; + "let testInt64ToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,45--50,57)"; + "let testInt64ToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,45--51,58)"; + "let testInt64ToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,45--52,55)"; + "let testInt64ToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,45--53,53)"; + "let testInt64ToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,45--54,55)"; + "let testInt64ToCharOperator(e1) = Operators.ToChar (e1) @ (55,45--55,52)"; + "let testInt64ToStringOperator(e1) = Operators.ToString (e1) @ (56,45--56,54)"; + ] + + let expectedOptimized = [ + "type OperatorTestsInt64"; + "let testInt64EqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,67--4,75)"; + "let testInt64NotEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_Equality (e1,e2),False) @ (5,67--5,76)"; + "let testInt64LessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,67--6,75)"; + "let testInt64LessThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_GreaterThan (e1,e2),False) @ (7,67--7,76)"; + "let testInt64GreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,67--8,75)"; + "let testInt64GreaterThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_LessThan (e1,e2),False) @ (9,67--9,76)"; + "let testInt64AdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,59--11,67)"; + "let testInt64SubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,59--12,67)"; + "let testInt64MultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,58--13,67)"; + "let testInt64DivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,59--14,67)"; + "let testInt64ModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,59--15,67)"; + "let testInt64BitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,59--16,69)"; + "let testInt64BitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,59--17,69)"; + "let testInt64BitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,59--18,69)"; + "let testInt64ShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,Operators.op_BitwiseAnd (e2,63)) @ (19,57--19,67)"; + "let testInt64ShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,Operators.op_BitwiseAnd (e2,63)) @ (20,57--20,67)"; + "let testInt64UnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,46--22,52)"; + "let testInt64AdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,56--24,73)"; + "let testInt64SubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,56--25,73)"; + "let testInt64MultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,56--26,73)"; + "let testInt64UnaryNegChecked(e1) = Checked.op_Subtraction (0,e1) @ (27,45--27,60)"; + "let testInt64ToByteChecked(e1) = Checked.ToByte (e1) @ (29,45--29,60)"; + "let testInt64ToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,45--30,61)"; + "let testInt64ToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,45--31,61)"; + "let testInt64ToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,45--32,62)"; + "let testInt64ToIntChecked(e1) = Checked.ToInt32 (e1) @ (33,45--33,59)"; + "let testInt64ToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,45--34,61)"; + "let testInt64ToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,45--35,62)"; + "let testInt64ToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,45--36,61)"; + "let testInt64ToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,45--37,62)"; + "let testInt64ToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,45--38,65)"; + "let testInt64ToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,45--39,66)"; + "let testInt64ToByteOperator(e1) = Operators.ToByte (e1) @ (41,45--41,52)"; + "let testInt64ToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,45--42,53)"; + "let testInt64ToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,45--43,53)"; + "let testInt64ToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,45--44,54)"; + "let testInt64ToIntOperator(e1) = Operators.ToInt32 (e1) @ (45,45--45,51)"; + "let testInt64ToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,45--46,53)"; + "let testInt64ToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,45--47,54)"; + "let testInt64ToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,45--48,53)"; + "let testInt64ToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,45--49,54)"; + "let testInt64ToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,45--50,57)"; + "let testInt64ToUIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (51,45--51,58)"; + "let testInt64ToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,45--52,55)"; + "let testInt64ToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,45--53,53)"; + "let testInt64ToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,45--54,55)"; + "let testInt64ToCharOperator(e1) = Operators.ToChar (e1) @ (55,45--55,52)"; + "let testInt64ToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,45--56,54)"; + ] + + testOperators "Int64" "int64" excludedTests expectedUnoptimized expectedOptimized + +[] +let ``Test Operator Declarations for UInt64`` () = + let excludedTests = [ + "testUInt64UnaryNegOperator"; + "testUInt64UnaryNegChecked"; + ] + + let expectedUnoptimized = [ + "type OperatorTestsUInt64"; + "let testUInt64EqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,70--4,78)"; + "let testUInt64NotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,70--5,79)"; + "let testUInt64LessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,70--6,78)"; + "let testUInt64LessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,70--7,79)"; + "let testUInt64GreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,70--8,78)"; + "let testUInt64GreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,70--9,79)"; + "let testUInt64AdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,62--11,70)"; + "let testUInt64SubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,62--12,70)"; + "let testUInt64MultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,61--13,70)"; + "let testUInt64DivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,62--14,70)"; + "let testUInt64ModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,62--15,70)"; + "let testUInt64BitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,62--16,72)"; + "let testUInt64BitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,62--17,72)"; + "let testUInt64BitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,62--18,72)"; + "let testUInt64ShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (19,59--19,69)"; + "let testUInt64ShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (20,59--20,69)"; + "let testUInt64AdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,59--24,76)"; + "let testUInt64SubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,59--25,76)"; + "let testUInt64MultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,59--26,76)"; + "let testUInt64ToByteChecked(e1) = Checked.ToByte (e1) @ (29,47--29,62)"; + "let testUInt64ToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,47--30,63)"; + "let testUInt64ToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,47--31,63)"; + "let testUInt64ToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,47--32,64)"; + "let testUInt64ToIntChecked(e1) = Checked.ToInt (e1) @ (33,47--33,61)"; + "let testUInt64ToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,47--34,63)"; + "let testUInt64ToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,47--35,64)"; + "let testUInt64ToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,47--36,63)"; + "let testUInt64ToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,47--37,64)"; + "let testUInt64ToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,47--38,67)"; + "let testUInt64ToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,47--39,68)"; + "let testUInt64ToByteOperator(e1) = Operators.ToByte (e1) @ (41,47--41,54)"; + "let testUInt64ToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,47--42,55)"; + "let testUInt64ToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,47--43,55)"; + "let testUInt64ToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,47--44,56)"; + "let testUInt64ToIntOperator(e1) = Operators.ToInt (e1) @ (45,47--45,53)"; + "let testUInt64ToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,47--46,55)"; + "let testUInt64ToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,47--47,56)"; + "let testUInt64ToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,47--48,55)"; + "let testUInt64ToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,47--49,56)"; + "let testUInt64ToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,47--50,59)"; + "let testUInt64ToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,47--51,60)"; + "let testUInt64ToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,47--52,57)"; + "let testUInt64ToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,47--53,55)"; + "let testUInt64ToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,47--54,57)"; + "let testUInt64ToCharOperator(e1) = Operators.ToChar (e1) @ (55,47--55,54)"; + "let testUInt64ToStringOperator(e1) = Operators.ToString (e1) @ (56,47--56,56)"; + ] + + let expectedOptimized = [ + "type OperatorTestsUInt64"; + "let testUInt64EqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,70--4,78)"; + "let testUInt64NotEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_Equality (e1,e2),False) @ (5,70--5,79)"; + "let testUInt64LessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,70--6,78)"; + "let testUInt64LessThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_GreaterThan (e1,e2),False) @ (7,70--7,79)"; + "let testUInt64GreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,70--8,78)"; + "let testUInt64GreaterThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_LessThan (e1,e2),False) @ (9,70--9,79)"; + "let testUInt64AdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,62--11,70)"; + "let testUInt64SubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,62--12,70)"; + "let testUInt64MultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,61--13,70)"; + "let testUInt64DivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,62--14,70)"; + "let testUInt64ModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,62--15,70)"; + "let testUInt64BitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,62--16,72)"; + "let testUInt64BitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,62--17,72)"; + "let testUInt64BitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,62--18,72)"; + "let testUInt64ShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,Operators.op_BitwiseAnd (e2,63)) @ (19,59--19,69)"; + "let testUInt64ShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,Operators.op_BitwiseAnd (e2,63)) @ (20,59--20,69)"; + "let testUInt64AdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,59--24,76)"; + "let testUInt64SubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,59--25,76)"; + "let testUInt64MultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,59--26,76)"; + "let testUInt64ToByteChecked(e1) = Checked.ToByte (e1) @ (29,47--29,62)"; + "let testUInt64ToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,47--30,63)"; + "let testUInt64ToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,47--31,63)"; + "let testUInt64ToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,47--32,64)"; + "let testUInt64ToIntChecked(e1) = Checked.ToInt32 (e1) @ (33,47--33,61)"; + "let testUInt64ToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,47--34,63)"; + "let testUInt64ToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,47--35,64)"; + "let testUInt64ToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,47--36,63)"; + "let testUInt64ToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,47--37,64)"; + "let testUInt64ToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,47--38,67)"; + "let testUInt64ToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,47--39,68)"; + "let testUInt64ToByteOperator(e1) = Operators.ToByte (e1) @ (41,47--41,54)"; + "let testUInt64ToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,47--42,55)"; + "let testUInt64ToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,47--43,55)"; + "let testUInt64ToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,47--44,56)"; + "let testUInt64ToIntOperator(e1) = Operators.ToInt32 (e1) @ (45,47--45,53)"; + "let testUInt64ToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,47--46,55)"; + "let testUInt64ToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,47--47,56)"; + "let testUInt64ToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,47--48,55)"; + "let testUInt64ToUInt64Operator(e1) = e1 @ (49,54--49,56)"; + "let testUInt64ToIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (50,47--50,59)"; + "let testUInt64ToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,47--51,60)"; + "let testUInt64ToSingleOperator(e1) = Operators.ToSingle (Operators.ToDouble (e1)) @ (52,47--52,57)"; + "let testUInt64ToDoubleOperator(e1) = Operators.ToDouble (Operators.ToDouble (e1)) @ (53,47--53,55)"; + "let testUInt64ToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,47--54,57)"; + "let testUInt64ToCharOperator(e1) = Operators.ToChar (e1) @ (55,47--55,54)"; + "let testUInt64ToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,47--56,56)"; + ] + + testOperators "UInt64" "uint64" excludedTests expectedUnoptimized expectedOptimized + +[] +let ``Test Operator Declarations for IntPtr`` () = + let excludedTests = [ ] + + let expectedUnoptimized = [ + "type OperatorTestsIntPtr"; + "let testIntPtrEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,76--4,84)"; + "let testIntPtrNotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,76--5,85)"; + "let testIntPtrLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,76--6,84)"; + "let testIntPtrLessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,76--7,85)"; + "let testIntPtrGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,76--8,84)"; + "let testIntPtrGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,76--9,85)"; + "let testIntPtrAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,68--11,76)"; + "let testIntPtrSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,68--12,76)"; + "let testIntPtrMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,67--13,76)"; + "let testIntPtrDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,68--14,76)"; + "let testIntPtrModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,68--15,76)"; + "let testIntPtrBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,68--16,78)"; + "let testIntPtrBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,68--17,78)"; + "let testIntPtrBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,68--18,78)"; + "let testIntPtrShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (19,62--19,72)"; + "let testIntPtrShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (20,62--20,72)"; + "let testIntPtrUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,51--22,57)"; + "let testIntPtrAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,65--24,82)"; + "let testIntPtrSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,65--25,82)"; + "let testIntPtrMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,65--26,82)"; + "let testIntPtrUnaryNegChecked(e1) = Checked.op_UnaryNegation (e1) @ (27,50--27,65)"; + "let testIntPtrToByteChecked(e1) = Checked.ToByte (e1) @ (29,50--29,65)"; + "let testIntPtrToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,50--30,66)"; + "let testIntPtrToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,50--31,66)"; + "let testIntPtrToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,50--32,67)"; + "let testIntPtrToIntChecked(e1) = Checked.ToInt (e1) @ (33,50--33,64)"; + "let testIntPtrToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,50--34,66)"; + "let testIntPtrToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,50--35,67)"; + "let testIntPtrToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,50--36,66)"; + "let testIntPtrToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,50--37,67)"; + "let testIntPtrToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,50--38,70)"; + "let testIntPtrToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,50--39,71)"; + "let testIntPtrToByteOperator(e1) = Operators.ToByte (e1) @ (41,50--41,57)"; + "let testIntPtrToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,50--42,58)"; + "let testIntPtrToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,50--43,58)"; + "let testIntPtrToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,50--44,59)"; + "let testIntPtrToIntOperator(e1) = Operators.ToInt (e1) @ (45,50--45,56)"; + "let testIntPtrToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,50--46,58)"; + "let testIntPtrToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,50--47,59)"; + "let testIntPtrToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,50--48,58)"; + "let testIntPtrToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,50--49,59)"; + "let testIntPtrToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,50--50,62)"; + "let testIntPtrToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,50--51,63)"; + "let testIntPtrToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,50--52,60)"; + "let testIntPtrToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,50--53,58)"; + "let testIntPtrToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,50--54,60)"; + "let testIntPtrToCharOperator(e1) = Operators.ToChar (e1) @ (55,50--55,57)"; + "let testIntPtrToStringOperator(e1) = Operators.ToString (e1) @ (56,50--56,59)"; + ] + + let expectedOptimized = [ + "type OperatorTestsIntPtr"; + "let testIntPtrEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,76--4,84)"; + "let testIntPtrNotEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_Equality (e1,e2),False) @ (5,76--5,85)"; + "let testIntPtrLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,76--6,84)"; + "let testIntPtrLessThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_GreaterThan (e1,e2),False) @ (7,76--7,85)"; + "let testIntPtrGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,76--8,84)"; + "let testIntPtrGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_LessThan (e1,e2),False) @ (9,76--9,85)"; + "let testIntPtrAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,68--11,76)"; + "let testIntPtrSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,68--12,76)"; + "let testIntPtrMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,67--13,76)"; + "let testIntPtrDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,68--14,76)"; + "let testIntPtrModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,68--15,76)"; + "let testIntPtrBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,68--16,78)"; + "let testIntPtrBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,68--17,78)"; + "let testIntPtrBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,68--18,78)"; + "let testIntPtrShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (19,62--19,72)"; + "let testIntPtrShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (20,62--20,72)"; + "let testIntPtrUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,51--22,57)"; + "let testIntPtrAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,65--24,82)"; + "let testIntPtrSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,65--25,82)"; + "let testIntPtrMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,65--26,82)"; + "let testIntPtrUnaryNegChecked(e1) = Checked.op_Subtraction (0,e1) @ (27,50--27,65)"; + "let testIntPtrToByteChecked(e1) = Checked.ToByte (e1) @ (29,50--29,65)"; + "let testIntPtrToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,50--30,66)"; + "let testIntPtrToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,50--31,66)"; + "let testIntPtrToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,50--32,67)"; + "let testIntPtrToIntChecked(e1) = Checked.ToInt32 (e1) @ (33,50--33,64)"; + "let testIntPtrToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,50--34,66)"; + "let testIntPtrToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,50--35,67)"; + "let testIntPtrToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,50--36,66)"; + "let testIntPtrToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,50--37,67)"; + "let testIntPtrToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,50--38,70)"; + "let testIntPtrToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,50--39,71)"; + "let testIntPtrToByteOperator(e1) = Operators.ToByte (e1) @ (41,50--41,57)"; + "let testIntPtrToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,50--42,58)"; + "let testIntPtrToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,50--43,58)"; + "let testIntPtrToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,50--44,59)"; + "let testIntPtrToIntOperator(e1) = Operators.ToInt32 (e1) @ (45,50--45,56)"; + "let testIntPtrToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,50--46,58)"; + "let testIntPtrToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,50--47,59)"; + "let testIntPtrToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,50--48,58)"; + "let testIntPtrToUInt64Operator(e1) = Operators.ToInt64 (e1) @ (49,50--49,59)"; + "let testIntPtrToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,50--50,62)"; + "let testIntPtrToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,50--51,63)"; + "let testIntPtrToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,50--52,60)"; + "let testIntPtrToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,50--53,58)"; + "let testIntPtrToDecimalOperator(e1) = Convert.ToDecimal (Operators.ToInt64 (e1)) @ (54,50--54,60)"; + "let testIntPtrToCharOperator(e1) = Operators.ToChar (e1) @ (55,50--55,57)"; + "let testIntPtrToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,50--56,59)"; + ] + + testOperators "IntPtr" "nativeint" excludedTests expectedUnoptimized expectedOptimized + +[] +let ``Test Operator Declarations for UIntPtr`` () = + let excludedTests = [ + "testUIntPtrUnaryNegOperator"; + "testUIntPtrUnaryNegChecked"; + ] + + let expectedUnoptimized = [ + "type OperatorTestsUIntPtr"; + "let testUIntPtrEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,79--4,87)"; + "let testUIntPtrNotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,79--5,88)"; + "let testUIntPtrLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,79--6,87)"; + "let testUIntPtrLessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,79--7,88)"; + "let testUIntPtrGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,79--8,87)"; + "let testUIntPtrGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,79--9,88)"; + "let testUIntPtrAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,71--11,79)"; + "let testUIntPtrSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,71--12,79)"; + "let testUIntPtrMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,70--13,79)"; + "let testUIntPtrDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,71--14,79)"; + "let testUIntPtrModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,71--15,79)"; + "let testUIntPtrBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,71--16,81)"; + "let testUIntPtrBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,71--17,81)"; + "let testUIntPtrBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,71--18,81)"; + "let testUIntPtrShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (19,64--19,74)"; + "let testUIntPtrShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (20,64--20,74)"; + "let testUIntPtrAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,68--24,85)"; + "let testUIntPtrSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,68--25,85)"; + "let testUIntPtrMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,68--26,85)"; + "let testUIntPtrToByteChecked(e1) = Checked.ToByte (e1) @ (29,52--29,67)"; + "let testUIntPtrToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,52--30,68)"; + "let testUIntPtrToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,52--31,68)"; + "let testUIntPtrToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,52--32,69)"; + "let testUIntPtrToIntChecked(e1) = Checked.ToInt (e1) @ (33,52--33,66)"; + "let testUIntPtrToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,52--34,68)"; + "let testUIntPtrToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,52--35,69)"; + "let testUIntPtrToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,52--36,68)"; + "let testUIntPtrToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,52--37,69)"; + "let testUIntPtrToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,52--38,72)"; + "let testUIntPtrToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,52--39,73)"; + "let testUIntPtrToByteOperator(e1) = Operators.ToByte (e1) @ (41,52--41,59)"; + "let testUIntPtrToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,52--42,60)"; + "let testUIntPtrToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,52--43,60)"; + "let testUIntPtrToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,52--44,61)"; + "let testUIntPtrToIntOperator(e1) = Operators.ToInt (e1) @ (45,52--45,58)"; + "let testUIntPtrToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,52--46,60)"; + "let testUIntPtrToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,52--47,61)"; + "let testUIntPtrToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,52--48,60)"; + "let testUIntPtrToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,52--49,61)"; + "let testUIntPtrToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,52--50,64)"; + "let testUIntPtrToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,52--51,65)"; + "let testUIntPtrToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,52--52,62)"; + "let testUIntPtrToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,52--53,60)"; + "let testUIntPtrToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,52--54,62)"; + "let testUIntPtrToCharOperator(e1) = Operators.ToChar (e1) @ (55,52--55,59)"; + "let testUIntPtrToStringOperator(e1) = Operators.ToString (e1) @ (56,52--56,61)"; + ] + + let expectedOptimized = [ + "type OperatorTestsUIntPtr"; + "let testUIntPtrEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,79--4,87)"; + "let testUIntPtrNotEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_Equality (e1,e2),False) @ (5,79--5,88)"; + "let testUIntPtrLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,79--6,87)"; + "let testUIntPtrLessThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_GreaterThan (e1,e2),False) @ (7,79--7,88)"; + "let testUIntPtrGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,79--8,87)"; + "let testUIntPtrGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_LessThan (e1,e2),False) @ (9,79--9,88)"; + "let testUIntPtrAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,71--11,79)"; + "let testUIntPtrSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,71--12,79)"; + "let testUIntPtrMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,70--13,79)"; + "let testUIntPtrDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,71--14,79)"; + "let testUIntPtrModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,71--15,79)"; + "let testUIntPtrBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,71--16,81)"; + "let testUIntPtrBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,71--17,81)"; + "let testUIntPtrBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,71--18,81)"; + "let testUIntPtrShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (19,64--19,74)"; + "let testUIntPtrShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (20,64--20,74)"; + "let testUIntPtrAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,68--24,85)"; + "let testUIntPtrSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,68--25,85)"; + "let testUIntPtrMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,68--26,85)"; + "let testUIntPtrToByteChecked(e1) = Checked.ToByte (e1) @ (29,52--29,67)"; + "let testUIntPtrToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,52--30,68)"; + "let testUIntPtrToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,52--31,68)"; + "let testUIntPtrToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,52--32,69)"; + "let testUIntPtrToIntChecked(e1) = Checked.ToInt32 (e1) @ (33,52--33,66)"; + "let testUIntPtrToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,52--34,68)"; + "let testUIntPtrToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,52--35,69)"; + "let testUIntPtrToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,52--36,68)"; + "let testUIntPtrToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,52--37,69)"; + "let testUIntPtrToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,52--38,72)"; + "let testUIntPtrToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,52--39,73)"; + "let testUIntPtrToByteOperator(e1) = Operators.ToByte (e1) @ (41,52--41,59)"; + "let testUIntPtrToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,52--42,60)"; + "let testUIntPtrToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,52--43,60)"; + "let testUIntPtrToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,52--44,61)"; + "let testUIntPtrToIntOperator(e1) = Operators.ToInt32 (e1) @ (45,52--45,58)"; + "let testUIntPtrToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,52--46,60)"; + "let testUIntPtrToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,52--47,61)"; + "let testUIntPtrToInt64Operator(e1) = Operators.ToUInt64 (e1) @ (48,52--48,60)"; + "let testUIntPtrToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,52--49,61)"; + "let testUIntPtrToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,52--50,64)"; + "let testUIntPtrToUIntPtrOperator(e1) = e1 @ (51,63--51,65)"; + "let testUIntPtrToSingleOperator(e1) = Operators.ToSingle (Operators.ToDouble (e1)) @ (52,52--52,62)"; + "let testUIntPtrToDoubleOperator(e1) = Operators.ToDouble (Operators.ToDouble (e1)) @ (53,52--53,60)"; + "let testUIntPtrToDecimalOperator(e1) = Convert.ToDecimal (Operators.ToUInt64 (e1)) @ (54,52--54,62)"; + "let testUIntPtrToCharOperator(e1) = Operators.ToChar (e1) @ (55,52--55,59)"; + "let testUIntPtrToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,52--56,61)"; + ] + + testOperators "UIntPtr" "unativeint" excludedTests expectedUnoptimized expectedOptimized + +[] +let ``Test Operator Declarations for Single`` () = + let excludedTests = [ + "testSingleBitwiseAndOperator"; + "testSingleBitwiseOrOperator"; + "testSingleBitwiseXorOperator"; + "testSingleShiftLeftOperator"; + "testSingleShiftRightOperator"; + ] + + let expectedUnoptimized = [ + "type OperatorTestsSingle"; + "let testSingleEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,72--4,80)"; + "let testSingleNotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,72--5,81)"; + "let testSingleLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,72--6,80)"; + "let testSingleLessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,72--7,81)"; + "let testSingleGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,72--8,80)"; + "let testSingleGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,72--9,81)"; + "let testSingleAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,64--11,72)"; + "let testSingleSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,64--12,72)"; + "let testSingleMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,63--13,72)"; + "let testSingleDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,64--14,72)"; + "let testSingleModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,64--15,72)"; + "let testSingleUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,49--22,55)"; + "let testSingleAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,61--24,78)"; + "let testSingleSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,61--25,78)"; + "let testSingleMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,61--26,78)"; + "let testSingleUnaryNegChecked(e1) = Checked.op_UnaryNegation (e1) @ (27,48--27,63)"; + "let testSingleToByteChecked(e1) = Checked.ToByte (e1) @ (29,48--29,63)"; + "let testSingleToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,48--30,64)"; + "let testSingleToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,48--31,64)"; + "let testSingleToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,48--32,65)"; + "let testSingleToIntChecked(e1) = Checked.ToInt (e1) @ (33,48--33,62)"; + "let testSingleToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,48--34,64)"; + "let testSingleToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,48--35,65)"; + "let testSingleToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,48--36,64)"; + "let testSingleToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,48--37,65)"; + "let testSingleToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,48--38,68)"; + "let testSingleToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,48--39,69)"; + "let testSingleToByteOperator(e1) = Operators.ToByte (e1) @ (41,48--41,55)"; + "let testSingleToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,48--42,56)"; + "let testSingleToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,48--43,56)"; + "let testSingleToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,48--44,57)"; + "let testSingleToIntOperator(e1) = Operators.ToInt (e1) @ (45,48--45,54)"; + "let testSingleToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,48--46,56)"; + "let testSingleToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,48--47,57)"; + "let testSingleToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,48--48,56)"; + "let testSingleToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,48--49,57)"; + "let testSingleToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,48--50,60)"; + "let testSingleToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,48--51,61)"; + "let testSingleToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,48--52,58)"; + "let testSingleToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,48--53,56)"; + "let testSingleToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,48--54,58)"; + "let testSingleToCharOperator(e1) = Operators.ToChar (e1) @ (55,48--55,55)"; + "let testSingleToStringOperator(e1) = Operators.ToString (e1) @ (56,48--56,57)"; + ] + + let expectedOptimized = [ + "type OperatorTestsSingle"; + "let testSingleEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,72--4,80)"; + "let testSingleNotEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_Equality (e1,e2),False) @ (5,72--5,81)"; + "let testSingleLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,72--6,80)"; + "let testSingleLessThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_GreaterThan (e1,e2),False) @ (7,72--7,81)"; + "let testSingleGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,72--8,80)"; + "let testSingleGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_LessThan (e1,e2),False) @ (9,72--9,81)"; + "let testSingleAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,64--11,72)"; + "let testSingleSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,64--12,72)"; + "let testSingleMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,63--13,72)"; + "let testSingleDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,64--14,72)"; + "let testSingleModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,64--15,72)"; + "let testSingleUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,49--22,55)"; + "let testSingleAdditionChecked(e1) (e2) = Operators.op_Addition (e1,e2) @ (24,61--24,78)"; + "let testSingleSubtractionChecked(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (25,61--25,78)"; + "let testSingleMultiplyChecked(e1) (e2) = Operators.op_Multiply (e1,e2) @ (26,61--26,78)"; + "let testSingleUnaryNegChecked(e1) = Operators.op_UnaryNegation (e1) @ (27,48--27,63)"; + "let testSingleToByteChecked(e1) = Checked.ToByte (e1) @ (29,48--29,63)"; + "let testSingleToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,48--30,64)"; + "let testSingleToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,48--31,64)"; + "let testSingleToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,48--32,65)"; + "let testSingleToIntChecked(e1) = Checked.ToInt32 (e1) @ (33,48--33,62)"; + "let testSingleToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,48--34,64)"; + "let testSingleToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,48--35,65)"; + "let testSingleToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,48--36,64)"; + "let testSingleToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,48--37,65)"; + "let testSingleToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,48--38,68)"; + "let testSingleToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,48--39,69)"; + "let testSingleToByteOperator(e1) = Operators.ToByte (e1) @ (41,48--41,55)"; + "let testSingleToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,48--42,56)"; + "let testSingleToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,48--43,56)"; + "let testSingleToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,48--44,57)"; + "let testSingleToIntOperator(e1) = Operators.ToInt32 (e1) @ (45,48--45,54)"; + "let testSingleToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,48--46,56)"; + "let testSingleToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,48--47,57)"; + "let testSingleToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,48--48,56)"; + "let testSingleToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,48--49,57)"; + "let testSingleToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,48--50,60)"; + "let testSingleToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,48--51,61)"; + "let testSingleToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,48--52,58)"; + "let testSingleToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,48--53,56)"; + "let testSingleToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,48--54,58)"; + "let testSingleToCharOperator(e1) = Operators.ToChar (e1) @ (55,48--55,55)"; + "let testSingleToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,48--56,57)"; + ] + + testOperators "Single" "float32" excludedTests expectedUnoptimized expectedOptimized + +[] +let ``Test Operator Declarations for Double`` () = + let excludedTests = [ + "testDoubleBitwiseAndOperator"; + "testDoubleBitwiseOrOperator"; + "testDoubleBitwiseXorOperator"; + "testDoubleShiftLeftOperator"; + "testDoubleShiftRightOperator"; + ] + + let expectedUnoptimized = [ + "type OperatorTestsDouble"; + "let testDoubleEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,68--4,76)"; + "let testDoubleNotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,68--5,77)"; + "let testDoubleLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,68--6,76)"; + "let testDoubleLessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,68--7,77)"; + "let testDoubleGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,68--8,76)"; + "let testDoubleGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,68--9,77)"; + "let testDoubleAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,60--11,68)"; + "let testDoubleSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,60--12,68)"; + "let testDoubleMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,59--13,68)"; + "let testDoubleDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,60--14,68)"; + "let testDoubleModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,60--15,68)"; + "let testDoubleUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,47--22,53)"; + "let testDoubleAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,57--24,74)"; + "let testDoubleSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,57--25,74)"; + "let testDoubleMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,57--26,74)"; + "let testDoubleUnaryNegChecked(e1) = Checked.op_UnaryNegation (e1) @ (27,46--27,61)"; + "let testDoubleToByteChecked(e1) = Checked.ToByte (e1) @ (29,46--29,61)"; + "let testDoubleToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,46--30,62)"; + "let testDoubleToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,46--31,62)"; + "let testDoubleToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,46--32,63)"; + "let testDoubleToIntChecked(e1) = Checked.ToInt (e1) @ (33,46--33,60)"; + "let testDoubleToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,46--34,62)"; + "let testDoubleToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,46--35,63)"; + "let testDoubleToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,46--36,62)"; + "let testDoubleToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,46--37,63)"; + "let testDoubleToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,46--38,66)"; + "let testDoubleToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,46--39,67)"; + "let testDoubleToByteOperator(e1) = Operators.ToByte (e1) @ (41,46--41,53)"; + "let testDoubleToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,46--42,54)"; + "let testDoubleToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,46--43,54)"; + "let testDoubleToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,46--44,55)"; + "let testDoubleToIntOperator(e1) = Operators.ToInt (e1) @ (45,46--45,52)"; + "let testDoubleToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,46--46,54)"; + "let testDoubleToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,46--47,55)"; + "let testDoubleToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,46--48,54)"; + "let testDoubleToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,46--49,55)"; + "let testDoubleToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,46--50,58)"; + "let testDoubleToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,46--51,59)"; + "let testDoubleToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,46--52,56)"; + "let testDoubleToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,46--53,54)"; + "let testDoubleToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,46--54,56)"; + "let testDoubleToCharOperator(e1) = Operators.ToChar (e1) @ (55,46--55,53)"; + "let testDoubleToStringOperator(e1) = Operators.ToString (e1) @ (56,46--56,55)"; + ] + + let expectedOptimized = [ + "type OperatorTestsDouble"; + "let testDoubleEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,68--4,76)"; + "let testDoubleNotEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_Equality (e1,e2),False) @ (5,68--5,77)"; + "let testDoubleLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,68--6,76)"; + "let testDoubleLessThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_GreaterThan (e1,e2),False) @ (7,68--7,77)"; + "let testDoubleGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,68--8,76)"; + "let testDoubleGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_LessThan (e1,e2),False) @ (9,68--9,77)"; + "let testDoubleAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,60--11,68)"; + "let testDoubleSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,60--12,68)"; + "let testDoubleMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,59--13,68)"; + "let testDoubleDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,60--14,68)"; + "let testDoubleModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,60--15,68)"; + "let testDoubleUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,47--22,53)"; + "let testDoubleAdditionChecked(e1) (e2) = Operators.op_Addition (e1,e2) @ (24,57--24,74)"; + "let testDoubleSubtractionChecked(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (25,57--25,74)"; + "let testDoubleMultiplyChecked(e1) (e2) = Operators.op_Multiply (e1,e2) @ (26,57--26,74)"; + "let testDoubleUnaryNegChecked(e1) = Operators.op_UnaryNegation (e1) @ (27,46--27,61)"; + "let testDoubleToByteChecked(e1) = Checked.ToByte (e1) @ (29,46--29,61)"; + "let testDoubleToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,46--30,62)"; + "let testDoubleToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,46--31,62)"; + "let testDoubleToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,46--32,63)"; + "let testDoubleToIntChecked(e1) = Checked.ToInt32 (e1) @ (33,46--33,60)"; + "let testDoubleToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,46--34,62)"; + "let testDoubleToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,46--35,63)"; + "let testDoubleToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,46--36,62)"; + "let testDoubleToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,46--37,63)"; + "let testDoubleToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,46--38,66)"; + "let testDoubleToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,46--39,67)"; + "let testDoubleToByteOperator(e1) = Operators.ToByte (e1) @ (41,46--41,53)"; + "let testDoubleToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,46--42,54)"; + "let testDoubleToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,46--43,54)"; + "let testDoubleToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,46--44,55)"; + "let testDoubleToIntOperator(e1) = Operators.ToInt32 (e1) @ (45,46--45,52)"; + "let testDoubleToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,46--46,54)"; + "let testDoubleToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,46--47,55)"; + "let testDoubleToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,46--48,54)"; + "let testDoubleToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,46--49,55)"; + "let testDoubleToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,46--50,58)"; + "let testDoubleToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,46--51,59)"; + "let testDoubleToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,46--52,56)"; + "let testDoubleToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,46--53,54)"; + "let testDoubleToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,46--54,56)"; + "let testDoubleToCharOperator(e1) = Operators.ToChar (e1) @ (55,46--55,53)"; + "let testDoubleToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,46--56,55)"; + ] + + testOperators "Double" "float" excludedTests expectedUnoptimized expectedOptimized + +[] +let ``Test Operator Declarations for Decimal`` () = + let excludedTests = [ + "testDecimalBitwiseAndOperator"; + "testDecimalBitwiseOrOperator"; + "testDecimalBitwiseXorOperator"; + "testDecimalShiftLeftOperator"; + "testDecimalShiftRightOperator"; + "testDecimalUnaryNegOperator"; + "testDecimalSubtractionChecked"; + "testDecimalMultiplyChecked"; + "testDecimalUnaryNegChecked"; + "testDecimalToIntPtrChecked"; + "testDecimalToUIntPtrChecked"; + "testDecimalToIntPtrOperator"; + "testDecimalToUIntPtrOperator"; + ] + + let expectedUnoptimized = [ + "type OperatorTestsDecimal"; + "let testDecimalEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,73--4,81)"; + "let testDecimalNotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,73--5,82)"; + "let testDecimalLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,73--6,81)"; + "let testDecimalLessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,73--7,82)"; + "let testDecimalGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,73--8,81)"; + "let testDecimalGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,73--9,82)"; + "let testDecimalAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,65--11,73)"; + "let testDecimalSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,65--12,73)"; + "let testDecimalMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,64--13,73)"; + "let testDecimalDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,65--14,73)"; + "let testDecimalModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,65--15,73)"; + "let testDecimalAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,62--24,79)"; + "let testDecimalToByteChecked(e1) = Checked.ToByte (e1) @ (29,49--29,64)"; + "let testDecimalToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,49--30,65)"; + "let testDecimalToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,49--31,65)"; + "let testDecimalToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,49--32,66)"; + "let testDecimalToIntChecked(e1) = Checked.ToInt (e1) @ (33,49--33,63)"; + "let testDecimalToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,49--34,65)"; + "let testDecimalToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,49--35,66)"; + "let testDecimalToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,49--36,65)"; + "let testDecimalToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,49--37,66)"; + "let testDecimalToByteOperator(e1) = Operators.ToByte (e1) @ (41,49--41,56)"; + "let testDecimalToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,49--42,57)"; + "let testDecimalToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,49--43,57)"; + "let testDecimalToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,49--44,58)"; + "let testDecimalToIntOperator(e1) = Operators.ToInt (e1) @ (45,49--45,55)"; + "let testDecimalToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,49--46,57)"; + "let testDecimalToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,49--47,58)"; + "let testDecimalToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,49--48,57)"; + "let testDecimalToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,49--49,58)"; + "let testDecimalToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,49--52,59)"; + "let testDecimalToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,49--53,57)"; + "let testDecimalToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,49--54,59)"; + "let testDecimalToCharOperator(e1) = Operators.ToChar (e1) @ (55,49--55,56)"; + "let testDecimalToStringOperator(e1) = Operators.ToString (e1) @ (56,49--56,58)"; + ] + + let expectedOptimized = [ + "type OperatorTestsDecimal"; + "let testDecimalEqualsOperator(e1) (e2) = Decimal.op_Equality (e1,e2) @ (4,73--4,81)"; + "let testDecimalNotEqualsOperator(e1) (e2) = Operators.op_Equality (Decimal.op_Equality (e1,e2),False) @ (5,73--5,82)"; + "let testDecimalLessThanOperator(e1) (e2) = Decimal.op_LessThan (e1,e2) @ (6,73--6,81)"; + "let testDecimalLessThanOrEqualsOperator(e1) (e2) = Decimal.op_LessThanOrEqual (e1,e2) @ (7,73--7,82)"; + "let testDecimalGreaterThanOperator(e1) (e2) = Decimal.op_GreaterThan (e1,e2) @ (8,73--8,81)"; + "let testDecimalGreaterThanOrEqualsOperator(e1) (e2) = Decimal.op_GreaterThanOrEqual (e1,e2) @ (9,73--9,82)"; + "let testDecimalAdditionOperator(e1) (e2) = Decimal.op_Addition (e1,e2) @ (11,65--11,73)"; + "let testDecimalSubtractionOperator(e1) (e2) = Decimal.op_Subtraction (e1,e2) @ (12,65--12,73)"; + "let testDecimalMultiplyOperator(e1) (e2) = Decimal.op_Multiply (e1,e2) @ (13,64--13,73)"; + "let testDecimalDivisionOperator(e1) (e2) = Decimal.op_Division (e1,e2) @ (14,65--14,73)"; + "let testDecimalModulusOperator(e1) (e2) = Decimal.op_Modulus (e1,e2) @ (15,65--15,73)"; + "let testDecimalAdditionChecked(e1) (e2) = Decimal.op_Addition (e1,e2) @ (24,62--24,79)"; + "let testDecimalToByteChecked(e1) = Decimal.op_Explicit (e1) @ (29,49--29,64)"; + "let testDecimalToSByteChecked(e1) = Decimal.op_Explicit (e1) @ (30,49--30,65)"; + "let testDecimalToInt16Checked(e1) = Decimal.op_Explicit (e1) @ (31,49--31,65)"; + "let testDecimalToUInt16Checked(e1) = Decimal.op_Explicit (e1) @ (32,49--32,66)"; + "let testDecimalToIntChecked(e1) = Decimal.op_Explicit (e1) @ (33,49--33,63)"; + "let testDecimalToInt32Checked(e1) = Decimal.op_Explicit (e1) @ (34,49--34,65)"; + "let testDecimalToUInt32Checked(e1) = Decimal.op_Explicit (e1) @ (35,49--35,66)"; + "let testDecimalToInt64Checked(e1) = Decimal.op_Explicit (e1) @ (36,49--36,65)"; + "let testDecimalToUInt64Checked(e1) = Decimal.op_Explicit (e1) @ (37,49--37,66)"; + "let testDecimalToByteOperator(e1) = Decimal.op_Explicit (e1) @ (41,49--41,56)"; + "let testDecimalToSByteOperator(e1) = Decimal.op_Explicit (e1) @ (42,49--42,57)"; + "let testDecimalToInt16Operator(e1) = Decimal.op_Explicit (e1) @ (43,49--43,57)"; + "let testDecimalToUInt16Operator(e1) = Decimal.op_Explicit (e1) @ (44,49--44,58)"; + "let testDecimalToIntOperator(e1) = Decimal.op_Explicit (e1) @ (45,49--45,55)"; + "let testDecimalToInt32Operator(e1) = Decimal.op_Explicit (e1) @ (46,49--46,57)"; + "let testDecimalToUInt32Operator(e1) = Decimal.op_Explicit (e1) @ (47,49--47,58)"; + "let testDecimalToInt64Operator(e1) = Decimal.op_Explicit (e1) @ (48,49--48,57)"; + "let testDecimalToUInt64Operator(e1) = Decimal.op_Explicit (e1) @ (49,49--49,58)"; + "let testDecimalToSingleOperator(e1) = Decimal.op_Explicit (e1) @ (52,49--52,59)"; + "let testDecimalToDoubleOperator(e1) = Convert.ToDouble (e1) @ (53,49--53,57)"; + "let testDecimalToDecimalOperator(e1) = e1 @ (54,57--54,59)"; + "let testDecimalToCharOperator(e1) = Decimal.op_Explicit (e1) @ (55,49--55,56)"; + "let testDecimalToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,49--56,58)"; + ] + + testOperators "Decimal" "decimal" excludedTests expectedUnoptimized expectedOptimized + +[] +let ``Test Operator Declarations for Char`` () = + let excludedTests = [ + "testCharSubtractionOperator"; + "testCharMultiplyOperator"; + "testCharDivisionOperator"; + "testCharModulusOperator"; + "testCharBitwiseAndOperator"; + "testCharBitwiseOrOperator"; + "testCharBitwiseXorOperator"; + "testCharShiftLeftOperator"; + "testCharShiftRightOperator"; + "testCharUnaryNegOperator"; + "testCharSubtractionChecked"; + "testCharMultiplyChecked"; + "testCharUnaryNegChecked"; + "testCharToDecimalOperator"; + ] + + let expectedUnoptimized = [ + "type OperatorTestsChar"; + "let testCharEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,64--4,72)"; + "let testCharNotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,64--5,73)"; + "let testCharLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,64--6,72)"; + "let testCharLessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,64--7,73)"; + "let testCharGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,64--8,72)"; + "let testCharGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,64--9,73)"; + "let testCharAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,56--11,64)"; + "let testCharAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,53--24,70)"; + "let testCharToByteChecked(e1) = Checked.ToByte (e1) @ (29,43--29,58)"; + "let testCharToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,43--30,59)"; + "let testCharToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,43--31,59)"; + "let testCharToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,43--32,60)"; + "let testCharToIntChecked(e1) = Checked.ToInt (e1) @ (33,43--33,57)"; + "let testCharToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,43--34,59)"; + "let testCharToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,43--35,60)"; + "let testCharToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,43--36,59)"; + "let testCharToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,43--37,60)"; + "let testCharToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,43--38,63)"; + "let testCharToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,43--39,64)"; + "let testCharToByteOperator(e1) = Operators.ToByte (e1) @ (41,43--41,50)"; + "let testCharToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,43--42,51)"; + "let testCharToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,43--43,51)"; + "let testCharToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,43--44,52)"; + "let testCharToIntOperator(e1) = Operators.ToInt (e1) @ (45,43--45,49)"; + "let testCharToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,43--46,51)"; + "let testCharToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,43--47,52)"; + "let testCharToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,43--48,51)"; + "let testCharToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,43--49,52)"; + "let testCharToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,43--50,55)"; + "let testCharToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,43--51,56)"; + "let testCharToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,43--52,53)"; + "let testCharToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,43--53,51)"; + "let testCharToCharOperator(e1) = Operators.ToChar (e1) @ (55,43--55,50)"; + "let testCharToStringOperator(e1) = Operators.ToString (e1) @ (56,43--56,52)"; + ] + + let expectedOptimized = [ + "type OperatorTestsChar"; + "let testCharEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,64--4,72)"; + "let testCharNotEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_Equality (e1,e2),False) @ (5,64--5,73)"; + "let testCharLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,64--6,72)"; + "let testCharLessThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_GreaterThan (e1,e2),False) @ (7,64--7,73)"; + "let testCharGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,64--8,72)"; + "let testCharGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_LessThan (e1,e2),False) @ (9,64--9,73)"; + "let testCharAdditionOperator(e1) (e2) = Operators.ToChar (Operators.op_Addition (e1,e2)) @ (11,56--11,64)"; + "let testCharAdditionChecked(e1) (e2) = Operators.ToChar (Checked.op_Addition (e1,e2)) @ (24,53--24,70)"; + "let testCharToByteChecked(e1) = Checked.ToByte (e1) @ (29,43--29,58)"; + "let testCharToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,43--30,59)"; + "let testCharToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,43--31,59)"; + "let testCharToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,43--32,60)"; + "let testCharToIntChecked(e1) = Checked.ToInt32 (e1) @ (33,43--33,57)"; + "let testCharToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,43--34,59)"; + "let testCharToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,43--35,60)"; + "let testCharToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,43--36,59)"; + "let testCharToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,43--37,60)"; + "let testCharToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,43--38,63)"; + "let testCharToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,43--39,64)"; + "let testCharToByteOperator(e1) = Operators.ToByte (e1) @ (41,43--41,50)"; + "let testCharToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,43--42,51)"; + "let testCharToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,43--43,51)"; + "let testCharToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,43--44,52)"; + "let testCharToIntOperator(e1) = Operators.ToInt32 (e1) @ (45,43--45,49)"; + "let testCharToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,43--46,51)"; + "let testCharToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,43--47,52)"; + "let testCharToInt64Operator(e1) = Operators.ToUInt64 (e1) @ (48,43--48,51)"; + "let testCharToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,43--49,52)"; + "let testCharToIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (50,43--50,55)"; + "let testCharToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,43--51,56)"; + "let testCharToSingleOperator(e1) = Operators.ToSingle (Operators.ToDouble (e1)) @ (52,43--52,53)"; + "let testCharToDoubleOperator(e1) = Operators.ToDouble (Operators.ToDouble (e1)) @ (53,43--53,51)"; + "let testCharToCharOperator(e1) = Operators.ToChar (e1) @ (55,43--55,50)"; + "let testCharToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,43--56,52)"; + ] + + testOperators "Char" "char" excludedTests expectedUnoptimized expectedOptimized + +[] +let ``Test Operator Declarations for String`` () = + let excludedTests = [ + "testStringSubtractionOperator"; + "testStringMultiplyOperator"; + "testStringDivisionOperator"; + "testStringModulusOperator"; + "testStringBitwiseAndOperator"; + "testStringBitwiseOrOperator"; + "testStringBitwiseXorOperator"; + "testStringShiftLeftOperator"; + "testStringShiftRightOperator"; + "testStringUnaryNegOperator"; + "testStringSubtractionChecked"; + "testStringMultiplyChecked"; + "testStringUnaryNegChecked"; + "testStringToIntPtrChecked"; + "testStringToUIntPtrChecked"; + "testStringToIntPtrOperator"; + "testStringToUIntPtrOperator"; + ] + + let expectedUnoptimized = [ + "type OperatorTestsString"; + "let testStringEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,70--4,78)"; + "let testStringNotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,70--5,79)"; + "let testStringLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,70--6,78)"; + "let testStringLessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,70--7,79)"; + "let testStringGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,70--8,78)"; + "let testStringGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,70--9,79)"; + "let testStringAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,62--11,70)"; + "let testStringAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,59--24,76)"; + "let testStringToByteChecked(e1) = Checked.ToByte (e1) @ (29,47--29,62)"; + "let testStringToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,47--30,63)"; + "let testStringToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,47--31,63)"; + "let testStringToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,47--32,64)"; + "let testStringToIntChecked(e1) = Checked.ToInt (e1) @ (33,47--33,61)"; + "let testStringToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,47--34,63)"; + "let testStringToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,47--35,64)"; + "let testStringToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,47--36,63)"; + "let testStringToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,47--37,64)"; + "let testStringToByteOperator(e1) = Operators.ToByte (e1) @ (41,47--41,54)"; + "let testStringToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,47--42,55)"; + "let testStringToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,47--43,55)"; + "let testStringToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,47--44,56)"; + "let testStringToIntOperator(e1) = Operators.ToInt (e1) @ (45,47--45,53)"; + "let testStringToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,47--46,55)"; + "let testStringToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,47--47,56)"; + "let testStringToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,47--48,55)"; + "let testStringToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,47--49,56)"; + "let testStringToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,47--52,57)"; + "let testStringToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,47--53,55)"; + "let testStringToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,47--54,57)"; + "let testStringToCharOperator(e1) = Operators.ToChar (e1) @ (55,47--55,54)"; + "let testStringToStringOperator(e1) = Operators.ToString (e1) @ (56,47--56,56)"; + ] + + let expectedOptimized = [ + "type OperatorTestsString"; + "let testStringEqualsOperator(e1) (e2) = String.Equals (e1,e2) @ (4,70--4,78)"; + "let testStringNotEqualsOperator(e1) (e2) = Operators.op_Equality (String.Equals (e1,e2),False) @ (5,70--5,79)"; + "let testStringLessThanOperator(e1) (e2) = HashCompare.GenericLessThanIntrinsic (e1,e2) @ (6,70--6,78)"; + "let testStringLessThanOrEqualsOperator(e1) (e2) = HashCompare.GenericLessOrEqualIntrinsic (e1,e2) @ (7,70--7,79)"; + "let testStringGreaterThanOperator(e1) (e2) = HashCompare.GenericGreaterThanIntrinsic (e1,e2) @ (8,70--8,78)"; + "let testStringGreaterThanOrEqualsOperator(e1) (e2) = HashCompare.GenericGreaterOrEqualIntrinsic (e1,e2) @ (9,70--9,79)"; + "let testStringAdditionOperator(e1) (e2) = String.Concat (e1,e2) @ (11,62--11,70)"; + "let testStringAdditionChecked(e1) (e2) = String.Concat (e1,e2) @ (24,59--24,76)"; + "let testStringToByteChecked(e1) = Checked.ToByte (LanguagePrimitives.ParseUInt32 (e1)) @ (29,47--29,62)"; + "let testStringToSByteChecked(e1) = Checked.ToSByte (LanguagePrimitives.ParseInt32 (e1)) @ (30,47--30,63)"; + "let testStringToInt16Checked(e1) = Checked.ToInt16 (LanguagePrimitives.ParseInt32 (e1)) @ (31,47--31,63)"; + "let testStringToUInt16Checked(e1) = Checked.ToUInt16 (LanguagePrimitives.ParseUInt32 (e1)) @ (32,47--32,64)"; + "let testStringToIntChecked(e1) = LanguagePrimitives.ParseInt32 (e1) @ (33,47--33,61)"; + "let testStringToInt32Checked(e1) = LanguagePrimitives.ParseInt32 (e1) @ (34,47--34,63)"; + "let testStringToUInt32Checked(e1) = LanguagePrimitives.ParseUInt32 (e1) @ (35,47--35,64)"; + "let testStringToInt64Checked(e1) = LanguagePrimitives.ParseInt64 (e1) @ (36,47--36,63)"; + "let testStringToUInt64Checked(e1) = LanguagePrimitives.ParseUInt64 (e1) @ (37,47--37,64)"; + "let testStringToByteOperator(e1) = Checked.ToByte (LanguagePrimitives.ParseUInt32 (e1)) @ (41,47--41,54)"; + "let testStringToSByteOperator(e1) = Checked.ToSByte (LanguagePrimitives.ParseInt32 (e1)) @ (42,47--42,55)"; + "let testStringToInt16Operator(e1) = Checked.ToInt16 (LanguagePrimitives.ParseInt32 (e1)) @ (43,47--43,55)"; + "let testStringToUInt16Operator(e1) = Checked.ToUInt16 (LanguagePrimitives.ParseUInt32 (e1)) @ (44,47--44,56)"; + "let testStringToIntOperator(e1) = LanguagePrimitives.ParseInt32 (e1) @ (45,47--45,53)"; + "let testStringToInt32Operator(e1) = LanguagePrimitives.ParseInt32 (e1) @ (46,47--46,55)"; + "let testStringToUInt32Operator(e1) = LanguagePrimitives.ParseUInt32 (e1) @ (47,47--47,56)"; + "let testStringToInt64Operator(e1) = LanguagePrimitives.ParseInt64 (e1) @ (48,47--48,55)"; + "let testStringToUInt64Operator(e1) = LanguagePrimitives.ParseUInt64 (e1) @ (49,47--49,56)"; + "let testStringToSingleOperator(e1) = Single.Parse ((if Operators.op_Equality (e1,dflt) then dflt else e1.Replace(\"_\",\"\")),167,CultureInfo.get_InvariantCulture () :> System.IFormatProvider) @ (52,47--52,57)"; + "let testStringToDoubleOperator(e1) = Double.Parse ((if Operators.op_Equality (e1,dflt) then dflt else e1.Replace(\"_\",\"\")),167,CultureInfo.get_InvariantCulture () :> System.IFormatProvider) @ (53,47--53,55)"; + "let testStringToDecimalOperator(e1) = Decimal.Parse (e1,167,CultureInfo.get_InvariantCulture () :> System.IFormatProvider) @ (54,47--54,57)"; + "let testStringToCharOperator(e1) = Char.Parse (e1) @ (55,47--55,54)"; + "let testStringToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,47--56,56)"; + ] + + testOperators "String" "string" excludedTests expectedUnoptimized expectedOptimized + //--------------------------------------------------------------------------------------------------------- // This big list expression was causing us trouble @@ -866,6 +2871,20 @@ let ``Test expressions of declarations stress big expressions`` () = // This should not stack overflow printDeclarations None (List.ofSeq file1.Declarations) |> Seq.toList |> ignore + +[] +let ``Test expressions of optimized declarations stress big expressions`` () = + let wholeProjectResults = exprChecker.ParseAndCheckProject(ProjectStressBigExpressions.options) |> Async.RunSynchronously + + wholeProjectResults.Errors.Length |> shouldEqual 0 + + wholeProjectResults.GetOptimizedAssemblyContents().ImplementationFiles.Length |> shouldEqual 1 + let file1 = wholeProjectResults.GetOptimizedAssemblyContents().ImplementationFiles.[0] + + // This should not stack overflow + printDeclarations None (List.ofSeq file1.Declarations) |> Seq.toList |> ignore + + #if NOT_YET_ENABLED #if !NO_PROJECTCRACKER && !DOTNETCORE