diff --git a/src/Compiler/Checking/ConstraintSolver.fs b/src/Compiler/Checking/ConstraintSolver.fs index 7d7097dc25a..9f0cb22a1c3 100644 --- a/src/Compiler/Checking/ConstraintSolver.fs +++ b/src/Compiler/Checking/ConstraintSolver.fs @@ -428,7 +428,7 @@ let isFpTy g ty = /// decimal or decimal<_> let isDecimalTy g ty = - typeEquivAux EraseMeasures g g.decimal_ty ty + typeEquivAux EraseMeasures g g.decimal_ty ty let IsNonDecimalNumericOrIntegralEnumType g ty = IsIntegerOrIntegerEnumTy g ty || isFpTy g ty @@ -443,7 +443,7 @@ let IsRelationalType g ty = IsNumericType g ty || isStringTy g ty || isCharTy g let IsCharOrStringType g ty = isCharTy g ty || isStringTy g ty /// Checks the argument type for a built-in solution to an op_Addition, op_Subtraction or op_Modulus constraint. -let IsAddSubModType nm g ty = IsNumericOrIntegralEnumType g ty || (nm = "op_Addition" && IsCharOrStringType g ty) +let IsAddSubModType nm g ty = IsNumericOrIntegralEnumType g ty || (nm = "op_Addition" && IsCharOrStringType g ty) || (nm = "op_Subtraction" && isCharTy g ty) /// Checks the argument type for a built-in solution to a bitwise operator constraint let IsBitwiseOpType g ty = IsIntegerOrIntegerEnumTy g ty || (isEnumTy g ty) @@ -1601,25 +1601,30 @@ and SolveMemberConstraint (csenv: ConstraintSolverEnv) ignoreUnresolvedOverload do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy return TTraitBuiltIn - | _, _, false, "op_Explicit", [argTy] - when (// The input type. + // Conversions from non-decimal numbers / strings / chars to non-decimal numbers / chars are built-in + | _, _, false, "op_Explicit", [argTy] + when (// The input type. (IsNonDecimalNumericOrIntegralEnumType g argTy || isStringTy g argTy || isCharTy g argTy) && // The output type - (IsNonDecimalNumericOrIntegralEnumType g retTy || isCharTy g retTy) && - // Exclusion: IntPtr and UIntPtr do not support .Parse() from string - not (isStringTy g argTy && isNativeIntegerTy g retTy) && - // Exclusion: No conversion from char to decimal - not (isCharTy g argTy && isDecimalTy g retTy)) -> + (IsNonDecimalNumericOrIntegralEnumType g retTy || isCharTy g retTy)) -> return TTraitBuiltIn - - | _, _, false, "op_Explicit", [argTy] - when (// The input type. - (IsNumericOrIntegralEnumType g argTy || isStringTy g argTy) && + // Conversions from (including decimal) numbers / strings / chars to decimals are built-in + | _, _, false, "op_Explicit", [argTy] + when (// The input type. + (IsNumericOrIntegralEnumType g argTy || isStringTy g argTy || isCharTy g argTy) && // The output type - (isDecimalTy g retTy)) -> + (isDecimalTy g retTy)) -> + return TTraitBuiltIn + // Conversions from decimal numbers to native integers are built-in + // The rest of decimal conversions are handled via op_Explicit lookup on System.Decimal (which also looks for op_Implicit) + | _, _, false, "op_Explicit", [argTy] + when (// The input type. + (isDecimalTy g argTy) && + // The output type + (isNativeIntegerTy g retTy)) -> return TTraitBuiltIn | [], _, false, "Pow", [argTy1; argTy2] diff --git a/src/Compiler/TypedTree/TcGlobals.fs b/src/Compiler/TypedTree/TcGlobals.fs index 51060755e80..d225cd80a6d 100755 --- a/src/Compiler/TypedTree/TcGlobals.fs +++ b/src/Compiler/TypedTree/TcGlobals.fs @@ -1779,7 +1779,7 @@ type TcGlobals( [ arg0Ty; arg1Ty ], Some retTy -> [vara; varb; varc], [ varaTy; varbTy ], varcTy, [ arg0Ty; arg1Ty; retTy ] - | ("UnaryNegationDynamic" | "CheckedUnaryNegationDynamic" | "LogicalNotDynamic" | "ExplicitDynamic"), + | ("UnaryNegationDynamic" | "CheckedUnaryNegationDynamic" | "LogicalNotDynamic" | "ExplicitDynamic" | "CheckedExplicitDynamic"), [ arg0Ty ], Some retTy -> [vara; varb ], [ varaTy ], varbTy, [ arg0Ty; retTy ] diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index ebc1d2cb28c..2a4bf32a069 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -1491,7 +1491,7 @@ namedModuleDefnBlock: { Choice1Of2 $1.LongIdent } -/* A module definition that inccludes a 'begin'...'end' (rarely used in F# with #light syntax) */ +/* A module definition that includes a 'begin'...'end' (rarely used in F# with #light syntax) */ wrappedNamedModuleDefn: | structOrBegin moduleDefnsOrExprPossiblyEmpty END { $2 } diff --git a/src/FSharp.Core/Linq.fs b/src/FSharp.Core/Linq.fs index 5b383f2c3d2..6fd662177f1 100644 --- a/src/FSharp.Core/Linq.fs +++ b/src/FSharp.Core/Linq.fs @@ -75,7 +75,170 @@ module LeafExpressionConverter = let NullableConstructor = typedefof>.GetConstructors().[0] - + + let getNonNullableType typ = match Nullable.GetUnderlyingType typ with null -> typ | t -> t + + // https://github.com/dotnet/runtime/blob/fa779e8cb2b5868a0ac2fd4215f39ffb91f0dab0/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/TypeUtils.cs#L72 + /// Can LINQ Expressions' BinaryExpression's (Left/Right)Shift construct a SimpleBinaryExpression from the type in question? Otherwise, use the F# operator as the user-defined method. + let isLinqExpressionsInteger typ = + let typ = getNonNullableType typ + not typ.IsEnum && + match Type.GetTypeCode typ with + | TypeCode.Byte + | TypeCode.SByte + | TypeCode.Int16 + | TypeCode.Int32 + | TypeCode.Int64 + | TypeCode.UInt16 + | TypeCode.UInt32 + | TypeCode.UInt64 -> true + | _ -> false + + // https://github.com/dotnet/runtime/blob/fa779e8cb2b5868a0ac2fd4215f39ffb91f0dab0/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/BinaryExpression.cs#L2226 + /// Can LINQ Expressions' BinaryExpression's (Left/Right)Shift construct a SimpleBinaryExpression from the type in question? Otherwise, use the F# operator as the user-defined method. + let isLinqExpressionsSimpleShift left right = + isLinqExpressionsInteger left && getNonNullableType right = typeof + + // https://github.com/dotnet/runtime/blob/cf7e7a46f8a4a6225a8f1e059a846ccdebf0454c/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/TypeUtils.cs#L110 + /// Can LINQ Expressions' (UnaryExpression/BinaryExpression)'s arithmetic operations construct a (SimpleBinaryExpression/UnaryExpression) from the type in question? Otherwise, use the F# operator as the user-defined method. + let isLinqExpressionsArithmeticType typ = + let typ = getNonNullableType typ + not typ.IsEnum && + match Type.GetTypeCode typ with + | TypeCode.Int16 + | TypeCode.Int32 + | TypeCode.Int64 + | TypeCode.Double + | TypeCode.Single + | TypeCode.UInt16 + | TypeCode.UInt32 + | TypeCode.UInt64 -> true + | _ -> false + + // https://github.com/dotnet/runtime/blob/7bd472498e690e9421df86d5a9d728faa939742c/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/TypeUtils.cs#L132 + /// Can LINQ Expressions' UnaryExpression.(Checked)Negate construct a UnaryExpression from the type in question? Otherwise, use the F# operator as the user-defined method. + let isLinqExpressionsArithmeticTypeButNotUnsignedInt typ = + isLinqExpressionsArithmeticType typ && + let typ = getNonNullableType typ + not typ.IsEnum && + match Type.GetTypeCode typ with + | TypeCode.UInt16 + | TypeCode.UInt32 + | TypeCode.UInt64 -> false + | _ -> true + + // https://github.com/dotnet/runtime/blob/7bd472498e690e9421df86d5a9d728faa939742c/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/TypeUtils.cs#L149 + /// Can LINQ Expressions' (UnaryExpression.Not/BinaryExpression.Binary(And/Or/ExclusiveOr)) construct a (UnaryExpression/SimpleBinaryExpression) from the type in question? Otherwise, use the F# operator as the user-defined method. + let isLinqExpressionsIntegerOrBool typ = + let typ = getNonNullableType typ + not typ.IsEnum && + match Type.GetTypeCode typ with + | TypeCode.Int64 + | TypeCode.Int32 + | TypeCode.Int16 + | TypeCode.UInt64 + | TypeCode.UInt32 + | TypeCode.UInt16 + | TypeCode.Boolean + | TypeCode.SByte + | TypeCode.Byte -> true + | _ -> false + + // https://github.com/dotnet/runtime/blob/7bd472498e690e9421df86d5a9d728faa939742c/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/TypeUtils.cs#L47 + /// Can LINQ Expressions' BinaryExpression's comparison operations construct a (SimpleBinaryExpression/LogicalBinaryExpression) from the type in question? Otherwise, use the F# operator as the user-defined method. + let isLinqExpressionsNumeric typ = + let typ = getNonNullableType typ + not typ.IsEnum && + match Type.GetTypeCode typ with + | TypeCode.Char + | TypeCode.SByte + | TypeCode.Byte + | TypeCode.Int16 + | TypeCode.Int32 + | TypeCode.Int64 + | TypeCode.Double + | TypeCode.Single + | TypeCode.UInt16 + | TypeCode.UInt32 + | TypeCode.UInt64 -> true + | _ -> false + + // https://github.com/dotnet/runtime/blob/afaf666eff08435123eb649ac138419f4c9b9344/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/BinaryExpression.cs#L1047 + /// Can LINQ Expressions' BinaryExpression's equality operations provide built-in structural equality from the type in question? Otherwise, use the F# operator as the user-defined method. + let isLinqExpressionsStructurallyEquatable typ = + isLinqExpressionsNumeric typ || typ = typeof || getNonNullableType(typ).IsEnum + + // https://github.com/dotnet/runtime/blob/4c92aef2b08f9c4374c520e7e664a44f1ad8ce56/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/BinaryExpression.cs#L1221 + /// Can LINQ Expressions' BinaryExpression's comparison operations provide built-in comparison from the type in question? Otherwise, use the F# operator as the user-defined method. + let isLinqExpressionsComparable = isLinqExpressionsNumeric + + /// Can LINQ Expressions' BinaryExpression's equality operations provide built-in equality from the type in question? Otherwise, use the F# operator as the user-defined method. + let isLinqExpressionsEquatable typ = + isLinqExpressionsStructurallyEquatable typ || typ = typeof + + /// Can LINQ Expressions' BinaryExpression's conversion operations provide built-in conversion from source to dest? Otherwise, use the F# operator as the user-defined method. + let isLinqExpressionsConvertible source dest = + // https://github.com/dotnet/runtime/blob/4c92aef2b08f9c4374c520e7e664a44f1ad8ce56/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/UnaryExpression.cs#L757 + // expression.Type.HasIdentityPrimitiveOrNullableConversionTo(type) || expression.Type.HasReferenceConversionTo(type)) + // In other words, source.HasIdentityPrimitiveOrNullableConversionTo dest || source.HasReferenceConversionTo dest + + // https://github.com/dotnet/runtime/blob/4c92aef2b08f9c4374c520e7e664a44f1ad8ce56/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/TypeUtils.cs#L532 + let isConvertible typ = + let typ = getNonNullableType typ + typ.IsEnum || + match Type.GetTypeCode typ with + | TypeCode.Boolean + | TypeCode.Byte + | TypeCode.SByte + | TypeCode.Int16 + | TypeCode.Int32 + | TypeCode.Int64 + | TypeCode.UInt16 + | TypeCode.UInt32 + | TypeCode.UInt64 + | TypeCode.Single + | TypeCode.Double + | TypeCode.Char -> true + | _ -> false + // https://github.com/dotnet/runtime/blob/4c92aef2b08f9c4374c520e7e664a44f1ad8ce56/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/TypeUtils.cs#L229 + // HasIdentityPrimitiveOrNullableConversionTo + getNonNullableType(source).IsEquivalentTo dest + || dest.IsEquivalentTo(getNonNullableType source) + || isConvertible source && isConvertible dest + && (getNonNullableType dest <> typeof || source.IsEnum && source.GetEnumUnderlyingType() = typeof) + + || + // https://github.com/dotnet/runtime/blob/4c92aef2b08f9c4374c520e7e664a44f1ad8ce56/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/TypeUtils.cs#L458 + // IsLegalExplicitVariantDelegateConversion + // https://github.com/dotnet/runtime/blob/4c92aef2b08f9c4374c520e7e664a44f1ad8ce56/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/TypeUtils.cs#L260 + // HasReferenceConversionTo + let rec hasReferenceConversionTo source dest = + + // { if (source == typeof(void) || dest == typeof(void)) return false; } invalidates an identity conversion. This is handled by the IsEquivalentTo check above. + let nnSourceType, nnDestType = getNonNullableType source, getNonNullableType dest + + // Down conversion + nnSourceType.IsAssignableFrom nnDestType + // Up conversion + || nnDestType.IsAssignableFrom nnSourceType + + // Interface conversion + || source.IsInterface || dest.IsInterface + + // The following part shouldn't be needed for our usage of isLinqExpressionsConvertible here because we only use this for potentially nullable built-in numeric types +(* + // Variant delegate conversion + if (IsLegalExplicitVariantDelegateConversion(source, dest)) + { + return true; + } + + // Object conversion handled by assignable above. + Debug.Assert(source != typeof(object) && dest != typeof(object)); + + return (source.IsArray || dest.IsArray) && StrictHasReferenceConversionTo(source, dest, true); +*) + hasReferenceConversionTo source dest let SpecificCallToMethodInfo (minfo: System.Reflection.MethodInfo) = let isg1 = minfo.IsGenericMethod let gmd = if isg1 then minfo.GetGenericMethodDefinition() else null @@ -87,19 +250,20 @@ module LeafExpressionConverter = if isg1 then minfo2.IsGenericMethod && gmd = minfo2.GetGenericMethodDefinition() else minfo = minfo2 ) -> - Some (obj, (minfo2.GetGenericArguments() |> Array.toList), args) + Some (obj, minfo2, args) | _ -> None) - - let (|SpecificCallToMethod|_|) (mhandle: System.RuntimeMethodHandle) = + let (|SpecificCallToMethod|_|) (mhandle: RuntimeMethodHandle) = let minfo = (System.Reflection.MethodInfo.GetMethodFromHandle mhandle) :?> MethodInfo SpecificCallToMethodInfo minfo + let (|GenericArgs|) (minfo: MethodInfo) = minfo.GetGenericArguments() + let (|PhysicalEqualityQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun (x, y) -> LanguagePrimitives.PhysicalEquality x y)) let (|GenericEqualityQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun (x, y) -> LanguagePrimitives.GenericEquality x y)) let (|EqualsQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun (x, y) -> x = y)) let (|GreaterQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun (x, y) -> x > y)) let (|GreaterEqQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun (x, y) -> x >= y)) - let (|LessQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun (x, y) -> x < y)) + let (|LessQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun (x, y) -> x < y)) let (|LessEqQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun (x, y) -> x <= y)) let (|NotEqQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun (x, y) -> x <> y)) @@ -185,6 +349,8 @@ module LeafExpressionConverter = let (|ConvUInt16Q|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Operators.uint16 x)) let (|ConvUInt32Q|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Operators.uint32 x)) let (|ConvUInt64Q|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Operators.uint64 x)) + let (|ConvIntPtrQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Operators.nativeint x)) + let (|ConvUIntPtrQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Operators.unativeint x)) let (|ConvInt8Q|_|) = SpecificCallToMethodInfo (typeof.Assembly.GetType("Microsoft.FSharp.Core.ExtraTopLevelOperators").GetMethod("ToSByte")) let (|ConvUInt8Q|_|) = SpecificCallToMethodInfo (typeof.Assembly.GetType("Microsoft.FSharp.Core.ExtraTopLevelOperators").GetMethod("ToByte")) @@ -208,10 +374,8 @@ module LeafExpressionConverter = let (|ConvNullableUInt16Q|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Nullable.uint16 x)) let (|ConvNullableUInt32Q|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Nullable.uint32 x)) let (|ConvNullableUInt64Q|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Nullable.uint64 x)) - // LINQ expressions can't do native integer operations, so we don't convert these - //let (|ConvNullableIntPtrQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Nullable.nativeint x)) - //let (|ConvNullableUIntPtrQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Nullable.unativeint x)) - + let (|ConvNullableIntPtrQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Nullable.nativeint x)) + let (|ConvNullableUIntPtrQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Nullable.unativeint x)) let (|UnboxGeneric|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> LanguagePrimitives.IntrinsicFunctions.UnboxGeneric x)) let (|TypeTestGeneric|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> LanguagePrimitives.IntrinsicFunctions.TypeTestGeneric x)) @@ -226,6 +390,8 @@ module LeafExpressionConverter = let (|CheckedConvUInt16Q|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Checked.uint16 x)) let (|CheckedConvUInt32Q|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Checked.uint32 x)) let (|CheckedConvUInt64Q|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Checked.uint64 x)) + let (|CheckedConvIntPtrQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Checked.nativeint x)) + let (|CheckedConvUIntPtrQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Checked.unativeint x)) let (|ImplicitExpressionConversionHelperQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> ImplicitExpressionConversionHelper x)) let (|MemberInitializationHelperQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> MemberInitializationHelper x)) let (|NewAnonymousObjectHelperQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> NewAnonymousObjectHelper x)) @@ -287,7 +453,7 @@ module LeafExpressionConverter = | Patterns.Value(x, ty) -> Expression.Constant(x, ty) |> asExpr - | UnboxGeneric(_, [toTy], [x]) + | UnboxGeneric(_, GenericArgs [|toTy|], [x]) | Patterns.Coerce(x, toTy) -> let converted = ConvExprToLinqInContext env x @@ -299,7 +465,7 @@ module LeafExpressionConverter = | Patterns.TypeTest(x, toTy) -> Expression.TypeIs(ConvExprToLinqInContext env x, toTy) |> asExpr - | TypeTestGeneric(_, [toTy], [x]) -> + | TypeTestGeneric(_, GenericArgs [|toTy|], [x]) -> Expression.TypeIs(ConvExprToLinqInContext env x, toTy) |> asExpr // Expr.*Get @@ -355,147 +521,115 @@ module LeafExpressionConverter = let props = ctor.DeclaringType.GetProperties() Expression.New(ctor, argsR, [| for p in props -> (p :> MemberInfo) |]) |> asExpr - // Do the same thing as C# compiler for string addition - | PlusQ (_, [ty1; ty2; ty3], [x1; x2]) when (ty1 = typeof) && (ty2 = typeof) && (ty3 = typeof) -> + | PlusQ (_, GenericArgs [|ty1; ty2; ty3|], [x1; x2]) when ty1 = typeof && ty2 = typeof && ty3 = typeof -> Expression.Add(ConvExprToLinqInContext env x1, ConvExprToLinqInContext env x2, StringConcat) |> asExpr - | GenericEqualityQ _ - | EqualsQ _ -> transBinOp inp env false args false Expression.Equal - | NotEqQ _ -> transBinOp inp env false args false Expression.NotEqual - | GreaterQ _ -> transBinOp inp env false args false Expression.GreaterThan - | GreaterEqQ _ -> transBinOp inp env false args false Expression.GreaterThanOrEqual - | LessQ _ -> transBinOp inp env false args false Expression.LessThan - | LessEqQ _ -> transBinOp inp env false args false Expression.LessThanOrEqual - | NotQ (_, _, [x1]) -> Expression.Not(ConvExprToLinqInContext env x1) |> asExpr - - | StaticEqualsQ _ -> transBinOp inp env false args false Expression.Equal - | StaticNotEqQ _ -> transBinOp inp env false args false Expression.NotEqual - | StaticGreaterQ _ -> transBinOp inp env false args false Expression.GreaterThan - | StaticGreaterEqQ _ -> transBinOp inp env false args false Expression.GreaterThanOrEqual - | StaticLessQ _ -> transBinOp inp env false args false Expression.LessThan - | StaticLessEqQ _ -> transBinOp inp env false args false Expression.LessThanOrEqual - - | NullableEqualsQ _ -> transBinOp inp env false args true Expression.Equal - | NullableNotEqQ _ -> transBinOp inp env false args true Expression.NotEqual - | NullableGreaterQ _ -> transBinOp inp env false args true Expression.GreaterThan - | NullableGreaterEqQ _ -> transBinOp inp env false args true Expression.GreaterThanOrEqual - | NullableLessQ _ -> transBinOp inp env false args true Expression.LessThan - | NullableLessEqQ _ -> transBinOp inp env false args true Expression.LessThanOrEqual - - | EqualsNullableQ _ -> transBinOp inp env true args false Expression.Equal - | NotEqNullableQ _ -> transBinOp inp env true args false Expression.NotEqual - | GreaterNullableQ _ -> transBinOp inp env true args false Expression.GreaterThan - | GreaterEqNullableQ _ -> transBinOp inp env true args false Expression.GreaterThanOrEqual - | LessNullableQ _ -> transBinOp inp env true args false Expression.LessThan - | LessEqNullableQ _ -> transBinOp inp env true args false Expression.LessThanOrEqual - - | NullableEqualsNullableQ _ -> transBinOp inp env false args false Expression.Equal - | NullableNotEqNullableQ _ -> transBinOp inp env false args false Expression.NotEqual - | NullableGreaterNullableQ _ -> transBinOp inp env false args false Expression.GreaterThan - | NullableGreaterEqNullableQ _ -> transBinOp inp env false args false Expression.GreaterThanOrEqual - | NullableLessNullableQ _ -> transBinOp inp env false args false Expression.LessThan - | NullableLessEqNullableQ _ -> transBinOp inp env false args false Expression.LessThanOrEqual + // LanguagePrimitives.PhysicalEquality's generic constraint of both sides being the same reference type is already sufficient for Linq Expressions' requirements + | PhysicalEqualityQ (_, m, [x1; x2]) -> transBoolOpNoWitness (fun _ -> true) env false x1 x2 false (fun (l, r, _, _) -> Expression.ReferenceEqual(l, r)) m + | GenericEqualityQ (_, m, [x1; x2]) + | EqualsQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsStructurallyEquatable env false x1 x2 false Expression.Equal m + | NotEqQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsStructurallyEquatable env false x1 x2 false Expression.NotEqual m + | GreaterQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env false x1 x2 false Expression.GreaterThan m + | GreaterEqQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env false x1 x2 false Expression.GreaterThanOrEqual m + | LessQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env false x1 x2 false Expression.LessThan m + | LessEqQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env false x1 x2 false Expression.LessThanOrEqual m + | NotQ (_, _, [x1]) -> Expression.Not(ConvExprToLinqInContext env x1) |> asExpr + + | StaticEqualsQ (_, _, [x1; x2]) -> transBoolOp isLinqExpressionsEquatable inp env x1 x2 Expression.Equal (methodhandleof (fun (x, y) -> LanguagePrimitives.EqualityDynamic x y)) + | StaticNotEqQ (_, _, [x1; x2]) -> transBoolOp isLinqExpressionsEquatable inp env x1 x2 Expression.NotEqual (methodhandleof (fun (x, y) -> LanguagePrimitives.InequalityDynamic x y)) + | StaticGreaterQ (_, _, [x1; x2]) -> transBoolOp isLinqExpressionsComparable inp env x1 x2 Expression.GreaterThan (methodhandleof (fun (x, y) -> LanguagePrimitives.GreaterThanDynamic x y)) + | StaticGreaterEqQ (_, _, [x1; x2]) -> transBoolOp isLinqExpressionsComparable inp env x1 x2 Expression.GreaterThanOrEqual (methodhandleof (fun (x, y) -> LanguagePrimitives.GreaterThanOrEqualDynamic x y)) + | StaticLessQ (_, _, [x1; x2]) -> transBoolOp isLinqExpressionsComparable inp env x1 x2 Expression.LessThan (methodhandleof (fun (x, y) -> LanguagePrimitives.LessThanDynamic x y)) + | StaticLessEqQ (_, _, [x1; x2]) -> transBoolOp isLinqExpressionsComparable inp env x1 x2 Expression.LessThanOrEqual (methodhandleof (fun (x, y) -> LanguagePrimitives.LessThanOrEqualDynamic x y)) + + | NullableEqualsQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsStructurallyEquatable env false x1 x2 true Expression.Equal m + | NullableNotEqQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsStructurallyEquatable env false x1 x2 true Expression.NotEqual m + | NullableGreaterQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env false x1 x2 true Expression.GreaterThan m + | NullableGreaterEqQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env false x1 x2 true Expression.GreaterThanOrEqual m + | NullableLessQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env false x1 x2 true Expression.LessThan m + | NullableLessEqQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env false x1 x2 true Expression.LessThanOrEqual m + + | EqualsNullableQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsStructurallyEquatable env true x1 x2 false Expression.Equal m + | NotEqNullableQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsStructurallyEquatable env true x1 x2 false Expression.NotEqual m + | GreaterNullableQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env true x1 x2 false Expression.GreaterThan m + | GreaterEqNullableQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env true x1 x2 false Expression.GreaterThanOrEqual m + | LessNullableQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env true x1 x2 false Expression.LessThan m + | LessEqNullableQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env true x1 x2 false Expression.LessThanOrEqual m + + | NullableEqualsNullableQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsStructurallyEquatable env false x1 x2 false Expression.Equal m + | NullableNotEqNullableQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsStructurallyEquatable env false x1 x2 false Expression.NotEqual m + | NullableGreaterNullableQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env false x1 x2 false Expression.GreaterThan m + | NullableGreaterEqNullableQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env false x1 x2 false Expression.GreaterThanOrEqual m + | NullableLessNullableQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env false x1 x2 false Expression.LessThan m + | NullableLessEqNullableQ (_, m, [x1; x2]) -> transBoolOpNoWitness isLinqExpressionsComparable env false x1 x2 false Expression.LessThanOrEqual m // Detect the F# quotation encoding of decimal literals | MakeDecimalQ (_, _, [Int32 lo; Int32 med; Int32 hi; Bool isNegative; Byte scale]) -> Expression.Constant (new System.Decimal(lo, med, hi, isNegative, scale)) |> asExpr - | NegQ (_, _, [x1]) -> Expression.Negate(ConvExprToLinqInContext env x1) |> asExpr - | PlusQ _ -> transBinOp inp env false args false Expression.Add - | DivideQ _ -> transBinOp inp env false args false Expression.Divide - | MinusQ _ -> transBinOp inp env false args false Expression.Subtract - | MultiplyQ _ -> transBinOp inp env false args false Expression.Multiply - | ModuloQ _ -> transBinOp inp env false args false Expression.Modulo - - | ShiftLeftQ _ -> transBinOp inp env false args false Expression.LeftShift - | ShiftRightQ _ -> transBinOp inp env false args false Expression.RightShift - | BitwiseAndQ _ -> transBinOp inp env false args false Expression.And - | BitwiseOrQ _ -> transBinOp inp env false args false Expression.Or - | BitwiseXorQ _ -> transBinOp inp env false args false Expression.ExclusiveOr - | BitwiseNotQ (_, _, [x1]) -> Expression.Not(ConvExprToLinqInContext env x1) |> asExpr + | NegQ (_, _, [x]) -> transUnaryOp isLinqExpressionsArithmeticTypeButNotUnsignedInt inp env x Expression.Negate (methodhandleof (fun x -> LanguagePrimitives.UnaryNegationDynamic x)) + | PlusQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 false Expression.Add (methodhandleof (fun (x, y) -> LanguagePrimitives.AdditionDynamic x y)) + | MinusQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 false Expression.Subtract (methodhandleof (fun (x, y) -> LanguagePrimitives.SubtractionDynamic x y)) + | MultiplyQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 false Expression.Multiply (methodhandleof (fun (x, y) -> LanguagePrimitives.MultiplyDynamic x y)) + | DivideQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 false Expression.Divide (methodhandleof (fun (x, y) -> LanguagePrimitives.DivisionDynamic x y)) + | ModuloQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 false Expression.Modulo (methodhandleof (fun (x, y) -> LanguagePrimitives.ModulusDynamic x y)) + + | ShiftLeftQ (_, _, [x1; x2]) -> transShiftOp inp env false x1 x2 false Expression.LeftShift (methodhandleof (fun (x, y) -> LanguagePrimitives.LeftShiftDynamic x y)) + | ShiftRightQ (_, _, [x1; x2]) -> transShiftOp inp env false x1 x2 false Expression.RightShift (methodhandleof (fun (x, y) -> LanguagePrimitives.RightShiftDynamic x y)) + | BitwiseAndQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsIntegerOrBool inp env false x1 x2 false Expression.And (methodhandleof (fun (x, y) -> LanguagePrimitives.BitwiseAndDynamic x y)) + | BitwiseOrQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsIntegerOrBool inp env false x1 x2 false Expression.Or (methodhandleof (fun (x, y) -> LanguagePrimitives.BitwiseOrDynamic x y)) + | BitwiseXorQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsIntegerOrBool inp env false x1 x2 false Expression.ExclusiveOr (methodhandleof (fun (x, y) -> LanguagePrimitives.ExclusiveOrDynamic x y)) + | BitwiseNotQ (_, _, [x]) -> transUnaryOp isLinqExpressionsIntegerOrBool inp env x Expression.Not (methodhandleof (fun x -> LanguagePrimitives.LogicalNotDynamic x)) - | CheckedNeg (_, _, [x1]) -> Expression.NegateChecked(ConvExprToLinqInContext env x1) |> asExpr - | CheckedPlusQ _ -> transBinOp inp env false args false Expression.AddChecked - | CheckedMinusQ _ -> transBinOp inp env false args false Expression.SubtractChecked - | CheckedMultiplyQ _ -> transBinOp inp env false args false Expression.MultiplyChecked + | CheckedNeg (_, _, [x]) -> transUnaryOp isLinqExpressionsArithmeticTypeButNotUnsignedInt inp env x Expression.NegateChecked (methodhandleof (fun x -> LanguagePrimitives.CheckedUnaryNegationDynamic x)) + | CheckedPlusQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 false Expression.AddChecked (methodhandleof (fun (x, y) -> LanguagePrimitives.CheckedAdditionDynamic x y)) + | CheckedMinusQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 false Expression.SubtractChecked (methodhandleof (fun (x, y) -> LanguagePrimitives.CheckedSubtractionDynamic x y)) + | CheckedMultiplyQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 false Expression.MultiplyChecked (methodhandleof (fun (x, y) -> LanguagePrimitives.CheckedMultiplyDynamic x y)) - | NullablePlusQ _ -> transBinOp inp env false args true Expression.Add - | PlusNullableQ _ -> transBinOp inp env true args false Expression.Add - | NullablePlusNullableQ _ -> transBinOp inp env false args false Expression.Add + | NullablePlusQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 true Expression.Add (methodhandleof (fun (x, y) -> LanguagePrimitives.AdditionDynamic x y)) + | PlusNullableQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env true x1 x2 false Expression.Add (methodhandleof (fun (x, y) -> LanguagePrimitives.AdditionDynamic x y)) + | NullablePlusNullableQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 false Expression.Add (methodhandleof (fun (x, y) -> LanguagePrimitives.AdditionDynamic x y)) - | NullableMinusQ _ -> transBinOp inp env false args true Expression.Subtract - | MinusNullableQ _ -> transBinOp inp env true args false Expression.Subtract - | NullableMinusNullableQ _ -> transBinOp inp env false args false Expression.Subtract + | NullableMinusQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 true Expression.Subtract (methodhandleof (fun (x, y) -> LanguagePrimitives.SubtractionDynamic x y)) + | MinusNullableQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env true x1 x2 false Expression.Subtract (methodhandleof (fun (x, y) -> LanguagePrimitives.SubtractionDynamic x y)) + | NullableMinusNullableQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 false Expression.Subtract (methodhandleof (fun (x, y) -> LanguagePrimitives.SubtractionDynamic x y)) - | NullableMultiplyQ _ -> transBinOp inp env false args true Expression.Multiply - | MultiplyNullableQ _ -> transBinOp inp env true args false Expression.Multiply - | NullableMultiplyNullableQ _ -> transBinOp inp env false args false Expression.Multiply + | NullableMultiplyQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 true Expression.Multiply (methodhandleof (fun (x, y) -> LanguagePrimitives.MultiplyDynamic x y)) + | MultiplyNullableQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env true x1 x2 false Expression.Multiply (methodhandleof (fun (x, y) -> LanguagePrimitives.MultiplyDynamic x y)) + | NullableMultiplyNullableQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 false Expression.Multiply (methodhandleof (fun (x, y) -> LanguagePrimitives.MultiplyDynamic x y)) - | NullableDivideQ _ -> transBinOp inp env false args true Expression.Divide - | DivideNullableQ _ -> transBinOp inp env true args false Expression.Divide - | NullableDivideNullableQ _ -> transBinOp inp env false args false Expression.Divide + | NullableDivideQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 true Expression.Divide (methodhandleof (fun (x, y) -> LanguagePrimitives.DivisionDynamic x y)) + | DivideNullableQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env true x1 x2 false Expression.Divide (methodhandleof (fun (x, y) -> LanguagePrimitives.DivisionDynamic x y)) + | NullableDivideNullableQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 false Expression.Divide (methodhandleof (fun (x, y) -> LanguagePrimitives.DivisionDynamic x y)) - | NullableModuloQ _ -> transBinOp inp env false args true Expression.Modulo - | ModuloNullableQ _ -> transBinOp inp env true args false Expression.Modulo - | NullableModuloNullableQ _ -> transBinOp inp env false args false Expression.Modulo - - | ConvNullableCharQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableDecimalQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableFloatQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableDoubleQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableFloat32Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableSingleQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableSByteQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableInt8Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableInt16Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableInt32Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableIntQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableInt64Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableByteQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableUInt8Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableUInt16Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableUInt32Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - | ConvNullableUInt64Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - // LINQ expressions can't do native integer operations, so we don't convert these - //| ConvNullableIntPtrQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - //| ConvNullableUIntPtrQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof>) |> asExpr - - | ConvCharQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvDecimalQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvFloatQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvDoubleQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvFloat32Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvSingleQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvSByteQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvInt8Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvInt16Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvInt32Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvIntQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvInt64Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvByteQ (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvUInt8Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvUInt16Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvUInt32Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ConvUInt64Q (_, _, [x1]) -> Expression.Convert(ConvExprToLinqInContext env x1, typeof) |> asExpr - - | CheckedConvCharQ (_, _, [x1]) -> Expression.ConvertChecked(ConvExprToLinqInContext env x1, typeof) |> asExpr - | CheckedConvSByteQ (_, _, [x1]) -> Expression.ConvertChecked(ConvExprToLinqInContext env x1, typeof) |> asExpr - | CheckedConvInt8Q (_, _, [x1]) -> Expression.ConvertChecked(ConvExprToLinqInContext env x1, typeof) |> asExpr - | CheckedConvInt16Q (_, _, [x1]) -> Expression.ConvertChecked(ConvExprToLinqInContext env x1, typeof) |> asExpr - | CheckedConvInt32Q (_, _, [x1]) -> Expression.ConvertChecked(ConvExprToLinqInContext env x1, typeof) |> asExpr - | CheckedConvInt64Q (_, _, [x1]) -> Expression.ConvertChecked(ConvExprToLinqInContext env x1, typeof) |> asExpr - | CheckedConvByteQ (_, _, [x1]) -> Expression.ConvertChecked(ConvExprToLinqInContext env x1, typeof) |> asExpr - | CheckedConvUInt8Q (_, _, [x1]) -> Expression.ConvertChecked(ConvExprToLinqInContext env x1, typeof) |> asExpr - | CheckedConvUInt16Q (_, _, [x1]) -> Expression.ConvertChecked(ConvExprToLinqInContext env x1, typeof) |> asExpr - | CheckedConvUInt32Q (_, _, [x1]) -> Expression.ConvertChecked(ConvExprToLinqInContext env x1, typeof) |> asExpr - | CheckedConvUInt64Q (_, _, [x1]) -> Expression.ConvertChecked(ConvExprToLinqInContext env x1, typeof) |> asExpr - | ArrayLookupQ (_, [_; _; _], [x1; x2]) -> + | NullableModuloQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 true Expression.Modulo (methodhandleof (fun (x, y) -> LanguagePrimitives.ModulusDynamic x y)) + | ModuloNullableQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env true x1 x2 false Expression.Modulo (methodhandleof (fun (x, y) -> LanguagePrimitives.ModulusDynamic x y)) + | NullableModuloNullableQ (_, _, [x1; x2]) -> transBinOp isLinqExpressionsArithmeticType inp env false x1 x2 false Expression.Modulo (methodhandleof (fun (x, y) -> LanguagePrimitives.ModulusDynamic x y)) + + | ConvNullableCharQ (_, _, [x]) | ConvNullableDecimalQ (_, _, [x]) | ConvNullableFloatQ (_, _, [x]) | ConvNullableDoubleQ (_, _, [x]) -> transConv inp env false x + | ConvNullableFloat32Q (_, _, [x]) | ConvNullableSingleQ (_, _, [x]) | ConvNullableSByteQ (_, _, [x]) | ConvNullableInt8Q (_, _, [x]) -> transConv inp env false x + | ConvNullableInt16Q (_, _, [x]) | ConvNullableInt32Q (_, _, [x]) | ConvNullableIntQ (_, _, [x]) | ConvNullableInt64Q (_, _, [x]) -> transConv inp env false x + | ConvNullableByteQ (_, _, [x]) | ConvNullableUInt8Q (_, _, [x]) | ConvNullableUInt16Q (_, _, [x]) | ConvNullableUInt32Q (_, _, [x]) -> transConv inp env false x + | ConvNullableUInt64Q (_, _, [x]) | ConvNullableIntPtrQ (_, _, [x]) | ConvNullableUIntPtrQ (_, _, [x]) -> transConv inp env false x + + | ConvCharQ (_, _, [x]) | ConvDecimalQ (_, _, [x]) | ConvFloatQ (_, _, [x]) | ConvDoubleQ (_, _, [x]) -> transConv inp env false x + | ConvFloat32Q (_, _, [x]) | ConvSingleQ (_, _, [x]) | ConvSByteQ (_, _, [x]) | ConvInt8Q (_, _, [x]) -> transConv inp env false x + | ConvInt16Q (_, _, [x]) | ConvInt32Q (_, _, [x]) | ConvIntQ (_, _, [x]) | ConvInt64Q (_, _, [x]) -> transConv inp env false x + | ConvByteQ (_, _, [x]) | ConvUInt8Q (_, _, [x]) | ConvUInt16Q (_, _, [x]) | ConvUInt32Q (_, _, [x]) -> transConv inp env false x + | ConvUInt64Q (_, _, [x]) | ConvIntPtrQ (_, _, [x]) | ConvUIntPtrQ (_, _, [x]) -> transConv inp env false x + + | CheckedConvCharQ (_, _, [x]) | CheckedConvSByteQ (_, _, [x]) | CheckedConvInt8Q (_, _, [x]) | CheckedConvInt16Q (_, _, [x]) -> transConv inp env true x + | CheckedConvInt32Q (_, _, [x]) | CheckedConvInt64Q (_, _, [x]) | CheckedConvByteQ (_, _, [x]) | CheckedConvUInt8Q (_, _, [x]) -> transConv inp env true x + | CheckedConvUInt16Q (_, _, [x]) | CheckedConvUInt32Q (_, _, [x]) | CheckedConvUInt64Q (_, _, [x]) | CheckedConvIntPtrQ (_, _, [x]) -> transConv inp env true x + | CheckedConvUIntPtrQ (_, _, [x]) -> transConv inp env true x + + | ArrayLookupQ (_, GenericArgs [|_; _; _|], [x1; x2]) -> Expression.ArrayIndex(ConvExprToLinqInContext env x1, ConvExprToLinqInContext env x2) |> asExpr // Throw away markers inserted to satisfy C#'s design where they pass an argument // or type T to an argument expecting Expression. - | ImplicitExpressionConversionHelperQ (_, [_], [x1]) -> ConvExprToLinqInContext env x1 + | ImplicitExpressionConversionHelperQ (_, GenericArgs [|_|], [x1]) -> ConvExprToLinqInContext env x1 // Use witnesses if they are available | CallWithWitnesses (objArgOpt, _, minfo2, witnessArgs, args) -> @@ -665,15 +799,79 @@ module LeafExpressionConverter = and failConvert inp = raise (new NotSupportedException(Printf.sprintf "Could not convert the following F# Quotation to a LINQ Expression Tree\n--------\n%s\n-------------\n" (inp.ToString()))) - and transBinOp inp env addConvertLeft args addConvertRight (exprErasedConstructor : _ * _ -> _) = - match args with - | [x1; x2] -> - let e1 = ConvExprToLinqInContext env x1 - let e2 = ConvExprToLinqInContext env x2 - let e1 = if addConvertLeft then Expression.Convert(e1, typedefof>.MakeGenericType [| e1.Type |]) |> asExpr else e1 - let e2 = if addConvertRight then Expression.Convert(e2, typedefof>.MakeGenericType [| e2.Type |]) |> asExpr else e2 - exprErasedConstructor(e1, e2) |> asExpr - | _ -> failConvert inp + /// Translate a unary operator + and transUnaryOp linqExpressionsCondition inp env x (exprErasedConstructor: _ * _ -> _) fallback = + let e = ConvExprToLinqInContext env x + if linqExpressionsCondition e.Type then + exprErasedConstructor(e, null) + else + let method = Reflection.MethodInfo.GetMethodFromHandle fallback :?> Reflection.MethodInfo + exprErasedConstructor(e, method.MakeGenericMethod [| getNonNullableType x.Type; getNonNullableType inp.Type |]) + |> asExpr + + /// Translate a shift operator + and transShiftOp inp env addConvertLeft x1 x2 addConvertRight (exprErasedConstructor: _ * _ * _ -> _) fallback = + let e1 = ConvExprToLinqInContext env x1 + let e2 = ConvExprToLinqInContext env x2 + let e1 = if addConvertLeft then Expression.Convert(e1, typedefof>.MakeGenericType [| e1.Type |]) |> asExpr else e1 + let e2 = if addConvertRight then Expression.Convert(e2, typedefof>.MakeGenericType [| e2.Type |]) |> asExpr else e2 + if e1.Type = e2.Type && isLinqExpressionsSimpleShift e1.Type e2.Type then + exprErasedConstructor(e1, e2, null) + else + let method = Reflection.MethodInfo.GetMethodFromHandle fallback :?> Reflection.MethodInfo + exprErasedConstructor(e1, e2, method.MakeGenericMethod [| getNonNullableType x1.Type; getNonNullableType x2.Type; getNonNullableType inp.Type |]) + |> asExpr + + /// Translate a non-shift binary operator that does not return a boolean + and transBinOp linqExpressionsCondition inp env addConvertLeft x1 x2 addConvertRight (exprErasedConstructor: _ * _ * _ -> _) fallback = + let e1 = ConvExprToLinqInContext env x1 + let e2 = ConvExprToLinqInContext env x2 + let e1 = if addConvertLeft then Expression.Convert(e1, typedefof>.MakeGenericType [| e1.Type |]) |> asExpr else e1 + let e2 = if addConvertRight then Expression.Convert(e2, typedefof>.MakeGenericType [| e2.Type |]) |> asExpr else e2 + if e1.Type = e2.Type && linqExpressionsCondition e1.Type then + exprErasedConstructor(e1, e2, null) + else + let method = Reflection.MethodInfo.GetMethodFromHandle fallback :?> Reflection.MethodInfo + exprErasedConstructor(e1, e2, method.MakeGenericMethod [| getNonNullableType x1.Type; getNonNullableType x2.Type; getNonNullableType inp.Type |]) + |> asExpr + + // The F# boolean structural equality / comparison operators do not take witnesses and the referenced methods are callable directly + /// Translate a non-shift binary operator without witnesses that does not return a boolean + and transBoolOpNoWitness linqExpressionsCondition env addConvertLeft x1 x2 addConvertRight (exprErasedConstructor: _ * _ * _ * _ -> _) method = + let e1 = ConvExprToLinqInContext env x1 + let e2 = ConvExprToLinqInContext env x2 + let e1' = if addConvertLeft then Expression.Convert(e1, typedefof>.MakeGenericType [| e1.Type |]) |> asExpr else e1 + let e2' = if addConvertRight then Expression.Convert(e2, typedefof>.MakeGenericType [| e2.Type |]) |> asExpr else e2 + if e1'.Type = e2'.Type && linqExpressionsCondition e1.Type then + // The false for (liftToNull: bool) indicates whether equality operators return a Nullable like in VB.NET (null when either argument is null) instead of bool like in C# (nulls equate to nulls). F# follows C# here. + exprErasedConstructor(e1', e2', false, null) + else + exprErasedConstructor(e1, e2, false, method) + |> asExpr + + // But the static boolean operators do take witnesses! + /// Translate a non-shift binary operator that returns a boolean + and transBoolOp linqExpressionsCondition inp env x1 x2 (exprErasedConstructor: _ * _ * _ * _ -> _) fallback = + let e1 = ConvExprToLinqInContext env x1 + let e2 = ConvExprToLinqInContext env x2 + if e1.Type = e2.Type && linqExpressionsCondition e1.Type then + // The false for (liftToNull: bool) indicates whether equality operators return a Nullable like in VB.NET (null when either argument is null) instead of bool like in C# (nulls equate to nulls). F# follows C# here. + exprErasedConstructor(e1, e2, false, null) + else + let method = Reflection.MethodInfo.GetMethodFromHandle fallback :?> Reflection.MethodInfo + exprErasedConstructor(e1, e2, false, method.MakeGenericMethod [| getNonNullableType x1.Type; getNonNullableType x2.Type; getNonNullableType inp.Type |]) + |> asExpr + + /// Translate a conversion operator + and transConv (inp: Expr) env isChecked x = + let e = ConvExprToLinqInContext env x + let exprErasedConstructor: _ * _ * _ -> _ = if isChecked then Expression.ConvertChecked else Expression.Convert + if isLinqExpressionsConvertible e.Type inp.Type then + exprErasedConstructor(e, inp.Type, null) + else + let method = Reflection.MethodInfo.GetMethodFromHandle (if isChecked then methodhandleof (fun x -> LanguagePrimitives.CheckedExplicitDynamic x) else methodhandleof (fun x -> LanguagePrimitives.ExplicitDynamic x)) :?> Reflection.MethodInfo + exprErasedConstructor(e, inp.Type, method.MakeGenericMethod [| getNonNullableType x.Type; getNonNullableType inp.Type |]) + |> asExpr and ConvObjArg env objOpt coerceTo : Expression = match objOpt with @@ -716,6 +914,4 @@ module LeafExpressionConverter = d.DynamicInvoke [| box () |] with :? System.Reflection.TargetInvocationException as exn -> raise exn.InnerException -#endif - - +#endif \ No newline at end of file diff --git a/src/FSharp.Core/Linq.fsi b/src/FSharp.Core/Linq.fsi index cfe61b4d1eb..13f3fa4187e 100644 --- a/src/FSharp.Core/Linq.fsi +++ b/src/FSharp.Core/Linq.fsi @@ -88,4 +88,4 @@ module LeafExpressionConverter = val SubstHelperRaw: Expr * Var[] * obj[] -> Expr val internal (|SpecificCallToMethod|_|): - System.RuntimeMethodHandle -> (Expr -> (Expr option * Type list * Expr list) option) + System.RuntimeMethodHandle -> (Expr -> (Expr option * Reflection.MethodInfo * Expr list) option) diff --git a/src/FSharp.Core/Query.fs b/src/FSharp.Core/Query.fs index 2701df53b1c..ae11d3835a1 100644 --- a/src/FSharp.Core/Query.fs +++ b/src/FSharp.Core/Query.fs @@ -314,26 +314,27 @@ module Query = match prop.GetGetMethod true with | null -> None | v -> Some v + let (|GenericArgs|) (minfo: MethodInfo) = minfo.GetGenericArguments() |> Array.toList // Match 'f x' let (|SpecificCall1|_|) q = let (|CallQ|_|) = (|SpecificCallToMethod|_|) q function - | CallQ (Some builderObj, tyargs, [arg1]) -> Some(builderObj, tyargs, arg1) + | CallQ (Some builderObj, GenericArgs tyargs, [arg1]) -> Some(builderObj, tyargs, arg1) | _ -> None // Match 'f x y' or 'f (x, y)' let (|SpecificCall2|_|) q = let (|CallQ|_|) = (|SpecificCallToMethod|_|) q function - | CallQ (Some builderObj, tyargs, [arg1; arg2]) -> Some(builderObj, tyargs, arg1, arg2) + | CallQ (Some builderObj, GenericArgs tyargs, [arg1; arg2]) -> Some(builderObj, tyargs, arg1, arg2) | _ -> None // Match 'f x y z' or 'f (x, y, z)' let (|SpecificCall3|_|) q = let (|CallQ|_|) = (|SpecificCallToMethod|_|) q function - | CallQ (Some builderObj, tyargs, [arg1; arg2; arg3]) -> Some(builderObj, tyargs, arg1, arg2, arg3) + | CallQ (Some builderObj, GenericArgs tyargs, [arg1; arg2; arg3]) -> Some(builderObj, tyargs, arg1, arg2, arg3) | _ -> None /// (fun (x, y) -> z) is represented as 'fun p -> let x = p#0 let y = p#1' etc. @@ -1286,7 +1287,7 @@ module Query = // rewrite has had the custom operator translation mechanism applied. In this case, the // body of the "for" will simply contain "yield". - | CallQueryBuilderFor (_, [_; qTy; immutResElemTy; _], [immutSource; Lambda(immutSelectorVar, immutSelector) ]) -> + | CallQueryBuilderFor (_, GenericArgs [_; qTy; immutResElemTy; _], [immutSource; Lambda(immutSelectorVar, immutSelector) ]) -> let mutSource, sourceConv = TransInner CanEliminate.Yes check immutSource @@ -1467,7 +1468,7 @@ module Query = | _ -> GroupingConv (immutKeySelector.Type, immutElementSelector.Type, selectorConv) TransInnerResult.Other(MakeGroupValBy(qTyIsIQueryable qTy, mutVar1.Type, mutKeySelector.Type, mutElementSelector.Type, mutSource, mutVar2, mutKeySelector, mutVar1, mutElementSelector)), conv - | CallJoin(_, [_; qTy; _; _; _], + | CallJoin(_, GenericArgs [_; qTy; _; _; _], [ immutOuterSource immutInnerSource Lambda(immutOuterKeyVar, immutOuterKeySelector) @@ -1491,7 +1492,7 @@ module Query = TransInnerResult.Other joinExpr, elementSelectorConv | CallGroupJoin - (_, [_; qTy; _; _; _], + (_, GenericArgs [_; qTy; _; _; _], [ immutOuterSource immutInnerSource Lambda(immutOuterKeyVar, immutOuterKeySelector) @@ -1517,7 +1518,7 @@ module Query = TransInnerResult.Other joinExpr, elementSelectorConv | CallLeftOuterJoin - (_, [ _; qTy; immutInnerSourceTy; _; _], + (_, GenericArgs [ _; qTy; immutInnerSourceTy; _; _], [ immutOuterSource immutInnerSource Lambda(immutOuterKeyVar, immutOuterKeySelector) diff --git a/src/FSharp.Core/prim-types.fs b/src/FSharp.Core/prim-types.fs index 40b4941045b..1d5dcc28d05 100644 --- a/src/FSharp.Core/prim-types.fs +++ b/src/FSharp.Core/prim-types.fs @@ -2518,7 +2518,6 @@ namespace Microsoft.FSharp.Core // this condition is used whenever ^T is resolved to a nominal type when ^T : ^T = (^T : (static member Zero : ^T) ()) - let inline GenericOne< ^T when ^T : (static member One : ^T) > : ^T = GenericOneDynamic<(^T)>() when ^T : int32 = 1 @@ -2541,10 +2540,21 @@ namespace Microsoft.FSharp.Core when ^T : ^T = (^T : (static member One : ^T) ()) type Type with - + /// Gets a single static non-conversion operator or method by types member inline this.GetSingleStaticMethodByTypes(name: string, parameterTypes: Type[]) = - let staticBindingFlags = (# "" 0b111000 : BindingFlags #) // BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic - this.GetMethod(name, staticBindingFlags, null, parameterTypes, null ) + let staticBindingFlags = (# "" 0b111000 : BindingFlags #) // BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic + this.GetMethod(name, staticBindingFlags, null, parameterTypes, null ) + + // Logic based on https://github.com/dotnet/runtime/blob/f66b142980b2b0df738158457458e003944dc7f6/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/TypeUtils.cs#L662 + /// Gets a single static conversion operator by types + member inline this.GetSingleStaticConversionOperatorByTypes(fromType : Type, toType : Type) = + let staticBindingFlags = (# "" 0b111000 : BindingFlags #) // BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic + let mutable ret = null + for mi in this.GetMethods staticBindingFlags do + if (System.String.Equals(mi.Name, "op_Implicit") || System.String.Equals(mi.Name, "op_Explicit")) && + (let p = mi.GetParameters() in p.Length = 1 && (get p 0).ParameterType.IsEquivalentTo fromType) && mi.ReturnType.IsEquivalentTo toType then + ret <- mi + ret let UnaryDynamicImpl nm : ('T -> 'U) = let aty = typeof<'T> @@ -2567,7 +2577,14 @@ namespace Microsoft.FSharp.Core match meth with | null -> - let ameth = aty.GetSingleStaticMethodByTypes(opName, [| aty |]) + let ameth = + if System.String.Equals(opName, "op_Explicit") then + let aty2 = typeof<'U> + match aty.GetSingleStaticConversionOperatorByTypes(aty, aty2) with + | null -> aty2.GetSingleStaticConversionOperatorByTypes(aty, aty2) + | ameth -> ameth + else + aty.GetSingleStaticMethodByTypes(opName, [| aty |]) match ameth with | null -> raise (NotSupportedException (SR.GetString(SR.dyInvOpAddCoerce))) | res -> @@ -2633,6 +2650,7 @@ namespace Microsoft.FSharp.Core elif type3eq<'T1, 'T2, 'U, uint16> then convPrim<_,'U> (# "conv.u2" (# "sub" (convPrim<_,uint16> x) (convPrim<_,uint16> y) : uint32 #) : uint16 #) elif type3eq<'T1, 'T2, 'U, sbyte> then convPrim<_,'U> (# "conv.i1" (# "sub" (convPrim<_,sbyte> x) (convPrim<_,sbyte> y) : int32 #) : sbyte #) elif type3eq<'T1, 'T2, 'U, byte> then convPrim<_,'U> (# "conv.u1" (# "sub" (convPrim<_,byte> x) (convPrim<_,byte> y) : uint32 #) : byte #) + elif type3eq<'T1, 'T2, 'U, char> then convPrim<_,'U> (# "conv.u1" (# "sub" (convPrim<_,char> x) (convPrim<_,char> y) : uint32 #) : char #) elif type3eq<'T1, 'T2, 'U, decimal> then convPrim<_,'U> (Decimal.op_Subtraction(convPrim<_,decimal> x, convPrim<_,decimal> y)) else BinaryOpDynamicImplTable.Invoke "op_Subtraction" x y @@ -2715,7 +2733,7 @@ namespace Microsoft.FSharp.Core elif type3eq<'T1, 'T2, 'U, unativeint> then convPrim<_,'U> (# "add.ovf.un" (convPrim<_,unativeint> x) (convPrim<_,unativeint> y) : unativeint #) elif type3eq<'T1, 'T2, 'U, int16> then convPrim<_,'U> (# "conv.ovf.i2" (# "add.ovf" (convPrim<_,int16> x) (convPrim<_,int16> y) : int32 #) : int16 #) elif type3eq<'T1, 'T2, 'U, uint16> then convPrim<_,'U> (# "conv.ovf.u2.un" (# "add.ovf.un" (convPrim<_,uint16> x) (convPrim<_,uint16> y) : uint32 #) : uint16 #) - elif type3eq<'T1, 'T2, 'U, char> then convPrim<_,'U> (# "conv.ovf.u2.un" (# "add.ovf.un" (convPrim<_,char> x) (convPrim<_,char> y) : uint32 #) : uint16 #) + elif type3eq<'T1, 'T2, 'U, char> then convPrim<_,'U> (# "conv.ovf.u2.un" (# "add.ovf.un" (convPrim<_,char> x) (convPrim<_,char> y) : uint32 #) : char #) elif type3eq<'T1, 'T2, 'U, sbyte> then convPrim<_,'U> (# "conv.ovf.i1" (# "add.ovf" (convPrim<_,sbyte> x) (convPrim<_,sbyte> y) : int32 #) : sbyte #) elif type3eq<'T1, 'T2, 'U, byte> then convPrim<_,'U> (# "conv.ovf.u1.un" (# "add.ovf.un" (convPrim<_,byte> x) (convPrim<_,byte> y) : uint32 #) : byte #) elif type3eq<'T1, 'T2, 'U, string> then convPrim<_,'U> (String.Concat(convPrim<_,string> x, convPrim<_,string> y)) @@ -2735,6 +2753,7 @@ namespace Microsoft.FSharp.Core elif type3eq<'T1, 'T2, 'U, unativeint> then convPrim<_,'U> (# "sub.ovf.un" (convPrim<_,unativeint> x) (convPrim<_,unativeint> y) : unativeint #) elif type3eq<'T1, 'T2, 'U, int16> then convPrim<_,'U> (# "conv.ovf.i2" (# "sub.ovf" (convPrim<_,int16> x) (convPrim<_,int16> y) : int32 #) : int16 #) elif type3eq<'T1, 'T2, 'U, uint16> then convPrim<_,'U> (# "conv.ovf.u2.un" (# "sub.ovf.un" (convPrim<_,uint16> x) (convPrim<_,uint16> y) : uint32 #) : uint16 #) + elif type3eq<'T1, 'T2, 'U, char> then convPrim<_,'U> (# "conv.ovf.u2.un" (# "sub.ovf.un" (convPrim<_,char> x) (convPrim<_,char> y) : uint32 #) : char #) elif type3eq<'T1, 'T2, 'U, sbyte> then convPrim<_,'U> (# "conv.ovf.i1" (# "sub.ovf" (convPrim<_,sbyte> x) (convPrim<_,sbyte> y) : int32 #) : sbyte #) elif type3eq<'T1, 'T2, 'U, byte> then convPrim<_,'U> (# "conv.ovf.u1.un" (# "sub.ovf.un" (convPrim<_,byte> x) (convPrim<_,byte> y) : uint32 #) : byte #) elif type3eq<'T1, 'T2, 'U, decimal> then convPrim<_,'U> (Decimal.op_Subtraction(convPrim<_,decimal> x, convPrim<_,decimal> y)) @@ -2866,7 +2885,7 @@ namespace Microsoft.FSharp.Core let ExplicitDynamic<'T, 'U> (value: 'T) : 'U = if typeeq<'U, byte> then if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.u1" (convPrim<_,sbyte> value) : byte #) - elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.u1" (convPrim<_,byte> value) : byte #) + elif typeeq<'T, byte> then convPrim<_,'U> value elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.u1" (convPrim<_,int16> value) : byte #) elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.u1" (convPrim<_,uint16> value) : byte #) elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.u1" (convPrim<_,int32> value) : byte #) @@ -2881,7 +2900,7 @@ namespace Microsoft.FSharp.Core elif typeeq<'T, string> then convPrim<_,'U> (ParseByte (convPrim<_,string> value)) else UnaryOpDynamicImplTable.Invoke "op_Explicit" value elif typeeq<'U, sbyte> then - if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.i1" (convPrim<_,sbyte> value) : sbyte #) + if typeeq<'T, sbyte> then convPrim<_,'U> value elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.i1" (convPrim<_,byte> value) : sbyte #) elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.i1" (convPrim<_,int16> value) : sbyte #) elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.i1" (convPrim<_,uint16> value) : sbyte #) @@ -2900,7 +2919,7 @@ namespace Microsoft.FSharp.Core if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.u2" (convPrim<_,sbyte> value) : uint16 #) elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.u2" (convPrim<_,byte> value) : uint16 #) elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.u2" (convPrim<_,int16> value) : uint16 #) - elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.u2" (convPrim<_,uint16> value) : uint16 #) + elif typeeq<'T, uint16> then convPrim<_,'U> value elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.u2" (convPrim<_,int32> value) : uint16 #) elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.u2" (convPrim<_,uint32> value) : uint16 #) elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.u2" (convPrim<_,int64> value) : uint16 #) @@ -2909,13 +2928,13 @@ namespace Microsoft.FSharp.Core elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.u2" (convPrim<_,unativeint> value) : uint16 #) elif typeeq<'T, float> then convPrim<_,'U> (# "conv.u2" (convPrim<_,float> value) : uint16 #) elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.u2" (convPrim<_,float32> value) : uint16 #) - elif typeeq<'T, char> then convPrim<_,'U> (# "conv.u2" (convPrim<_,char> value) : uint16 #) + elif typeeq<'T, char> then convPrim<_,'U> (# "" (convPrim<_,char> value) : uint16 #) elif typeeq<'T, string> then convPrim<_,'U> (ParseUInt16 (convPrim<_,string> value)) else UnaryOpDynamicImplTable.Invoke "op_Explicit" value elif typeeq<'U, int16> then if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.i2" (convPrim<_,sbyte> value) : int16 #) elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.i2" (convPrim<_,byte> value) : int16 #) - elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.i2" (convPrim<_,int16> value) : int16 #) + elif typeeq<'T, int16> then convPrim<_,'U> value elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.i2" (convPrim<_,uint16> value) : int16 #) elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.i2" (convPrim<_,int32> value) : int16 #) elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.i2" (convPrim<_,uint32> value) : int16 #) @@ -2934,7 +2953,7 @@ namespace Microsoft.FSharp.Core elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.u4" (convPrim<_,int16> value) : uint32 #) elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.u4" (convPrim<_,uint16> value) : uint32 #) elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.u4" (convPrim<_,int32> value) : uint32 #) - elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.u4" (convPrim<_,uint32> value) : uint32 #) + elif typeeq<'T, uint32> then convPrim<_,'U> value elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.u4" (convPrim<_,int64> value) : uint32 #) elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.u4" (convPrim<_,uint64> value) : uint32 #) elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.u4" (convPrim<_,nativeint> value) : uint32 #) @@ -2949,8 +2968,8 @@ namespace Microsoft.FSharp.Core elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.i4" (convPrim<_,byte> value) : int32 #) elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.i4" (convPrim<_,int16> value) : int32 #) elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.i4" (convPrim<_,uint16> value) : int32 #) - elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.i4" (convPrim<_,int32> value) : int32 #) - elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.i4" (convPrim<_,uint32> value) : int32 #) + elif typeeq<'T, int32> then convPrim<_,'U> value + elif typeeq<'T, uint32> then convPrim<_,'U> (# "" (convPrim<_,uint32> value) : int32 #) elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.i4" (convPrim<_,int64> value) : int32 #) elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.i4" (convPrim<_,uint64> value) : int32 #) elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.i4" (convPrim<_,nativeint> value) : int32 #) @@ -2968,7 +2987,7 @@ namespace Microsoft.FSharp.Core elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.i8" (convPrim<_,int32> value) : uint64 #) elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.u8" (convPrim<_,uint32> value) : uint64 #) elif typeeq<'T, int64> then convPrim<_,'U> (# "" (convPrim<_,int64> value) : uint64 #) - elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.i8" (convPrim<_,uint64> value) : uint64 #) + elif typeeq<'T, uint64> then convPrim<_,'U> value elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.i8" (convPrim<_,nativeint> value) : uint64 #) elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.u8" (convPrim<_,unativeint> value) : uint64 #) elif typeeq<'T, float> then convPrim<_,'U> (# "conv.u8" (convPrim<_,float> value) : uint64 #) @@ -2983,12 +3002,12 @@ namespace Microsoft.FSharp.Core elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.u8" (convPrim<_,uint16> value) : int64 #) elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.i8" (convPrim<_,int32> value) : int64 #) elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.u8" (convPrim<_,uint32> value) : int64 #) - elif typeeq<'T, int64> then convPrim<_,'U> (convPrim<_,int64> value) + elif typeeq<'T, int64> then convPrim<_,'U> value elif typeeq<'T, uint64> then convPrim<_,'U> (# "" (convPrim<_,uint64> value) : int64 #) elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.i8" (convPrim<_,nativeint> value) : int64 #) elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.u8" (convPrim<_,unativeint> value) : int64 #) - elif typeeq<'T, float> then convPrim<_,'U> (# "conv.u8" (convPrim<_,float> value) : int64 #) - elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.u8" (convPrim<_,float32> value) : int64 #) + elif typeeq<'T, float> then convPrim<_,'U> (# "conv.i8" (convPrim<_,float> value) : int64 #) + elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.i8" (convPrim<_,float32> value) : int64 #) elif typeeq<'T, char> then convPrim<_,'U> (# "conv.u8" (convPrim<_,char> value) : int64 #) elif typeeq<'T, string> then convPrim<_,'U> (ParseInt64 (convPrim<_,string> value)) else UnaryOpDynamicImplTable.Invoke "op_Explicit" value @@ -3004,6 +3023,7 @@ namespace Microsoft.FSharp.Core elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.r4" (convPrim<_,nativeint> value) : float32 #) elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.r.un conv.r4" (convPrim<_,unativeint> value) : float32 #) elif typeeq<'T, float> then convPrim<_,'U> (# "conv.r4" (convPrim<_,float> value) : float32 #) + // NOTE: float32 should convert its argument to 32-bit float even when applied to a higher precision float stored in a register. See devdiv2#49888. elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.r4" (convPrim<_,float32> value) : float32 #) elif typeeq<'T, char> then convPrim<_,'U> (# "conv.r.un conv.r4" (convPrim<_,char> value) : float32 #) elif typeeq<'T, string> then convPrim<_,'U> (ParseSingle (convPrim<_,string> value)) @@ -3019,6 +3039,7 @@ namespace Microsoft.FSharp.Core elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.r.un conv.r8" (convPrim<_,uint64> value) : float #) elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.r8" (convPrim<_,nativeint> value) : float #) elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.r.un conv.r8" (convPrim<_,unativeint> value) : float #) + // NOTE: float should convert its argument to 64-bit float even when applied to a higher precision float stored in a register. See devdiv2#49888. elif typeeq<'T, float> then convPrim<_,'U> (# "conv.r8" (convPrim<_,float> value) : float #) elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.r8" (convPrim<_,float32> value) : float #) elif typeeq<'T, char> then convPrim<_,'U> (# "conv.r.un conv.r8" (convPrim<_,char> value) : float #) @@ -3035,10 +3056,11 @@ namespace Microsoft.FSharp.Core elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.i" (convPrim<_,int64> value) : unativeint #) elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.u" (convPrim<_,uint64> value) : unativeint #) elif typeeq<'T, nativeint> then convPrim<_,'U> (# "" (convPrim<_,nativeint> value) : unativeint #) - elif typeeq<'T, unativeint> then convPrim<_,'U> (# "" (convPrim<_,unativeint> value) : unativeint #) + elif typeeq<'T, unativeint> then convPrim<_,'U> value elif typeeq<'T, float> then convPrim<_,'U> (# "conv.u" (convPrim<_,float> value) : unativeint #) elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.u" (convPrim<_,float32> value) : unativeint #) elif typeeq<'T, char> then convPrim<_,'U> (# "conv.u" (convPrim<_,char> value) : unativeint #) + elif typeeq<'T, decimal> then convPrim<_,'U> (# "conv.u" (Decimal.op_Explicit (convPrim<_,decimal> value) : uint64) : unativeint #) elif typeeq<'T, string> then convPrim<_,'U> (ParseUIntPtr (convPrim<_,string> value)) else UnaryOpDynamicImplTable.Invoke "op_Explicit" value elif typeeq<'U, nativeint> then @@ -3050,11 +3072,12 @@ namespace Microsoft.FSharp.Core elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.u" (convPrim<_,uint32> value) : nativeint #) elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.i" (convPrim<_,int64> value) : nativeint #) elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.u" (convPrim<_,uint64> value) : nativeint #) - elif typeeq<'T, nativeint> then convPrim<_,'U> (# "" (convPrim<_,nativeint> value) : nativeint #) + elif typeeq<'T, nativeint> then convPrim<_,'U> value elif typeeq<'T, unativeint> then convPrim<_,'U> (# "" (convPrim<_,unativeint> value) : nativeint #) elif typeeq<'T, float> then convPrim<_,'U> (# "conv.i" (convPrim<_,float> value) : nativeint #) elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.i" (convPrim<_,float32> value) : nativeint #) elif typeeq<'T, char> then convPrim<_,'U> (# "conv.u" (convPrim<_,char> value) : nativeint #) + elif typeeq<'T, decimal> then convPrim<_,'U> (# "conv.i" (Decimal.op_Explicit (convPrim<_,decimal> value) : int64) : nativeint #) elif typeeq<'T, string> then convPrim<_,'U> (ParseIntPtr (convPrim<_,string> value)) else UnaryOpDynamicImplTable.Invoke "op_Explicit" value elif typeeq<'U, char> then @@ -3070,7 +3093,8 @@ namespace Microsoft.FSharp.Core elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.u2" (convPrim<_,unativeint> value) : char #) elif typeeq<'T, float> then convPrim<_,'U> (# "conv.u2" (convPrim<_,float> value) : char #) elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.u2" (convPrim<_,float32> value) : char #) - elif typeeq<'T, char> then convPrim<_,'U> (# "conv.u2" (convPrim<_,char> value) : char #) + elif typeeq<'T, char> then convPrim<_,'U> value + elif typeeq<'T, decimal> then convPrim<_,'U> (Decimal.op_Explicit (convPrim<_,decimal> value) : char) elif typeeq<'T, string> then convPrim<_,'U> (Char.Parse (convPrim<_,string> value)) else UnaryOpDynamicImplTable.Invoke "op_Explicit" value elif typeeq<'U, decimal> then @@ -3086,7 +3110,240 @@ namespace Microsoft.FSharp.Core elif typeeq<'T, unativeint> then convPrim<_,'U> (Convert.ToDecimal (# "conv.u8" (convPrim<_,unativeint> value) : uint64 #)) elif typeeq<'T, float> then convPrim<_,'U> (Convert.ToDecimal (convPrim<_,float> value)) elif typeeq<'T, float32> then convPrim<_,'U> (Convert.ToDecimal (convPrim<_,float32> value)) - elif typeeq<'T, char> then convPrim<_,'U> (Convert.ToDecimal (convPrim<_,char> value)) + elif typeeq<'T, char> then convPrim<_,'U> (Convert.ToDecimal (# "" (convPrim<_,char> value) : uint16 #)) + elif typeeq<'T, decimal> then convPrim<_,'U> value + elif typeeq<'T, string> then convPrim<_,'U> (Decimal.Parse(convPrim<_,string> value, NumberStyles.Float,CultureInfo.InvariantCulture)) + else UnaryOpDynamicImplTable.Invoke "op_Explicit" value + else + UnaryOpDynamicImplTable.Invoke "op_Explicit" value + + let CheckedExplicitDynamic<'T, 'U> (value: 'T) : 'U = + if typeeq<'U, byte> then + if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.ovf.u1" (convPrim<_,sbyte> value) : byte #) + elif typeeq<'T, byte> then convPrim<_,'U> value + elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.ovf.u1" (convPrim<_,int16> value) : byte #) + elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.ovf.u1.un" (convPrim<_,uint16> value) : byte #) + elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.ovf.u1" (convPrim<_,int32> value) : byte #) + elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.ovf.u1.un" (convPrim<_,uint32> value) : byte #) + elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.ovf.u1" (convPrim<_,int64> value) : byte #) + elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.ovf.u1.un" (convPrim<_,uint64> value) : byte #) + elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.ovf.u1" (convPrim<_,nativeint> value) : byte #) + elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.ovf.u1.un" (convPrim<_,unativeint> value) : byte #) + elif typeeq<'T, float> then convPrim<_,'U> (# "conv.ovf.u1" (convPrim<_,float> value) : byte #) + elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.ovf.u1" (convPrim<_,float32> value) : byte #) + elif typeeq<'T, char> then convPrim<_,'U> (# "conv.ovf.u1.un" (convPrim<_,char> value) : byte #) + elif typeeq<'T, string> then convPrim<_,'U> (ParseByte (convPrim<_,string> value)) + else UnaryOpDynamicImplTable.Invoke "op_Explicit" value + elif typeeq<'U, sbyte> then + if typeeq<'T, sbyte> then convPrim<_,'U> value + elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.ovf.i1.un" (convPrim<_,byte> value) : sbyte #) + elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.ovf.i1" (convPrim<_,int16> value) : sbyte #) + elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.ovf.i1.un" (convPrim<_,uint16> value) : sbyte #) + elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.ovf.i1" (convPrim<_,int32> value) : sbyte #) + elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.ovf.i1.un" (convPrim<_,uint32> value) : sbyte #) + elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.ovf.i1" (convPrim<_,int64> value) : sbyte #) + elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.ovf.i1.un" (convPrim<_,uint64> value) : sbyte #) + elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.ovf.i1" (convPrim<_,nativeint> value) : sbyte #) + elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.ovf.i1.un" (convPrim<_,unativeint> value) : sbyte #) + elif typeeq<'T, float> then convPrim<_,'U> (# "conv.ovf.i1" (convPrim<_,float> value) : sbyte #) + elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.ovf.i1" (convPrim<_,float32> value) : sbyte #) + elif typeeq<'T, char> then convPrim<_,'U> (# "conv.ovf.i1.un" (convPrim<_,char> value) : sbyte #) + elif typeeq<'T, string> then convPrim<_,'U> (ParseSByte (convPrim<_,string> value)) + else UnaryOpDynamicImplTable.Invoke "op_Explicit" value + elif typeeq<'U, uint16> then + if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.ovf.u2" (convPrim<_,sbyte> value) : uint16 #) + elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.ovf.u2.un" (convPrim<_,byte> value) : uint16 #) + elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.ovf.u2" (convPrim<_,int16> value) : uint16 #) + elif typeeq<'T, uint16> then convPrim<_,'U> value + elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.ovf.u2" (convPrim<_,int32> value) : uint16 #) + elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.ovf.u2.un" (convPrim<_,uint32> value) : uint16 #) + elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.ovf.u2" (convPrim<_,int64> value) : uint16 #) + elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.ovf.u2.un" (convPrim<_,uint64> value) : uint16 #) + elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.ovf.u2" (convPrim<_,nativeint> value) : uint16 #) + elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.ovf.u2.un" (convPrim<_,unativeint> value) : uint16 #) + elif typeeq<'T, float> then convPrim<_,'U> (# "conv.ovf.u2" (convPrim<_,float> value) : uint16 #) + elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.ovf.u2" (convPrim<_,float32> value) : uint16 #) + elif typeeq<'T, char> then convPrim<_,'U> (# "" (convPrim<_,char> value) : uint16 #) + elif typeeq<'T, string> then convPrim<_,'U> (ParseUInt16 (convPrim<_,string> value)) + else UnaryOpDynamicImplTable.Invoke "op_Explicit" value + elif typeeq<'U, int16> then + if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.ovf.i2" (convPrim<_,sbyte> value) : int16 #) + elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.ovf.i2.un" (convPrim<_,byte> value) : int16 #) + elif typeeq<'T, int16> then convPrim<_,'U> value + elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.ovf.i2.un" (convPrim<_,uint16> value) : int16 #) + elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.ovf.i2" (convPrim<_,int32> value) : int16 #) + elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.ovf.i2.un" (convPrim<_,uint32> value) : int16 #) + elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.ovf.i2" (convPrim<_,int64> value) : int16 #) + elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.ovf.i2.un" (convPrim<_,uint64> value) : int16 #) + elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.ovf.i2" (convPrim<_,nativeint> value) : int16 #) + elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.ovf.i2.un" (convPrim<_,unativeint> value) : int16 #) + elif typeeq<'T, float> then convPrim<_,'U> (# "conv.ovf.i2" (convPrim<_,float> value) : int16 #) + elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.ovf.i2" (convPrim<_,float32> value) : int16 #) + elif typeeq<'T, char> then convPrim<_,'U> (# "conv.ovf.i2.un" (convPrim<_,char> value) : int16 #) + elif typeeq<'T, string> then convPrim<_,'U> (ParseInt16 (convPrim<_,string> value)) + else UnaryOpDynamicImplTable.Invoke "op_Explicit" value + elif typeeq<'U, uint32> then + if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.ovf.u4" (convPrim<_,sbyte> value) : uint32 #) + elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.ovf.u4.un" (convPrim<_,byte> value) : uint32 #) + elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.ovf.u4" (convPrim<_,int16> value) : uint32 #) + elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.ovf.u4.un" (convPrim<_,uint16> value) : uint32 #) + elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.ovf.u4" (convPrim<_,int32> value) : uint32 #) + elif typeeq<'T, uint32> then convPrim<_,'U> value + elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.ovf.u4" (convPrim<_,int64> value) : uint32 #) + elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.ovf.u4.un" (convPrim<_,uint64> value) : uint32 #) + elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.ovf.u4" (convPrim<_,nativeint> value) : uint32 #) + elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.ovf.u4.un" (convPrim<_,unativeint> value) : uint32 #) + elif typeeq<'T, float> then convPrim<_,'U> (# "conv.ovf.u4" (convPrim<_,float> value) : uint32 #) + elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.ovf.u4" (convPrim<_,float32> value) : uint32 #) + elif typeeq<'T, char> then convPrim<_,'U> (# "conv.ovf.u4.un" (convPrim<_,char> value) : uint32 #) + elif typeeq<'T, string> then convPrim<_,'U> (ParseUInt32 (convPrim<_,string> value)) + else UnaryOpDynamicImplTable.Invoke "op_Explicit" value + elif typeeq<'U, int32> then + if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.ovf.i4" (convPrim<_,sbyte> value) : int32 #) + elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.ovf.i4.un" (convPrim<_,byte> value) : int32 #) + elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.ovf.i4" (convPrim<_,int16> value) : int32 #) + elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.ovf.i4.un" (convPrim<_,uint16> value) : int32 #) + elif typeeq<'T, int32> then convPrim<_,'U> value + elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.ovf.i4.un" (convPrim<_,uint32> value) : int32 #) + elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.ovf.i4" (convPrim<_,int64> value) : int32 #) + elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.ovf.i4.un" (convPrim<_,uint64> value) : int32 #) + elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.ovf.i4" (convPrim<_,nativeint> value) : int32 #) + elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.ovf.i4.un" (convPrim<_,unativeint> value) : int32 #) + elif typeeq<'T, float> then convPrim<_,'U> (# "conv.ovf.i4" (convPrim<_,float> value) : int32 #) + elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.ovf.i4" (convPrim<_,float32> value) : int32 #) + elif typeeq<'T, char> then convPrim<_,'U> (# "conv.ovf.i4.un" (convPrim<_,char> value) : int32 #) + elif typeeq<'T, string> then convPrim<_,'U> (ParseInt32 (convPrim<_,string> value)) + else UnaryOpDynamicImplTable.Invoke "op_Explicit" value + elif typeeq<'U, uint64> then + if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.ovf.u8" (convPrim<_,sbyte> value) : uint64 #) + elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.ovf.u8.un" (convPrim<_,byte> value) : uint64 #) + elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.ovf.u8" (convPrim<_,int16> value) : uint64 #) + elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.ovf.u8.un" (convPrim<_,uint16> value) : uint64 #) + elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.ovf.u8" (convPrim<_,int32> value) : uint64 #) + elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.ovf.u8.un" (convPrim<_,uint32> value) : uint64 #) + elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.ovf.u8" (convPrim<_,int64> value) : uint64 #) + elif typeeq<'T, uint64> then convPrim<_,'U> value + elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.ovf.u8" (convPrim<_,nativeint> value) : uint64 #) + elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.ovf.u8.un" (convPrim<_,unativeint> value) : uint64 #) + elif typeeq<'T, float> then convPrim<_,'U> (# "conv.ovf.u8" (convPrim<_,float> value) : uint64 #) + elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.ovf.u8" (convPrim<_,float32> value) : uint64 #) + elif typeeq<'T, char> then convPrim<_,'U> (# "conv.ovf.u8.un" (convPrim<_,char> value) : uint64 #) + elif typeeq<'T, string> then convPrim<_,'U> (ParseUInt64 (convPrim<_,string> value)) + else UnaryOpDynamicImplTable.Invoke "op_Explicit" value + elif typeeq<'U, int64> then + if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.ovf.i8" (convPrim<_,sbyte> value) : int64 #) + elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.ovf.i8.un" (convPrim<_,byte> value) : int64 #) + elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.ovf.i8" (convPrim<_,int16> value) : int64 #) + elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.ovf.i8.un" (convPrim<_,uint16> value) : int64 #) + elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.ovf.i8" (convPrim<_,int32> value) : int64 #) + elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.ovf.i8.un" (convPrim<_,uint32> value) : int64 #) + elif typeeq<'T, int64> then convPrim<_,'U> value + elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.ovf.i8.un" (convPrim<_,uint64> value) : int64 #) + elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.ovf.i8" (convPrim<_,nativeint> value) : int64 #) + elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.ovf.i8.un" (convPrim<_,unativeint> value) : int64 #) + elif typeeq<'T, float> then convPrim<_,'U> (# "conv.ovf.i8" (convPrim<_,float> value) : int64 #) + elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.ovf.i8" (convPrim<_,float32> value) : int64 #) + elif typeeq<'T, char> then convPrim<_,'U> (# "conv.ovf.i8.un" (convPrim<_,char> value) : int64 #) + elif typeeq<'T, string> then convPrim<_,'U> (ParseInt64 (convPrim<_,string> value)) + else UnaryOpDynamicImplTable.Invoke "op_Explicit" value + elif typeeq<'U, float32> then + if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.r4" (convPrim<_,sbyte> value) : float32 #) + elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.r.un conv.r4" (convPrim<_,byte> value) : float32 #) + elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.r4" (convPrim<_,int16> value) : float32 #) + elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.r.un conv.r4" (convPrim<_,uint16> value) : float32 #) + elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.r4" (convPrim<_,int32> value) : float32 #) + elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.r.un conv.r4" (convPrim<_,uint32> value) : float32 #) + elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.r4" (convPrim<_,int64> value) : float32 #) + elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.r.un conv.r4" (convPrim<_,uint64> value) : float32 #) + elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.r4" (convPrim<_,nativeint> value) : float32 #) + elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.r.un conv.r4" (convPrim<_,unativeint> value) : float32 #) + elif typeeq<'T, float> then convPrim<_,'U> (# "conv.r4" (convPrim<_,float> value) : float32 #) + elif typeeq<'T, float32> then convPrim<_,'U> value + elif typeeq<'T, char> then convPrim<_,'U> (# "conv.r.un conv.r4" (convPrim<_,char> value) : float32 #) + elif typeeq<'T, string> then convPrim<_,'U> (ParseSingle (convPrim<_,string> value)) + else UnaryOpDynamicImplTable.Invoke "op_Explicit" value + elif typeeq<'U, float> then + if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.r8" (convPrim<_,sbyte> value) : float #) + elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.r.un conv.r8" (convPrim<_,byte> value) : float #) + elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.r8" (convPrim<_,int16> value) : float #) + elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.r.un conv.r8" (convPrim<_,uint16> value) : float #) + elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.r8" (convPrim<_,int32> value) : float #) + elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.r.un conv.r8" (convPrim<_,uint32> value) : float #) + elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.r8" (convPrim<_,int64> value) : float #) + elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.r.un conv.r8" (convPrim<_,uint64> value) : float #) + elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.r8" (convPrim<_,nativeint> value) : float #) + elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.r.un conv.r8" (convPrim<_,unativeint> value) : float #) + elif typeeq<'T, float> then convPrim<_,'U> value + elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.r8" (convPrim<_,float32> value) : float #) + elif typeeq<'T, char> then convPrim<_,'U> (# "conv.r.un conv.r8" (convPrim<_,char> value) : float #) + elif typeeq<'T, decimal> then convPrim<_,'U> (Convert.ToDouble(convPrim<_,decimal> value)) + elif typeeq<'T, string> then convPrim<_,'U> (ParseDouble (convPrim<_,string> value)) + else UnaryOpDynamicImplTable.Invoke "op_Explicit" value + elif typeeq<'U, unativeint> then + if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.ovf.u" (convPrim<_,sbyte> value) : unativeint #) + elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.ovf.u.un" (convPrim<_,byte> value) : unativeint #) + elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.ovf.u" (convPrim<_,int16> value) : unativeint #) + elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.ovf.u.un" (convPrim<_,uint16> value) : unativeint #) + elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.ovf.u" (convPrim<_,int32> value) : unativeint #) + elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.ovf.u.un" (convPrim<_,uint32> value) : unativeint #) + elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.ovf.u" (convPrim<_,int64> value) : unativeint #) + elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.ovf.u.un" (convPrim<_,uint64> value) : unativeint #) + elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.ovf.u" (convPrim<_,nativeint> value) : unativeint #) + elif typeeq<'T, unativeint> then convPrim<_,'U> value + elif typeeq<'T, float> then convPrim<_,'U> (# "conv.ovf.u" (convPrim<_,float> value) : unativeint #) + elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.ovf.u" (convPrim<_,float32> value) : unativeint #) + elif typeeq<'T, char> then convPrim<_,'U> (# "conv.ovf.u.un" (convPrim<_,char> value) : unativeint #) + elif typeeq<'T, decimal> then convPrim<_,'U> (# "conv.ovf.u" (Decimal.op_Explicit (convPrim<_,decimal> value) : uint64) : unativeint #) + elif typeeq<'T, string> then convPrim<_,'U> (ParseUIntPtr (convPrim<_,string> value)) + else UnaryOpDynamicImplTable.Invoke "op_Explicit" value + elif typeeq<'U, nativeint> then + if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.ovf.i" (convPrim<_,sbyte> value) : nativeint #) + elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.ovf.i.un" (convPrim<_,byte> value) : nativeint #) + elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.ovf.i" (convPrim<_,int16> value) : nativeint #) + elif typeeq<'T, uint16> then convPrim<_,'U> (# "conv.ovf.i.un" (convPrim<_,uint16> value) : nativeint #) + elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.ovf.i" (convPrim<_,int32> value) : nativeint #) + elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.ovf.i.un" (convPrim<_,uint32> value) : nativeint #) + elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.ovf.i" (convPrim<_,int64> value) : nativeint #) + elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.ovf.i.un" (convPrim<_,uint64> value) : nativeint #) + elif typeeq<'T, nativeint> then convPrim<_,'U> value + elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.ovf.i.un" (convPrim<_,unativeint> value) : nativeint #) + elif typeeq<'T, float> then convPrim<_,'U> (# "conv.ovf.i" (convPrim<_,float> value) : nativeint #) + elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.ovf.i" (convPrim<_,float32> value) : nativeint #) + elif typeeq<'T, char> then convPrim<_,'U> (# "conv.ovf.i.un" (convPrim<_,char> value) : nativeint #) + elif typeeq<'T, decimal> then convPrim<_,'U> (# "conv.ovf.i" (Decimal.op_Explicit (convPrim<_,decimal> value) : int64) : nativeint #) + elif typeeq<'T, string> then convPrim<_,'U> (ParseIntPtr (convPrim<_,string> value)) + else UnaryOpDynamicImplTable.Invoke "op_Explicit" value + elif typeeq<'U, char> then + if typeeq<'T, sbyte> then convPrim<_,'U> (# "conv.ovf.u2" (convPrim<_,sbyte> value) : char #) + elif typeeq<'T, byte> then convPrim<_,'U> (# "conv.ovf.u2.un" (convPrim<_,byte> value) : char #) + elif typeeq<'T, int16> then convPrim<_,'U> (# "conv.ovf.u2" (convPrim<_,int16> value) : char #) + elif typeeq<'T, uint16> then convPrim<_,'U> (# "" (convPrim<_,uint16> value) : char #) + elif typeeq<'T, int32> then convPrim<_,'U> (# "conv.ovf.u2" (convPrim<_,int32> value) : char #) + elif typeeq<'T, uint32> then convPrim<_,'U> (# "conv.ovf.u2.un" (convPrim<_,uint32> value) : char #) + elif typeeq<'T, int64> then convPrim<_,'U> (# "conv.ovf.u2" (convPrim<_,int64> value) : char #) + elif typeeq<'T, uint64> then convPrim<_,'U> (# "conv.ovf.u2.un" (convPrim<_,uint64> value) : char #) + elif typeeq<'T, nativeint> then convPrim<_,'U> (# "conv.ovf.u2" (convPrim<_,nativeint> value) : char #) + elif typeeq<'T, unativeint> then convPrim<_,'U> (# "conv.ovf.u2.un" (convPrim<_,unativeint> value) : char #) + elif typeeq<'T, float> then convPrim<_,'U> (# "conv.ovf.u2" (convPrim<_,float> value) : char #) + elif typeeq<'T, float32> then convPrim<_,'U> (# "conv.ovf.u2" (convPrim<_,float32> value) : char #) + elif typeeq<'T, char> then convPrim<_,'U> value + elif typeeq<'T, decimal> then convPrim<_,'U> (Decimal.op_Explicit (convPrim<_,decimal> value) : char) + elif typeeq<'T, string> then convPrim<_,'U> (System.Char.Parse (convPrim<_,string> value)) + else UnaryOpDynamicImplTable.Invoke "op_Explicit" value + elif typeeq<'U, decimal> then + if typeeq<'T, sbyte> then convPrim<_,'U> (Convert.ToDecimal (convPrim<_,sbyte> value)) + elif typeeq<'T, byte> then convPrim<_,'U> (Convert.ToDecimal (convPrim<_,byte> value)) + elif typeeq<'T, int16> then convPrim<_,'U> (Convert.ToDecimal (convPrim<_,int16> value)) + elif typeeq<'T, uint16> then convPrim<_,'U> (Convert.ToDecimal (convPrim<_,uint16> value)) + elif typeeq<'T, int32> then convPrim<_,'U> (Convert.ToDecimal (convPrim<_,int32> value)) + elif typeeq<'T, uint32> then convPrim<_,'U> (Convert.ToDecimal (convPrim<_,uint32> value)) + elif typeeq<'T, int64> then convPrim<_,'U> (Convert.ToDecimal (convPrim<_,int64> value)) + elif typeeq<'T, uint64> then convPrim<_,'U> (Convert.ToDecimal (convPrim<_,uint64> value)) + elif typeeq<'T, nativeint> then convPrim<_,'U> (Convert.ToDecimal (# "conv.i8" (convPrim<_,nativeint> value) : int64 #)) + elif typeeq<'T, unativeint> then convPrim<_,'U> (Convert.ToDecimal (# "conv.u8" (convPrim<_,unativeint> value) : uint64 #)) + elif typeeq<'T, float> then convPrim<_,'U> (Convert.ToDecimal (convPrim<_,float> value)) + elif typeeq<'T, float32> then convPrim<_,'U> (Convert.ToDecimal (convPrim<_,float32> value)) + elif typeeq<'T, char> then convPrim<_,'U> (Convert.ToDecimal (# "" (convPrim<_,char> value) : uint16 #)) elif typeeq<'T, decimal> then convPrim<'T,'U> value elif typeeq<'T, string> then convPrim<_,'U> (Decimal.Parse(convPrim<_,string> value, NumberStyles.Float,CultureInfo.InvariantCulture)) else UnaryOpDynamicImplTable.Invoke "op_Explicit" value @@ -3211,7 +3468,7 @@ namespace Microsoft.FSharp.Core elif type2eq<'T1, 'T2, char> && typeeq<'U, bool> then convPrim<_,'U> (not (# "ceq" (convPrim<_,char> x) (convPrim<_,char> y) : bool #)) elif type2eq<'T1, 'T2, decimal> && typeeq<'U, bool> then convPrim<_,'U> (Decimal.op_Inequality (convPrim<_,decimal> x, convPrim<_,decimal> y)) elif type2eq<'T1, 'T2, string> && typeeq<'U, bool> then convPrim<_,'U> (not (String.Equals (convPrim<_,string> x, convPrim<_,string> y))) - else BinaryOpDynamicImplTable.Invoke "op_Inequality" x y + else BinaryOpDynamicImplTable.Invoke "op_Inequality" x y type DivideByIntInfo = class end @@ -4054,6 +4311,7 @@ namespace Microsoft.FSharp.Core when ^T : unativeint and ^U : unativeint = (# "sub" x y : unativeint #) when ^T : int16 and ^U : int16 = (# "conv.i2" (# "sub" x y : int32 #) : int16 #) when ^T : uint16 and ^U : uint16 = (# "conv.u2" (# "sub" x y : uint32 #) : uint16 #) + when ^T : char and ^U : char = (# "conv.u2" (# "sub" x y : uint32 #) : char #) when ^T : sbyte and ^U : sbyte = (# "conv.i1" (# "sub" x y : int32 #) : sbyte #) when ^T : byte and ^U : byte = (# "conv.u1" (# "sub" x y : uint32 #) : byte #) when ^T : decimal and ^U : decimal = (# "" (Decimal.op_Subtraction((# "" x : decimal #),(# "" y : decimal #))) : ^V #) @@ -4283,7 +4541,7 @@ namespace Microsoft.FSharp.Core when ^T : uint16 = (# "conv.u1" value : byte #) when ^T : char = (# "conv.u1" value : byte #) when ^T : unativeint = (# "conv.u1" value : byte #) - when ^T : byte = (# "conv.u1" value : byte #) + when ^T : byte = (# "" value : byte #) // According to the somewhat subtle rules of static optimizations, // this condition is used whenever ^T is resolved to a nominal type or witnesses are available when ^T : ^T = (^T : (static member op_Explicit: ^T -> byte) (value)) @@ -4299,11 +4557,11 @@ namespace Microsoft.FSharp.Core when ^T : int32 = (# "conv.i1" value : sbyte #) when ^T : int16 = (# "conv.i1" value : sbyte #) when ^T : nativeint = (# "conv.i1" value : sbyte #) - when ^T : sbyte = (# "conv.i1" value : sbyte #) - when ^T : uint64 = (# "conv.i1" value : sbyte #) - when ^T : uint32 = (# "conv.i1" value : sbyte #) - when ^T : uint16 = (# "conv.i1" value : sbyte #) - when ^T : char = (# "conv.i1" value : sbyte #) + when ^T : sbyte = (# "" value : sbyte #) + when ^T : uint64 = (# "conv.i1" value : sbyte #) + when ^T : uint32 = (# "conv.i1" value : sbyte #) + when ^T : uint16 = (# "conv.i1" value : sbyte #) + when ^T : char = (# "conv.i1" value : sbyte #) when ^T : unativeint = (# "conv.i1" value : sbyte #) when ^T : byte = (# "conv.i1" value : sbyte #) // According to the somewhat subtle rules of static optimizations, @@ -4322,10 +4580,10 @@ namespace Microsoft.FSharp.Core when ^T : int16 = (# "conv.u2" value : uint16 #) when ^T : nativeint = (# "conv.u2" value : uint16 #) when ^T : sbyte = (# "conv.u2" value : uint16 #) - when ^T : uint64 = (# "conv.u2" value : uint16 #) - when ^T : uint32 = (# "conv.u2" value : uint16 #) - when ^T : uint16 = (# "conv.u2" value : uint16 #) - when ^T : char = (# "conv.u2" value : uint16 #) + when ^T : uint64 = (# "conv.u2" value : uint16 #) + when ^T : uint32 = (# "conv.u2" value : uint16 #) + when ^T : uint16 = (# "" value : uint16 #) + when ^T : char = (# "" value : uint16 #) when ^T : unativeint = (# "conv.u2" value : uint16 #) when ^T : byte = (# "conv.u2" value : uint16 #) // According to the somewhat subtle rules of static optimizations, @@ -4341,7 +4599,7 @@ namespace Microsoft.FSharp.Core when ^T : float32 = (# "conv.i2" value : int16 #) when ^T : int64 = (# "conv.i2" value : int16 #) when ^T : int32 = (# "conv.i2" value : int16 #) - when ^T : int16 = (# "conv.i2" value : int16 #) + when ^T : int16 = (# "" value : int16 #) when ^T : nativeint = (# "conv.i2" value : int16 #) when ^T : sbyte = (# "conv.i2" value : int16 #) when ^T : uint64 = (# "conv.i2" value : int16 #) @@ -4368,10 +4626,10 @@ namespace Microsoft.FSharp.Core when ^T : int32 = (# "" value : uint32 #) when ^T : int16 = (# "" value : uint32 #) when ^T : sbyte = (# "" value : uint32 #) - when ^T : uint64 = (# "conv.u4" value : uint32 #) - when ^T : uint32 = (# "conv.u4" value : uint32 #) - when ^T : uint16 = (# "conv.u4" value : uint32 #) - when ^T : char = (# "conv.u4" value : uint32 #) + when ^T : uint64 = (# "conv.u4" value : uint32 #) + when ^T : uint32 = (# "" value : uint32 #) + when ^T : uint16 = (# "conv.u4" value : uint32 #) + when ^T : char = (# "conv.u4" value : uint32 #) when ^T : unativeint = (# "conv.u4" value : uint32 #) when ^T : byte = (# "conv.u4" value : uint32 #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> uint32) (value)) @@ -4453,7 +4711,7 @@ namespace Microsoft.FSharp.Core when ^T : string = ParseInt64 (castToString value) when ^T : float = (# "conv.i8" value : int64 #) when ^T : float32 = (# "conv.i8" value : int64 #) - when ^T : int64 = (# "conv.i8" value : int64 #) + when ^T : int64 = (# "" value : int64 #) when ^T : int32 = (# "conv.i8" value : int64 #) when ^T : int16 = (# "conv.i8" value : int64 #) when ^T : nativeint = (# "conv.i8" value : int64 #) @@ -4517,18 +4775,19 @@ namespace Microsoft.FSharp.Core let inline decimal (value: ^T) = ExplicitDynamic<(^T), decimal> value when ^T : string = (Decimal.Parse(castToString value,NumberStyles.Float,CultureInfo.InvariantCulture)) - when ^T : float = (Convert.ToDecimal((# "" value : float #))) - when ^T : float32 = (Convert.ToDecimal((# "" value : float32 #))) - when ^T : int64 = (Convert.ToDecimal((# "" value : int64 #))) - when ^T : int32 = (Convert.ToDecimal((# "" value : int32 #))) - when ^T : int16 = (Convert.ToDecimal((# "" value : int16 #))) - when ^T : nativeint = (Convert.ToDecimal(int64 (# "" value : nativeint #))) - when ^T : sbyte = (Convert.ToDecimal((# "" value : sbyte #))) - when ^T : uint64 = (Convert.ToDecimal((# "" value : uint64 #))) - when ^T : uint32 = (Convert.ToDecimal((# "" value : uint32 #))) - when ^T : uint16 = (Convert.ToDecimal((# "" value : uint16 #))) - when ^T : unativeint = (Convert.ToDecimal(uint64 (# "" value : unativeint #))) - when ^T : byte = (Convert.ToDecimal((# "" value : byte #))) + when ^T : float = (Convert.ToDecimal((# "" value : float #))) + when ^T : float32 = (Convert.ToDecimal((# "" value : float32 #))) + when ^T : int64 = (Convert.ToDecimal((# "" value : int64 #))) + when ^T : int32 = (Convert.ToDecimal((# "" value : int32 #))) + when ^T : int16 = (Convert.ToDecimal((# "" value : int16 #))) + when ^T : nativeint = (Convert.ToDecimal(int64 (# "" value : nativeint #))) + when ^T : sbyte = (Convert.ToDecimal((# "" value : sbyte #))) + when ^T : uint64 = (Convert.ToDecimal((# "" value : uint64 #))) + when ^T : uint32 = (Convert.ToDecimal((# "" value : uint32 #))) + when ^T : uint16 = (Convert.ToDecimal((# "" value : uint16 #))) + when ^T : unativeint = (Convert.ToDecimal(uint64 (# "" value : unativeint #))) + when ^T : byte = (Convert.ToDecimal((# "" value : byte #))) + when ^T : char = (Convert.ToDecimal((# "" value : uint16 #))) // Don't use the char overload which unconditionally raises an exception when ^T : decimal = (# "" value : decimal #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> decimal) (value)) @@ -4553,7 +4812,8 @@ namespace Microsoft.FSharp.Core when ^T : uint16 = (# "conv.u" value : unativeint #) when ^T : char = (# "conv.u" value : unativeint #) when ^T : unativeint = (# "" value : unativeint #) - when ^T : byte = (# "conv.u" value : unativeint #) + when ^T : byte = (# "conv.u" value : unativeint #) + when ^T : decimal = (# "conv.u" (uint64 (# "" value : decimal #)) : unativeint #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> unativeint) (value)) [] @@ -4566,7 +4826,7 @@ namespace Microsoft.FSharp.Core when ^T : int64 = (# "conv.i" value : nativeint #) when ^T : int32 = (# "conv.i" value : nativeint #) when ^T : int16 = (# "conv.i" value : nativeint #) - when ^T : nativeint = (# "conv.i" value : nativeint #) + when ^T : nativeint = (# "" value : nativeint #) when ^T : sbyte = (# "conv.i" value : nativeint #) // Narrower unsigned types we zero-extend. // Same length unsigned types we leave as such (so unsigned MaxValue (all-bits-set) gets reinterpreted as -1). @@ -4578,6 +4838,7 @@ namespace Microsoft.FSharp.Core when ^T : char = (# "conv.u" value : nativeint #) when ^T : unativeint = (# "" value : nativeint #) when ^T : byte = (# "conv.i" value : nativeint #) + when ^T : decimal = (# "conv.i" (int64 (# "" value : decimal #)) : unativeint #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> nativeint) (value)) [] @@ -4651,8 +4912,8 @@ namespace Microsoft.FSharp.Core when ^T : sbyte = (# "conv.u2" value : char #) when ^T : uint64 = (# "conv.u2" value : char #) when ^T : uint32 = (# "conv.u2" value : char #) - when ^T : uint16 = (# "conv.u2" value : char #) - when ^T : char = (# "conv.u2" value : char #) + when ^T : uint16 = (# "" value : char #) + when ^T : char = (# "" value : char #) when ^T : unativeint = (# "conv.u2" value : char #) when ^T : byte = (# "conv.u2" value : char #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> char) (value)) @@ -4980,11 +5241,12 @@ namespace Microsoft.FSharp.Core when ^T : uint32 and ^U : uint32 = (# "sub.ovf.un" x y : uint32 #) when ^T : nativeint and ^U : nativeint = (# "sub.ovf" x y : nativeint #) when ^T : unativeint and ^U : unativeint = (# "sub.ovf.un" x y : unativeint #) - when ^T : int16 and ^U : int16 = (# "conv.ovf.i2" (# "sub.ovf" x y : int32 #) : int16 #) - when ^T : uint16 and ^U : uint16 = (# "conv.ovf.u2.un" (# "sub.ovf.un" x y : uint32 #) : uint16 #) - when ^T : sbyte and ^U : sbyte = (# "conv.ovf.i1" (# "sub.ovf" x y : int32 #) : sbyte #) - when ^T : byte and ^U : byte = (# "conv.ovf.u1.un" (# "sub.ovf.un" x y : uint32 #) : byte #) - when ^T : decimal and ^U : decimal = (# "" (Decimal.op_Subtraction((# "" x : decimal #),(# "" y : decimal #))) : ^V #) + when ^T : int16 and ^U : int16 = (# "conv.ovf.i2" (# "sub.ovf" x y : int32 #) : int16 #) + when ^T : uint16 and ^U : uint16 = (# "conv.ovf.u2.un" (# "sub.ovf.un" x y : uint32 #) : uint16 #) + when ^T : char and ^U : char = (# "conv.ovf.u2.un" (# "sub.ovf.un" x y : uint32 #) : char #) + when ^T : sbyte and ^U : sbyte = (# "conv.ovf.i1" (# "sub.ovf" x y : int32 #) : sbyte #) + when ^T : byte and ^U : byte = (# "conv.ovf.u1.un" (# "sub.ovf.un" x y : uint32 #) : byte #) + when ^T : decimal and ^U : decimal = (# "" (Decimal.op_Subtraction((# "" x : decimal #),(# "" y : decimal #))) : ^V #) when ^T : ^T = ((^T or ^U): (static member (-) : ^T * ^U -> ^V) (x,y)) [] @@ -5023,47 +5285,47 @@ namespace Microsoft.FSharp.Core [] [] let inline byte (value: ^T) = - ExplicitDynamic<(^T),byte> value - when ^T : string = ParseByte (castToString value) - when ^T : float = (# "conv.ovf.u1" value : byte #) - when ^T : float32 = (# "conv.ovf.u1" value : byte #) - when ^T : int64 = (# "conv.ovf.u1" value : byte #) - when ^T : int32 = (# "conv.ovf.u1" value : byte #) - when ^T : int16 = (# "conv.ovf.u1" value : byte #) - when ^T : nativeint = (# "conv.ovf.u1" value : byte #) - when ^T : sbyte = (# "conv.ovf.u1" value : byte #) - when ^T : uint64 = (# "conv.ovf.u1.un" value : byte #) - when ^T : uint32 = (# "conv.ovf.u1.un" value : byte #) - when ^T : uint16 = (# "conv.ovf.u1.un" value : byte #) - when ^T : char = (# "conv.ovf.u1.un" value : byte #) + CheckedExplicitDynamic<(^T),byte> value + when ^T : string = ParseByte (castToString value) + when ^T : float = (# "conv.ovf.u1" value : byte #) + when ^T : float32 = (# "conv.ovf.u1" value : byte #) + when ^T : int64 = (# "conv.ovf.u1" value : byte #) + when ^T : int32 = (# "conv.ovf.u1" value : byte #) + when ^T : int16 = (# "conv.ovf.u1" value : byte #) + when ^T : nativeint = (# "conv.ovf.u1" value : byte #) + when ^T : sbyte = (# "conv.ovf.u1" value : byte #) + when ^T : uint64 = (# "conv.ovf.u1.un" value : byte #) + when ^T : uint32 = (# "conv.ovf.u1.un" value : byte #) + when ^T : uint16 = (# "conv.ovf.u1.un" value : byte #) + when ^T : char = (# "conv.ovf.u1.un" value : byte #) when ^T : unativeint = (# "conv.ovf.u1.un" value : byte #) - when ^T : byte = (# "conv.ovf.u1.un" value : byte #) + when ^T : byte = (# "" value : byte #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> byte) (value)) [] [] let inline sbyte (value: ^T) = - ExplicitDynamic<(^T),sbyte> value - when ^T : string = ParseSByte (castToString value) - when ^T : float = (# "conv.ovf.i1" value : sbyte #) - when ^T : float32 = (# "conv.ovf.i1" value : sbyte #) - when ^T : int64 = (# "conv.ovf.i1" value : sbyte #) - when ^T : int32 = (# "conv.ovf.i1" value : sbyte #) - when ^T : int16 = (# "conv.ovf.i1" value : sbyte #) - when ^T : nativeint = (# "conv.ovf.i1" value : sbyte #) - when ^T : sbyte = (# "conv.ovf.i1" value : sbyte #) - when ^T : uint64 = (# "conv.ovf.i1.un" value : sbyte #) - when ^T : uint32 = (# "conv.ovf.i1.un" value : sbyte #) - when ^T : uint16 = (# "conv.ovf.i1.un" value : sbyte #) - when ^T : char = (# "conv.ovf.i1.un" value : sbyte #) + CheckedExplicitDynamic<(^T),sbyte> value + when ^T : string = ParseSByte (castToString value) + when ^T : float = (# "conv.ovf.i1" value : sbyte #) + when ^T : float32 = (# "conv.ovf.i1" value : sbyte #) + when ^T : int64 = (# "conv.ovf.i1" value : sbyte #) + when ^T : int32 = (# "conv.ovf.i1" value : sbyte #) + when ^T : int16 = (# "conv.ovf.i1" value : sbyte #) + when ^T : nativeint = (# "conv.ovf.i1" value : sbyte #) + when ^T : sbyte = (# "" value : sbyte #) + when ^T : uint64 = (# "conv.ovf.i1.un" value : sbyte #) + when ^T : uint32 = (# "conv.ovf.i1.un" value : sbyte #) + when ^T : uint16 = (# "conv.ovf.i1.un" value : sbyte #) + when ^T : char = (# "conv.ovf.i1.un" value : sbyte #) when ^T : unativeint = (# "conv.ovf.i1.un" value : sbyte #) - when ^T : byte = (# "conv.ovf.i1.un" value : sbyte #) + when ^T : byte = (# "conv.ovf.i1.un" value : sbyte #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> sbyte) (value)) [] [] let inline uint16 (value: ^T) = - ExplicitDynamic<(^T),uint16> value + CheckedExplicitDynamic<(^T),uint16> value when ^T : string = ParseUInt16 (castToString value) when ^T : float = (# "conv.ovf.u2" value : uint16 #) when ^T : float32 = (# "conv.ovf.u2" value : uint16 #) @@ -5074,8 +5336,8 @@ namespace Microsoft.FSharp.Core when ^T : sbyte = (# "conv.ovf.u2" value : uint16 #) when ^T : uint64 = (# "conv.ovf.u2.un" value : uint16 #) when ^T : uint32 = (# "conv.ovf.u2.un" value : uint16 #) - when ^T : uint16 = (# "conv.ovf.u2.un" value : uint16 #) - when ^T : char = (# "conv.ovf.u2.un" value : uint16 #) + when ^T : uint16 = (# "" value : uint16 #) + when ^T : char = (# "" value : uint16 #) when ^T : unativeint = (# "conv.ovf.u2.un" value : uint16 #) when ^T : byte = (# "conv.ovf.u2.un" value : uint16 #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> uint16) (value)) @@ -5083,7 +5345,7 @@ namespace Microsoft.FSharp.Core [] [] let inline char (value: ^T) = - ExplicitDynamic<(^T), char> value + CheckedExplicitDynamic<(^T), char> value when ^T : string = (Char.Parse(castToString value)) when ^T : float = (# "conv.ovf.u2" value : char #) when ^T : float32 = (# "conv.ovf.u2" value : char #) @@ -5094,8 +5356,8 @@ namespace Microsoft.FSharp.Core when ^T : sbyte = (# "conv.ovf.u2" value : char #) when ^T : uint64 = (# "conv.ovf.u2.un" value : char #) when ^T : uint32 = (# "conv.ovf.u2.un" value : char #) - when ^T : uint16 = (# "conv.ovf.u2.un" value : char #) - when ^T : char = (# "conv.ovf.u2.un" value : char #) + when ^T : uint16 = (# "" value : char #) + when ^T : char = (# "" value : char #) when ^T : unativeint = (# "conv.ovf.u2.un" value : char #) when ^T : byte = (# "conv.ovf.u2.un" value : char #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> char) (value)) @@ -5103,61 +5365,61 @@ namespace Microsoft.FSharp.Core [] [] let inline int16 (value: ^T) = - ExplicitDynamic<(^T), int16> value - when ^T : string = ParseInt16 (castToString value) - when ^T : float = (# "conv.ovf.i2" value : int16 #) - when ^T : float32 = (# "conv.ovf.i2" value : int16 #) - when ^T : int64 = (# "conv.ovf.i2" value : int16 #) - when ^T : int32 = (# "conv.ovf.i2" value : int16 #) - when ^T : int16 = (# "conv.ovf.i2" value : int16 #) - when ^T : nativeint = (# "conv.ovf.i2" value : int16 #) - when ^T : sbyte = (# "conv.ovf.i2" value : int16 #) - when ^T : uint64 = (# "conv.ovf.i2.un" value : int16 #) - when ^T : uint32 = (# "conv.ovf.i2.un" value : int16 #) - when ^T : uint16 = (# "conv.ovf.i2.un" value : int16 #) - when ^T : char = (# "conv.ovf.i2.un" value : int16 #) + CheckedExplicitDynamic<(^T), int16> value + when ^T : string = ParseInt16 (castToString value) + when ^T : float = (# "conv.ovf.i2" value : int16 #) + when ^T : float32 = (# "conv.ovf.i2" value : int16 #) + when ^T : int64 = (# "conv.ovf.i2" value : int16 #) + when ^T : int32 = (# "conv.ovf.i2" value : int16 #) + when ^T : int16 = (# "" value : int16 #) + when ^T : nativeint = (# "conv.ovf.i2" value : int16 #) + when ^T : sbyte = (# "conv.ovf.i2" value : int16 #) + when ^T : uint64 = (# "conv.ovf.i2.un" value : int16 #) + when ^T : uint32 = (# "conv.ovf.i2.un" value : int16 #) + when ^T : uint16 = (# "conv.ovf.i2.un" value : int16 #) + when ^T : char = (# "conv.ovf.i2.un" value : int16 #) when ^T : unativeint = (# "conv.ovf.i2.un" value : int16 #) - when ^T : byte = (# "conv.ovf.i2.un" value : int16 #) + when ^T : byte = (# "conv.ovf.i2.un" value : int16 #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> int16) (value)) [] [] let inline uint32 (value: ^T) = - ExplicitDynamic<(^T), uint32> value - when ^T : string = ParseUInt32 (castToString value) - when ^T : float = (# "conv.ovf.u4" value : uint32 #) - when ^T : float32 = (# "conv.ovf.u4" value : uint32 #) - when ^T : int64 = (# "conv.ovf.u4" value : uint32 #) - when ^T : int32 = (# "conv.ovf.u4" value : uint32 #) - when ^T : int16 = (# "conv.ovf.u4" value : uint32 #) - when ^T : nativeint = (# "conv.ovf.u4" value : uint32 #) - when ^T : sbyte = (# "conv.ovf.u4" value : uint32 #) - when ^T : uint64 = (# "conv.ovf.u4.un" value : uint32 #) - when ^T : uint32 = (# "conv.ovf.u4.un" value : uint32 #) - when ^T : uint16 = (# "conv.ovf.u4.un" value : uint32 #) - when ^T : char = (# "conv.ovf.u4.un" value : uint32 #) + CheckedExplicitDynamic<(^T), uint32> value + when ^T : string = ParseUInt32 (castToString value) + when ^T : float = (# "conv.ovf.u4" value : uint32 #) + when ^T : float32 = (# "conv.ovf.u4" value : uint32 #) + when ^T : int64 = (# "conv.ovf.u4" value : uint32 #) + when ^T : int32 = (# "conv.ovf.u4" value : uint32 #) + when ^T : int16 = (# "conv.ovf.u4" value : uint32 #) + when ^T : nativeint = (# "conv.ovf.u4" value : uint32 #) + when ^T : sbyte = (# "conv.ovf.u4" value : uint32 #) + when ^T : uint64 = (# "conv.ovf.u4.un" value : uint32 #) + when ^T : uint32 = (# "" value : uint32 #) + when ^T : uint16 = (# "conv.ovf.u4.un" value : uint32 #) + when ^T : char = (# "conv.ovf.u4.un" value : uint32 #) when ^T : unativeint = (# "conv.ovf.u4.un" value : uint32 #) - when ^T : byte = (# "conv.ovf.u4.un" value : uint32 #) + when ^T : byte = (# "conv.ovf.u4.un" value : uint32 #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> uint32) (value)) [] [] let inline int32 (value: ^T) = - ExplicitDynamic<(^T), int32> value - when ^T : string = ParseInt32 (castToString value) - when ^T : float = (# "conv.ovf.i4" value : int32 #) - when ^T : float32 = (# "conv.ovf.i4" value : int32 #) - when ^T : int64 = (# "conv.ovf.i4" value : int32 #) - when ^T : int32 = (# "conv.ovf.i4" value : int32 #) - when ^T : int16 = (# "conv.ovf.i4" value : int32 #) - when ^T : nativeint = (# "conv.ovf.i4" value : int32 #) - when ^T : sbyte = (# "conv.ovf.i4" value : int32 #) - when ^T : uint64 = (# "conv.ovf.i4.un" value : int32 #) - when ^T : uint32 = (# "conv.ovf.i4.un" value : int32 #) - when ^T : uint16 = (# "conv.ovf.i4.un" value : int32 #) - when ^T : char = (# "conv.ovf.i4.un" value : int32 #) + CheckedExplicitDynamic<(^T), int32> value + when ^T : string = ParseInt32 (castToString value) + when ^T : float = (# "conv.ovf.i4" value : int32 #) + when ^T : float32 = (# "conv.ovf.i4" value : int32 #) + when ^T : int64 = (# "conv.ovf.i4" value : int32 #) + when ^T : int32 = (# "" value : int32 #) + when ^T : int16 = (# "conv.ovf.i4" value : int32 #) + when ^T : nativeint = (# "conv.ovf.i4" value : int32 #) + when ^T : sbyte = (# "conv.ovf.i4" value : int32 #) + when ^T : uint64 = (# "conv.ovf.i4.un" value : int32 #) + when ^T : uint32 = (# "conv.ovf.i4.un" value : int32 #) + when ^T : uint16 = (# "conv.ovf.i4.un" value : int32 #) + when ^T : char = (# "conv.ovf.i4.un" value : int32 #) when ^T : unativeint = (# "conv.ovf.i4.un" value : int32 #) - when ^T : byte = (# "conv.ovf.i4.un" value : int32 #) + when ^T : byte = (# "conv.ovf.i4.un" value : int32 #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> int32) (value)) [] @@ -5166,81 +5428,83 @@ namespace Microsoft.FSharp.Core [] [] let inline uint64 (value: ^T) = - ExplicitDynamic<(^T), uint64> value - when ^T : string = ParseUInt64 (castToString value) - when ^T : float = (# "conv.ovf.u8" value : uint64 #) - when ^T : float32 = (# "conv.ovf.u8" value : uint64 #) - when ^T : int64 = (# "conv.ovf.u8" value : uint64 #) - when ^T : int32 = (# "conv.ovf.u8" value : uint64 #) - when ^T : int16 = (# "conv.ovf.u8" value : uint64 #) - when ^T : nativeint = (# "conv.ovf.u8" value : uint64 #) - when ^T : sbyte = (# "conv.ovf.u8" value : uint64 #) - when ^T : uint64 = (# "conv.ovf.u8.un" value : uint64 #) - when ^T : uint32 = (# "conv.ovf.u8.un" value : uint64 #) - when ^T : uint16 = (# "conv.ovf.u8.un" value : uint64 #) - when ^T : char = (# "conv.ovf.u8.un" value : uint64 #) + CheckedExplicitDynamic<(^T), uint64> value + when ^T : string = ParseUInt64 (castToString value) + when ^T : float = (# "conv.ovf.u8" value : uint64 #) + when ^T : float32 = (# "conv.ovf.u8" value : uint64 #) + when ^T : int64 = (# "conv.ovf.u8" value : uint64 #) + when ^T : int32 = (# "conv.ovf.u8" value : uint64 #) + when ^T : int16 = (# "conv.ovf.u8" value : uint64 #) + when ^T : nativeint = (# "conv.ovf.u8" value : uint64 #) + when ^T : sbyte = (# "conv.ovf.u8" value : uint64 #) + when ^T : uint64 = (# "" value : uint64 #) + when ^T : uint32 = (# "conv.ovf.u8.un" value : uint64 #) + when ^T : uint16 = (# "conv.ovf.u8.un" value : uint64 #) + when ^T : char = (# "conv.ovf.u8.un" value : uint64 #) when ^T : unativeint = (# "conv.ovf.u8.un" value : uint64 #) - when ^T : byte = (# "conv.ovf.u8.un" value : uint64 #) + when ^T : byte = (# "conv.ovf.u8.un" value : uint64 #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> uint64) (value)) [] [] let inline int64 (value: ^T) = - ExplicitDynamic<(^T), int64> value - when ^T : string = ParseInt64 (castToString value) - when ^T : float = (# "conv.ovf.i8" value : int64 #) - when ^T : float32 = (# "conv.ovf.i8" value : int64 #) - when ^T : int64 = (# "conv.ovf.i8" value : int64 #) - when ^T : int32 = (# "conv.ovf.i8" value : int64 #) - when ^T : int16 = (# "conv.ovf.i8" value : int64 #) - when ^T : nativeint = (# "conv.ovf.i8" value : int64 #) - when ^T : sbyte = (# "conv.ovf.i8" value : int64 #) - when ^T : uint64 = (# "conv.ovf.i8.un" value : int64 #) - when ^T : uint32 = (# "conv.ovf.i8.un" value : int64 #) - when ^T : uint16 = (# "conv.ovf.i8.un" value : int64 #) - when ^T : char = (# "conv.ovf.i8.un" value : int64 #) + CheckedExplicitDynamic<(^T), int64> value + when ^T : string = ParseInt64 (castToString value) + when ^T : float = (# "conv.ovf.i8" value : int64 #) + when ^T : float32 = (# "conv.ovf.i8" value : int64 #) + when ^T : int64 = (# "" value : int64 #) + when ^T : int32 = (# "conv.ovf.i8" value : int64 #) + when ^T : int16 = (# "conv.ovf.i8" value : int64 #) + when ^T : nativeint = (# "conv.ovf.i8" value : int64 #) + when ^T : sbyte = (# "conv.ovf.i8" value : int64 #) + when ^T : uint64 = (# "conv.ovf.i8.un" value : int64 #) + when ^T : uint32 = (# "conv.ovf.i8.un" value : int64 #) + when ^T : uint16 = (# "conv.ovf.i8.un" value : int64 #) + when ^T : char = (# "conv.ovf.i8.un" value : int64 #) when ^T : unativeint = (# "conv.ovf.i8.un" value : int64 #) - when ^T : byte = (# "conv.ovf.i8.un" value : int64 #) + when ^T : byte = (# "conv.ovf.i8.un" value : int64 #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> int64) (value)) [] [] let inline unativeint (value: ^T) = - ExplicitDynamic<(^T), unativeint> value - when ^T : string = ParseUIntPtr (castToString value) - when ^T : float = (# "conv.ovf.u" value : unativeint #) - when ^T : float32 = (# "conv.ovf.u" value : unativeint #) - when ^T : int64 = (# "conv.ovf.u" value : unativeint #) - when ^T : int32 = (# "conv.ovf.u" value : unativeint #) - when ^T : int16 = (# "conv.ovf.u" value : unativeint #) - when ^T : nativeint = (# "conv.ovf.u" value : unativeint #) - when ^T : sbyte = (# "conv.ovf.u" value : unativeint #) - when ^T : uint64 = (# "conv.ovf.u.un" value : unativeint #) - when ^T : uint32 = (# "conv.ovf.u.un" value : unativeint #) - when ^T : uint16 = (# "conv.ovf.u.un" value : unativeint #) - when ^T : char = (# "conv.ovf.u.un" value : unativeint #) - when ^T : unativeint = (# "conv.ovf.u.un" value : unativeint #) - when ^T : byte = (# "conv.ovf.u.un" value : unativeint #) + CheckedExplicitDynamic<(^T), unativeint> value + when ^T : string = ParseUIntPtr (castToString value) + when ^T : float = (# "conv.ovf.u" value : unativeint #) + when ^T : float32 = (# "conv.ovf.u" value : unativeint #) + when ^T : int64 = (# "conv.ovf.u" value : unativeint #) + when ^T : int32 = (# "conv.ovf.u" value : unativeint #) + when ^T : int16 = (# "conv.ovf.u" value : unativeint #) + when ^T : nativeint = (# "conv.ovf.u" value : unativeint #) + when ^T : sbyte = (# "conv.ovf.u" value : unativeint #) + when ^T : uint64 = (# "conv.ovf.u.un" value : unativeint #) + when ^T : uint32 = (# "conv.ovf.u.un" value : unativeint #) + when ^T : uint16 = (# "conv.ovf.u.un" value : unativeint #) + when ^T : char = (# "conv.ovf.u.un" value : unativeint #) + when ^T : unativeint = (# "" value : unativeint #) + when ^T : byte = (# "conv.ovf.u.un" value : unativeint #) + when ^T : decimal = (# "conv.ovf.u.un" (uint64 (# "" value : decimal #)) : unativeint #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> unativeint) (value)) [] [] let inline nativeint (value: ^T) = - ExplicitDynamic<(^T), nativeint> value - when ^T : string = ParseIntPtr (castToString value) - when ^T : float = (# "conv.ovf.i" value : nativeint #) - when ^T : float32 = (# "conv.ovf.i" value : nativeint #) - when ^T : int64 = (# "conv.ovf.i" value : nativeint #) - when ^T : int32 = (# "conv.ovf.i" value : nativeint #) - when ^T : int16 = (# "conv.ovf.i" value : nativeint #) - when ^T : nativeint = (# "conv.ovf.i" value : nativeint #) - when ^T : sbyte = (# "conv.ovf.i" value : nativeint #) - when ^T : uint64 = (# "conv.ovf.i.un" value : nativeint #) - when ^T : uint32 = (# "conv.ovf.i.un" value : nativeint #) - when ^T : uint16 = (# "conv.ovf.i.un" value : nativeint #) - when ^T : char = (# "conv.ovf.i.un" value : nativeint #) + CheckedExplicitDynamic<(^T), nativeint> value + when ^T : string = ParseIntPtr (castToString value) + when ^T : float = (# "conv.ovf.i" value : nativeint #) + when ^T : float32 = (# "conv.ovf.i" value : nativeint #) + when ^T : int64 = (# "conv.ovf.i" value : nativeint #) + when ^T : int32 = (# "conv.ovf.i" value : nativeint #) + when ^T : int16 = (# "conv.ovf.i" value : nativeint #) + when ^T : nativeint = (# "" value : nativeint #) + when ^T : sbyte = (# "conv.ovf.i" value : nativeint #) + when ^T : uint64 = (# "conv.ovf.i.un" value : nativeint #) + when ^T : uint32 = (# "conv.ovf.i.un" value : nativeint #) + when ^T : uint16 = (# "conv.ovf.i.un" value : nativeint #) + when ^T : char = (# "conv.ovf.i.un" value : nativeint #) when ^T : unativeint = (# "conv.ovf.i.un" value : nativeint #) - when ^T : byte = (# "conv.ovf.i.un" value : nativeint #) + when ^T : byte = (# "conv.ovf.i.un" value : nativeint #) + when ^T : decimal = (# "conv.ovf.i" (int64 (# "" value : decimal #)) : nativeint #) when ^T : ^T = (^T : (static member op_Explicit: ^T -> nativeint) (value)) module OperatorIntrinsics = diff --git a/src/FSharp.Core/prim-types.fsi b/src/FSharp.Core/prim-types.fsi index 70ee63e0c2d..a2c03fa1025 100644 --- a/src/FSharp.Core/prim-types.fsi +++ b/src/FSharp.Core/prim-types.fsi @@ -1542,6 +1542,10 @@ namespace Microsoft.FSharp.Core [] val ExplicitDynamic: value: 'T -> 'U + /// A compiler intrinsic that implements dynamic invocations related to checked conversion operators. + [] + val CheckedExplicitDynamic : value:'T -> 'U + /// A compiler intrinsic that implements dynamic invocations related to the '<' operator. [] val LessThanDynamic: x: 'T1 -> y: 'T2 -> 'U diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj b/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj index 42a431f2c27..9c0017aaed1 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj +++ b/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj @@ -42,6 +42,7 @@ + diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule1.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule1.fs index 62db48e2ec9..a7672d9925f 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule1.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule1.fs @@ -246,10 +246,10 @@ type OperatorsModule1() = Assert.AreEqual(1, intbox) // string value - let stringlbox = Operators.box "string" - Assert.AreEqual("string", stringlbox) + let stringbox = Operators.box "string" + Assert.AreEqual("string", stringbox) - // null value + // null value let nullbox = Operators.box null CheckThrowsNullRefException(fun () -> nullbox.ToString() |> ignore) @@ -275,6 +275,14 @@ type OperatorsModule1() = let result = Operators.byte Int64.MinValue Assert.AreEqual(0uy, result) + // Overflow + let result = Operators.byte Single.MinValue + Assert.AreEqual(0uy, result) + + // Overflow + let result = Operators.byte Single.MaxValue + Assert.AreEqual(0uy, result) + // Overflow let result = Operators.byte Double.MinValue Assert.AreEqual(0uy, result) @@ -292,7 +300,7 @@ type OperatorsModule1() = Assert.AreEqual(4uy, result) // OverflowException, from decimal is always checked - CheckThrowsOverflowException(fun() -> Operators.byte Decimal.MinValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.byte Decimal.MinValue |> ignore) [] member _.ceil() = @@ -301,18 +309,44 @@ type OperatorsModule1() = Assert.AreEqual(1.0, minceil) // normal value - let normalceil = Operators.ceil 100.0 - Assert.AreEqual(100.0, normalceil) + let normalceil = Operators.ceil 100.1 + Assert.AreEqual(101.0, normalceil) // max value let maxceil = Operators.ceil 1.7E+308 Assert.AreEqual(1.7E+308, maxceil) + // float32 value + let float32ceil = Operators.ceil 100.1f + Assert.AreEqual(101f, float32ceil) + + // decimal value + let decimalceil = Operators.ceil 100.1m + Assert.AreEqual(101m, decimalceil) + [] member _.char() = // int type - let intchar = Operators.char 48 - Assert.AreEqual('0', intchar) + Assert.AreEqual('0', Operators.char 48) + Assert.AreEqual('0', Operators.char 48u) + Assert.AreEqual('0', Operators.char 48s) + Assert.AreEqual('0', Operators.char 48us) + Assert.AreEqual('0', Operators.char 48y) + Assert.AreEqual('0', Operators.char 48uy) + Assert.AreEqual('0', Operators.char 48L) + Assert.AreEqual('0', Operators.char 48uL) + Assert.AreEqual('0', Operators.char 48n) + Assert.AreEqual('0', Operators.char 48un) + Assert.AreEqual('0', Operators.char 48f) + Assert.AreEqual('0', Operators.char 48.) + Assert.AreEqual('0', Operators.char 48m) + + // Overflow + Assert.AreEqual('\000', Operators.char Single.MinValue) + Assert.AreEqual('\000', Operators.char Double.MinValue) + Assert.AreEqual('\000', Operators.char Single.MaxValue) + Assert.AreEqual('\000', Operators.char Double.MaxValue) + CheckThrowsOverflowException(fun () -> Operators.char Decimal.MinValue |> ignore) // string type let stringchar = Operators.char " " @@ -366,12 +400,24 @@ type OperatorsModule1() = member _.decimal () = // int value - let mindecimal = Operators.decimal (1) - Assert.AreEqual(1M, mindecimal) + let intdecimal = Operators.decimal (1) + Assert.AreEqual(1M, intdecimal) + + // nativeint value + let nativeintdecimal = Operators.decimal 1n + Assert.AreEqual(1M, nativeintdecimal) + + // unativeint value + let unativeintdecimal = Operators.decimal 1un + Assert.AreEqual(1M, unativeintdecimal) + + // char value + let chardecimal = Operators.decimal '\001' + Assert.AreEqual(1M, chardecimal) - // float value - let maxdecimal = Operators.decimal (1.0) - Assert.AreEqual(1M, maxdecimal) + // float value + let floatdecimal = Operators.decimal (1.0) + Assert.AreEqual(1M, floatdecimal) [] member _.decr() = @@ -416,6 +462,10 @@ type OperatorsModule1() = // char type let chardouble = Operators.float '0' Assert.AreEqual(48.0, chardouble) + + // decimal type + let decimaldouble = Operators.float 100m + Assert.AreEqual(100.0, decimaldouble) [] member _.enum() = @@ -424,7 +474,7 @@ type OperatorsModule1() = let intenum = Operators.enum intarg Assert.AreEqual(System.ConsoleColor.Black, intenum) - // big number + // big number let bigarg : int32 = 15 let charenum = Operators.enum bigarg Assert.AreEqual(System.ConsoleColor.White, charenum) @@ -488,6 +538,10 @@ type OperatorsModule1() = let charfloat = Operators.float '0' Assert.AreEqual((float)48, charfloat) + // decimal type + let intfloat = Operators.float 100m + Assert.AreEqual((float)100, intfloat) + [] member _.float32() = // int type @@ -497,16 +551,24 @@ type OperatorsModule1() = // char type let charfloat32 = Operators.float32 '0' Assert.AreEqual((float32)48, charfloat32) + + // decimal type + let intfloat32 = Operators.float32 100m + Assert.AreEqual((float32)100, intfloat32) [] member _.floor() = // float type - let intfloor = Operators.floor 100.9 - Assert.AreEqual(100.0, intfloor) + let floatfloor = Operators.floor 100.9 + Assert.AreEqual(100.0, floatfloor) // float32 type - let charfloor = Operators.floor ((float32)100.9) - Assert.AreEqual(100.0f, charfloor) + let float32floor = Operators.floor 100.9f + Assert.AreEqual(100.0f, float32floor) + + // decimal type + let decimalfloor = Operators.floor 100.9m + Assert.AreEqual(100m, decimalfloor) [] member _.fst() = diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule2.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule2.fs index 3abdeee4121..d4197529ea6 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule2.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule2.fs @@ -51,6 +51,14 @@ type OperatorsModule2() = let result = Operators.int 0 Assert.AreEqual(0, result) + // Overflow. + let result = Operators.int Single.MaxValue + Assert.AreEqual(Int32.MinValue, result) + + // Overflow + let result = Operators.int Single.MinValue + Assert.AreEqual(Int32.MinValue, result) + // Overflow let result = Operators.int Double.MaxValue Assert.AreEqual(Int32.MinValue, result) @@ -72,7 +80,7 @@ type OperatorsModule2() = Assert.AreEqual(Int32.MinValue, result) // OverflowException, from decimal is always checked - CheckThrowsOverflowException(fun() -> Operators.int Decimal.MinValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.int Decimal.MinValue |> ignore) [] member _.int16() = @@ -96,6 +104,14 @@ type OperatorsModule2() = let result = Operators.int16 "10" Assert.AreEqual(10s, result) + // Overflow. + let result = Operators.int16 Single.MaxValue + Assert.AreEqual(0s, result) + + // Overflow + let result = Operators.int16 Single.MinValue + Assert.AreEqual(0s, result) + // Overflow let result = Operators.int16 Double.MaxValue Assert.AreEqual(0s, result) @@ -116,7 +132,7 @@ type OperatorsModule2() = Assert.AreEqual(Int16.MinValue, result) // OverflowException, from decimal is always checked - CheckThrowsOverflowException(fun() -> Operators.int16 Decimal.MinValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.int16 Decimal.MinValue |> ignore) [] member _.int32() = @@ -140,6 +156,14 @@ type OperatorsModule2() = let result = Operators.int32 "10" Assert.AreEqual(10, result) + // Overflow. + let result = Operators.int32 Single.MaxValue + Assert.AreEqual(Int32.MinValue, result) + + // Overflow + let result = Operators.int32 Single.MinValue + Assert.AreEqual(Int32.MinValue, result) + // Overflow let result = Operators.int32 Double.MaxValue Assert.AreEqual(Int32.MinValue, result) @@ -161,7 +185,7 @@ type OperatorsModule2() = Assert.AreEqual(Int32.MinValue + 4, result) // OverflowException, from decimal is always checked - CheckThrowsOverflowException(fun() -> Operators.int32 Decimal.MinValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.int32 Decimal.MinValue |> ignore) [] member _.int64() = @@ -185,6 +209,14 @@ type OperatorsModule2() = let result = Operators.int64 "10" Assert.AreEqual(10L, result) + // Overflow. + let result = Operators.int64 Single.MaxValue + Assert.AreEqual(Int64.MinValue, result) + + // Overflow + let result = Operators.int64 Single.MinValue + Assert.AreEqual(Int64.MinValue, result) + // Overflow. let result = Operators.int64 Double.MaxValue Assert.AreEqual(Int64.MinValue, result) @@ -202,11 +234,11 @@ type OperatorsModule2() = Assert.AreEqual(9223372036854775807L, Int64.MaxValue) // OverflowException, from decimal is always checked - CheckThrowsOverflowException(fun() -> Operators.int64 Decimal.MinValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.int64 Decimal.MinValue |> ignore) [] member _.invalidArg() = - CheckThrowsArgumentException(fun() -> Operators.invalidArg "A" "B" |>ignore ) + CheckThrowsArgumentException(fun () -> Operators.invalidArg "A" "B" |>ignore ) [] @@ -328,6 +360,22 @@ type OperatorsModule2() = let result = Operators.nativeint 0 Assert.AreEqual(0n, result) + // Overflow Single.MaxValue is equal on 32 bits and 64 bits runtimes + let result = Operators.nativeint Single.MaxValue + if Info.isX86Runtime then + Assert.AreEqual(-2147483648n, result) + else + // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual(-9223372036854775807n - 1n, result) + + // Overflow (depends on pointer size) + let result = Operators.nativeint Single.MinValue + if Info.isX86Runtime then + Assert.AreEqual(-2147483648n, result) + else + // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual(-9223372036854775807n - 1n, result) + // Overflow Double.MaxValue is equal on 32 bits and 64 bits runtimes let result = Operators.nativeint Double.MaxValue if Info.isX86Runtime then @@ -396,7 +444,7 @@ type OperatorsModule2() = [] member _.nullArg() = - CheckThrowsArgumentNullException(fun() -> Operators.nullArg "A" |> ignore) + CheckThrowsArgumentNullException(fun () -> Operators.nullArg "A" |> ignore) [] @@ -429,11 +477,11 @@ type OperatorsModule2() = let result = Operators.pown System.Double.MaxValue System.Int32.MaxValue Assert.AreEqual(Double.PositiveInfinity, result) - CheckThrowsOverflowException(fun() -> Operators.pown System.Int32.MaxValue System.Int32.MaxValue |>ignore) + CheckThrowsOverflowException(fun () -> Operators.pown System.Int32.MaxValue System.Int32.MaxValue |>ignore) [] member _.raise() = - CheckThrowsArgumentException(fun()-> Operators.raise <| new ArgumentException("Invalid Argument ") |> ignore) + CheckThrowsArgumentException(fun () -> Operators.raise <| new ArgumentException("Invalid Argument ") |> ignore) [] @@ -559,7 +607,7 @@ type OperatorsModule2() = Assert.AreEqual(-128y, result) // OverflowException, from decimal is always checked - CheckThrowsOverflowException(fun() -> Operators.sbyte Decimal.MinValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.sbyte Decimal.MinValue |> ignore) [] member _.sign() = @@ -694,6 +742,10 @@ type OperatorsModule2() = let result = Operators.sizeof Assert.AreEqual(8, result) + // custom struct + let result = Operators.sizeof + Assert.AreEqual(12, result) + // reference type should have the same size as the IntPtr let result = Operators.sizeof Assert.AreEqual(IntPtr.Size, result) @@ -899,9 +951,25 @@ type OperatorsModule2() = // decimal let result = Operators.uint16 100M Assert.AreEqual(100us, result) + + // Overflow + let result = Operators.uint16 Single.MaxValue + Assert.AreEqual(0us, result) + + // Overflow + let result = Operators.uint16 Single.MinValue + Assert.AreEqual(0us, result) + + // Overflow + let result = Operators.uint16 Double.MaxValue + Assert.AreEqual(0us, result) + + // Overflow + let result = Operators.uint16 Double.MinValue + Assert.AreEqual(0us, result) // OverflowException, from decimal is always checked - CheckThrowsOverflowException(fun() -> Operators.uint16 Decimal.MinValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.uint16 Decimal.MinValue |> ignore) [] member _.uint32() = @@ -917,6 +985,14 @@ type OperatorsModule2() = let result = Operators.uint32 100M Assert.AreEqual(100u, result) + // Overflow + let result = Operators.uint32 Single.MaxValue + Assert.AreEqual(0u, result) + + // Overflow + let result = Operators.uint32 Single.MinValue + Assert.AreEqual(0u, result) + // Overflow let result = Operators.uint32 Double.MaxValue Assert.AreEqual(0u, result) @@ -943,7 +1019,7 @@ type OperatorsModule2() = Assert.AreEqual(84ul, result) // OverflowException, from decimal is always checked - CheckThrowsOverflowException(fun() -> Operators.uint32 Decimal.MinValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.uint32 Decimal.MinValue |> ignore) [] member _.uint64() = @@ -959,6 +1035,14 @@ type OperatorsModule2() = let result = Operators.uint64 100M Assert.AreEqual(100UL, result) + // Overflow + let result = Operators.uint64 Single.MaxValue + Assert.AreEqual(0UL, result) + + // Overflow + let result = Operators.uint64 Single.MinValue + Assert.AreEqual(9223372036854775808UL, result) // surprising, but true, 2^63 + 1 + // Overflow let result = Operators.uint64 Double.MaxValue Assert.AreEqual(0UL, result) @@ -980,7 +1064,7 @@ type OperatorsModule2() = Assert.AreEqual(4UL, result) // OverflowException, from decimal is always checked - CheckThrowsOverflowException(fun() -> Operators.uint64 Decimal.MinValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.uint64 Decimal.MinValue |> ignore) [] member _.unativeint() = @@ -993,6 +1077,17 @@ type OperatorsModule2() = let result = Operators.unativeint 100.0 Assert.AreEqual(100un, result) + // Overflow Single.MaxValue is equal on 32 bits and 64 bits runtimes + let result = Operators.unativeint Single.MaxValue + Assert.AreEqual(0un, result) + + // Overflow (depends on pointer size) + let result = Operators.unativeint Single.MinValue + if Info.isX86Runtime then + Assert.AreEqual(0un, result) + else + Assert.AreEqual(9223372036854775808un, result) // surprising, but true, 2^63 + 1 + // Overflow Double.MaxValue is equal on 32 bits and 64 bits runtimes let result = Operators.unativeint Double.MaxValue Assert.AreEqual(0un, result) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleChecked.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleChecked.fs index bcd16f54e27..54da228aca6 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleChecked.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleChecked.fs @@ -21,12 +21,14 @@ type OperatorsModuleChecked() = let charByte = Operators.Checked.byte '0' Assert.AreEqual(48uy, charByte) - // boundary value + // boundary value let boundByte = Operators.Checked.byte 255.0 Assert.AreEqual(255uy, boundByte) // overflow exception CheckThrowsOverflowException(fun () -> Operators.Checked.byte 256 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.byte 256f |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.byte 256. |> ignore) // overflow exception CheckThrowsOverflowException(fun () -> 255uy + 1uy |> ignore) @@ -51,6 +53,8 @@ type OperatorsModuleChecked() = // overflow exception CheckThrowsOverflowException(fun () -> Operators.Checked.char (int64 Char.MaxValue + 1L) |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.char Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.char Double.MaxValue |> ignore) // overflow exception CheckThrowsOverflowException(fun () -> '\uFFFF' + '\u0001' |> ignore) @@ -72,7 +76,9 @@ type OperatorsModuleChecked() = Assert.AreEqual(32767, boundInt) // overflow exception - CheckThrowsOverflowException(fun() -> Operators.Checked.int 2147483648.0 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int 2147483648.0 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int Double.MaxValue |> ignore) // overflow exception CheckThrowsOverflowException(fun () -> Int32.MaxValue + 1 |> ignore) @@ -97,6 +103,8 @@ type OperatorsModuleChecked() = // overflow exception CheckThrowsOverflowException(fun () -> Operators.Checked.int16 32768.0 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int16 Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int16 Double.MaxValue |> ignore) // overflow exception CheckThrowsOverflowException(fun () -> Int16.MaxValue + 1s |> ignore) @@ -121,6 +129,8 @@ type OperatorsModuleChecked() = // overflow exception CheckThrowsOverflowException(fun () -> Operators.Checked.int32 2147483648.0 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int32 Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int32 Double.MaxValue |> ignore) // overflow exception CheckThrowsOverflowException(fun () -> Int32.MaxValue + 1 |> ignore) @@ -150,7 +160,9 @@ type OperatorsModuleChecked() = Assert.AreEqual(-9223372036854775808L, boundInt64) // overflow exception - CheckThrowsOverflowException(fun() -> Operators.Checked.int64 (float Int64.MaxValue + 1.0) |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int64 (float Int64.MaxValue + 1.0) |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int64 Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int64 Double.MaxValue |> ignore) // overflow exception CheckThrowsOverflowException(fun () -> Int64.MaxValue + 1L |> ignore) @@ -179,6 +191,8 @@ type OperatorsModuleChecked() = Operators.Checked.nativeint 2147483648.0 |> ignore else Operators.Checked.nativeint 9223372036854775808.0 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.nativeint Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.nativeint Double.MaxValue |> ignore) [] @@ -198,6 +212,8 @@ type OperatorsModuleChecked() = // overflow exception CheckThrowsOverflowException(fun () -> Operators.Checked.sbyte -256 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.sbyte Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.sbyte Double.MaxValue |> ignore) // overflow exception CheckThrowsOverflowException(fun () -> SByte.MaxValue + 1y |> ignore) @@ -220,7 +236,9 @@ type OperatorsModuleChecked() = let bounduint16 = Operators.Checked.uint16 65535.0 Assert.AreEqual(65535us, bounduint16) - CheckThrowsOverflowException(fun() -> Operators.Checked.uint16 65536.0 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.uint16 65536.0 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.uint16 Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.uint16 Double.MaxValue |> ignore) // overflow exception CheckThrowsOverflowException(fun () -> UInt16.MaxValue + 1us |> ignore) @@ -244,7 +262,9 @@ type OperatorsModuleChecked() = Assert.AreEqual(429496729u, bounduint32) // overflow exception - CheckThrowsOverflowException(fun () -> Operators.Checked.uint32(float UInt32.MaxValue + 1.0) |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.uint32 (float UInt32.MaxValue + 1.0) |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.uint32 Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.uint32 Double.MaxValue |> ignore) // overflow exception CheckThrowsOverflowException(fun () -> UInt32.MaxValue + 1u |> ignore) @@ -269,6 +289,8 @@ type OperatorsModuleChecked() = // overflow exception CheckThrowsOverflowException(fun () -> Operators.Checked.uint64 (float System.UInt64.MaxValue + 1.0) |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.uint64 Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.uint64 Double.MaxValue |> ignore) // overflow exception CheckThrowsOverflowException(fun () -> UInt64.MaxValue + 1UL |> ignore) @@ -302,5 +324,7 @@ type OperatorsModuleChecked() = else Operators.Checked.unativeint (float UInt64.MaxValue + 1.0) |> ignore ) + CheckThrowsOverflowException(fun () -> Operators.Checked.unativeint Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.unativeint Double.MaxValue |> ignore) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleDynamic.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleDynamic.fs new file mode 100644 index 00000000000..9af581dca52 --- /dev/null +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleDynamic.fs @@ -0,0 +1,1105 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +// Sync test content with OperatorsModule1.fs, OperatorsModule2.fs, and OperatorsModuleDynamic.fs + +namespace FSharp.Core.UnitTests.Operators + +open System +open Xunit + +#nowarn "1204" // CompilerMessage: This function is for use by dynamic invocations of F# code and should not be used directly +module OperatorsModuleDynamic = + + /// Check that the lambda throws an exception of the given type. Otherwise + /// calls Assert.Fail() + // Sync implementation with FSharp.Core.UnitTests.LibraryTestFx.CheckThrowsExn + let CheckThrowsExn<'a when 'a :> exn> (f : unit -> unit) = + try + let _ = f () + sprintf "Expected %O exception, got no exception" typeof<'a> |> Assert.Fail + with + | :? 'a -> () + | :? Reflection.TargetInvocationException as r when (r.InnerException :? 'a) -> () + | e -> sprintf "Expected %O or TargetInvocationException containing it, got: %O" typeof<'a> e |> Assert.Fail + let CheckThrowsOverflowException = CheckThrowsExn + + module Operators = + let byte<'T> = LanguagePrimitives.ExplicitDynamic<'T, byte> + let char<'T> = LanguagePrimitives.ExplicitDynamic<'T, char> + let double<'T> = LanguagePrimitives.ExplicitDynamic<'T, double> + let decimal<'T> = LanguagePrimitives.ExplicitDynamic<'T, decimal> + let float<'T> = LanguagePrimitives.ExplicitDynamic<'T, float> + let float32<'T> = LanguagePrimitives.ExplicitDynamic<'T, float32> + let nativeint<'T> = LanguagePrimitives.ExplicitDynamic<'T, nativeint> + let int<'T> = LanguagePrimitives.ExplicitDynamic<'T, int> + let int8<'T> = LanguagePrimitives.ExplicitDynamic<'T, int8> + let int16<'T> = LanguagePrimitives.ExplicitDynamic<'T, int16> + let int32<'T> = LanguagePrimitives.ExplicitDynamic<'T, int32> + let int64<'T> = LanguagePrimitives.ExplicitDynamic<'T, int64> + let sbyte<'T> = LanguagePrimitives.ExplicitDynamic<'T, sbyte> + let single<'T> = LanguagePrimitives.ExplicitDynamic<'T, single> + let uint<'T> = LanguagePrimitives.ExplicitDynamic<'T, uint> + let uint8<'T> = LanguagePrimitives.ExplicitDynamic<'T, uint8> + let uint16<'T> = LanguagePrimitives.ExplicitDynamic<'T, uint16> + let uint32<'T> = LanguagePrimitives.ExplicitDynamic<'T, uint32> + let uint64<'T> = LanguagePrimitives.ExplicitDynamic<'T, uint64> + let unativeint<'T> = LanguagePrimitives.ExplicitDynamic<'T, unativeint> + module Checked = + let byte<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, byte> + let char<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, char> + let double<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, double> + let decimal<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, decimal> + let float<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, float> + let float32<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, float32> + let nativeint<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, nativeint> + let int<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, int> + let int8<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, int8> + let int16<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, int16> + let int32<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, int32> + let int64<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, int64> + let sbyte<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, sbyte> + let single<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, single> + let uint<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, uint> + let uint8<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, uint8> + let uint16<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, uint16> + let uint32<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, uint32> + let uint64<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, uint64> + let unativeint<'T> = LanguagePrimitives.CheckedExplicitDynamic<'T, unativeint> + + [] + let byte() = + // int type + let intByte = Operators.byte 100 + Assert.AreEqual(100uy, intByte) + + // char type + let charByte = Operators.byte '0' + Assert.AreEqual(48uy, charByte) + + // boundary value + let boundByte = Operators.byte 255.0 + Assert.AreEqual(255uy, boundByte) + + // Overflow + let result = Operators.byte Int64.MaxValue + Assert.AreEqual(Byte.MaxValue, result) + + // Overflow + let result = Operators.byte Int64.MinValue + Assert.AreEqual(0uy, result) + + // Overflow + let result = Operators.byte Single.MinValue + Assert.AreEqual(0uy, result) + + // Overflow + let result = Operators.byte Single.MaxValue + Assert.AreEqual(0uy, result) + + // Overflow + let result = Operators.byte Double.MinValue + Assert.AreEqual(0uy, result) + + // Overflow + let result = Operators.byte Double.MaxValue + Assert.AreEqual(0uy, result) + + // Overflow + let result = Operators.byte (Int64.MaxValue * 8L) + Assert.AreEqual(248uy, result) // bit-complement + + // Overflow + let result = 255uy + 5uy + Assert.AreEqual(4uy, result) + + // OverflowException, from decimal is always checked + CheckThrowsOverflowException(fun () -> Operators.byte Decimal.MinValue |> ignore) + + [] + let char() = + // int type + Assert.AreEqual('0', Operators.char 48) + Assert.AreEqual('0', Operators.char 48u) + Assert.AreEqual('0', Operators.char 48s) + Assert.AreEqual('0', Operators.char 48us) + Assert.AreEqual('0', Operators.char 48y) + Assert.AreEqual('0', Operators.char 48uy) + Assert.AreEqual('0', Operators.char 48L) + Assert.AreEqual('0', Operators.char 48uL) + Assert.AreEqual('0', Operators.char 48n) + Assert.AreEqual('0', Operators.char 48un) + Assert.AreEqual('0', Operators.char 48f) + Assert.AreEqual('0', Operators.char 48.) + Assert.AreEqual('0', Operators.char 48m) + + // Overflow + Assert.AreEqual('\000', Operators.char Single.MinValue) + Assert.AreEqual('\000', Operators.char Double.MinValue) + Assert.AreEqual('\000', Operators.char Single.MaxValue) + Assert.AreEqual('\000', Operators.char Double.MaxValue) + CheckThrowsOverflowException(fun () -> Operators.char Decimal.MinValue |> ignore) + + // string type + let stringchar = Operators.char " " + Assert.AreEqual(' ', stringchar) + + + [] + let decimal () = + + // int value + let intdecimal = Operators.decimal (1) + Assert.AreEqual(1M, intdecimal) + + // nativeint value + let nativeintdecimal = Operators.decimal 1n + Assert.AreEqual(1M, nativeintdecimal) + + // unativeint value + let unativeintdecimal = Operators.decimal 1un + Assert.AreEqual(1M, unativeintdecimal) + + // char value + let chardecimal = Operators.decimal '\001' + Assert.AreEqual(1M, chardecimal) + + // float value + let floatdecimal = Operators.decimal (1.0) + Assert.AreEqual(1M, floatdecimal) + + [] + let double() = + // int type + let intdouble = Operators.float 100 + Assert.AreEqual(100.0, intdouble) + + // char type + let chardouble = Operators.float '0' + Assert.AreEqual(48.0, chardouble) + + // decimal type + let decimaldouble = Operators.float 100m + Assert.AreEqual(100.0, decimaldouble) + + [] + let float() = + // int type + let intfloat = Operators.float 100 + Assert.AreEqual((float)100, intfloat) + + // char type + let charfloat = Operators.float '0' + Assert.AreEqual((float)48, charfloat) + + // decimal type + let intfloat = Operators.float 100m + Assert.AreEqual((float)100, intfloat) + + [] + let float32() = + // int type + let intfloat32 = Operators.float32 100 + Assert.AreEqual((float32)100, intfloat32) + + // char type + let charfloat32 = Operators.float32 '0' + Assert.AreEqual((float32)48, charfloat32) + + // decimal type + let intfloat32 = Operators.float32 100m + Assert.AreEqual((float32)100, intfloat32) + + [] + let int() = + // int + let result = Operators.int 10 + Assert.AreEqual(10, result) + + // string + let result = Operators.int "10" + Assert.AreEqual(10, result) + + // double + let result = Operators.int 10.0 + Assert.AreEqual(10, result) + + // negative + let result = Operators.int -10 + Assert.AreEqual(-10, result) + + // zero + let result = Operators.int 0 + Assert.AreEqual(0, result) + + // Overflow + let result = Operators.int Single.MaxValue + Assert.AreEqual(Int32.MinValue, result) + + // Overflow + let result = Operators.int Single.MinValue + Assert.AreEqual(Int32.MinValue, result) + + // Overflow + let result = Operators.int Double.MaxValue + Assert.AreEqual(Int32.MinValue, result) + + // Overflow + let result = Operators.int Double.MinValue + Assert.AreEqual(Int32.MinValue, result) + + // Overflow + let result = Operators.int Int64.MaxValue + Assert.AreEqual(-1, result) + + // Overflow + let result = Operators.int Int64.MinValue + Assert.AreEqual(0, result) + + // Overflow + let result = Int32.MaxValue + 1 + Assert.AreEqual(Int32.MinValue, result) + + // OverflowException, from decimal is always checked + CheckThrowsOverflowException(fun () -> Operators.int Decimal.MinValue |> ignore) + + [] + let int16() = + // int + let result = Operators.int16 10 + Assert.AreEqual(10s, result) + + // double + let result = Operators.int16 10.0 + Assert.AreEqual(10s, result) + + // negative + let result = Operators.int16 -10 + Assert.AreEqual(-10s, result) + + // zero + let result = Operators.int16 0 + Assert.AreEqual(0s, result) + + // string + let result = Operators.int16 "10" + Assert.AreEqual(10s, result) + + // Overflow + let result = Operators.int16 Single.MaxValue + Assert.AreEqual(0s, result) + + // Overflow + let result = Operators.int16 Single.MinValue + Assert.AreEqual(0s, result) + + // Overflow + let result = Operators.int16 Double.MaxValue + Assert.AreEqual(0s, result) + + // Overflow + let result = Operators.int16 Double.MinValue + Assert.AreEqual(0s, result) + + let result = Operators.int16 Int64.MaxValue + Assert.AreEqual(-1s, result) + + // Overflow + let result = Operators.int16 Int64.MinValue + Assert.AreEqual(0s, result) + + // Overflow + let result = Int16.MaxValue + 1s + Assert.AreEqual(Int16.MinValue, result) + + // OverflowException, from decimal is always checked + CheckThrowsOverflowException(fun () -> Operators.int16 Decimal.MinValue |> ignore) + + [] + let int32() = + // int + let result = Operators.int32 10 + Assert.AreEqual(10, result) + + // double + let result = Operators.int32 10.0 + Assert.AreEqual(10, result) + + // negative + let result = Operators.int32 -10 + Assert.AreEqual(-10, result) + + // zero + let result = Operators.int32 0 + Assert.AreEqual(0, result) + + // string + let result = Operators.int32 "10" + Assert.AreEqual(10, result) + + // Overflow + let result = Operators.int32 Single.MaxValue + Assert.AreEqual(Int32.MinValue, result) + + // Overflow + let result = Operators.int32 Single.MinValue + Assert.AreEqual(Int32.MinValue, result) + + // Overflow + let result = Operators.int32 Double.MaxValue + Assert.AreEqual(Int32.MinValue, result) + + // Overflow + let result = Operators.int32 Double.MinValue + Assert.AreEqual(Int32.MinValue, result) + + // Overflow + let result = Operators.int32 Int64.MaxValue + Assert.AreEqual(-1, result) + + // Overflow + let result = Operators.int32 Int64.MinValue + Assert.AreEqual(0, result) + + // Overflow + let result = Int32.MaxValue + 5 + Assert.AreEqual(Int32.MinValue + 4, result) + + // OverflowException, from decimal is always checked + CheckThrowsOverflowException(fun () -> Operators.int32 Decimal.MinValue |> ignore) + + [] + let int64() = + // int + let result = Operators.int64 10 + Assert.AreEqual(10L, result) + + // double + let result = Operators.int64 10.0 + Assert.AreEqual(10L, result) + + // negative + let result = Operators.int64 -10 + Assert.AreEqual(-10L, result) + + // zero + let result = Operators.int64 0 + Assert.AreEqual(0L, result) + + // string + let result = Operators.int64 "10" + Assert.AreEqual(10L, result) + + // Overflow. + let result = Operators.int64 Single.MaxValue + Assert.AreEqual(Int64.MinValue, result) + + // Overflow + let result = Operators.int64 Single.MinValue + Assert.AreEqual(Int64.MinValue, result) + + // Overflow. + let result = Operators.int64 Double.MaxValue + Assert.AreEqual(Int64.MinValue, result) + + // Overflow + let result = Operators.int64 Double.MinValue + Assert.AreEqual(Int64.MinValue, result) + + // Overflow + let result = Operators.int64 UInt64.MaxValue + Assert.AreEqual(-1L, result) + + // max and min value as literals (this breaks compilation if the lexer fails) + Assert.AreEqual(-9223372036854775808L, Int64.MinValue) + Assert.AreEqual(9223372036854775807L, Int64.MaxValue) + + // OverflowException, from decimal is always checked + CheckThrowsOverflowException(fun () -> Operators.int64 Decimal.MinValue |> ignore) + + + [] + let nativeint() = + // int + let result = Operators.nativeint 10 + Assert.AreEqual(10n, result) + + // double + let result = Operators.nativeint 10.0 + Assert.AreEqual(10n, result) + + // int64 + let result = Operators.nativeint 10L + Assert.AreEqual(10n, result) + + // negative + let result = Operators.nativeint -10 + Assert.AreEqual(-10n, result) + + // zero + let result = Operators.nativeint 0 + Assert.AreEqual(0n, result) + + // Overflow Double.MaxValue is equal on 32 bits and 64 bits runtimes + let result = Operators.nativeint Single.MaxValue + if Info.isX86Runtime then + Assert.AreEqual(-2147483648n, result) + else + // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual(-9223372036854775807n - 1n, result) + + // Overflow (depends on pointer size) + let result = Operators.nativeint Single.MinValue + if Info.isX86Runtime then + Assert.AreEqual(-2147483648n, result) + else + // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual(-9223372036854775807n - 1n, result) + + // Overflow Double.MaxValue is equal on 32 bits and 64 bits runtimes + let result = Operators.nativeint Double.MaxValue + if Info.isX86Runtime then + Assert.AreEqual(-2147483648n, result) + else + // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual(-9223372036854775807n - 1n, result) + + // Overflow (depends on pointer size) + let result = Operators.nativeint Double.MinValue + if Info.isX86Runtime then + Assert.AreEqual(-2147483648n, result) + else + // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual(-9223372036854775807n - 1n, result) + + // Overflow (depends on pointer size) + let result = Operators.nativeint Int64.MinValue + if Info.isX86Runtime then + Assert.AreEqual(0n, result) + else + // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual(-9223372036854775807n - 1n, result) + + // Overflow (depends on pointer size) + if Info.isX86Runtime then + let result = nativeint Int32.MaxValue + 5n + Assert.AreEqual(-2147483644n, result) + else + let result = nativeint Int64.MaxValue + 5n + Assert.AreEqual(-9223372036854775804n, result) + + // Overflow (depends on pointer size) + let result = Operators.nativeint System.Double.MaxValue + if Info.isX86Runtime then + Assert.AreEqual(-2147483648n, result) + else + // Cannot express this as a literal, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual("-9223372036854775808", string result) + + let result = Operators.nativeint System.Double.MinValue + if Info.isX86Runtime then + Assert.AreEqual(-2147483648n, result) + else + // Cannot express this as a literal, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual("-9223372036854775808", string result) + + // Max and min value as literals (this breaks compilation if the lexer fails). + // The following tests ensure that the proper value is parsed, which is similar to `nativeint Int64.MaxValue` etc. + if Info.isX86Runtime then + Assert.AreEqual("0", string -9223372036854775808n) // same as int32 -9223372036854775808L + Assert.AreEqual("-1", string 9223372036854775807n) // same as int32 9223372036854775807L + else + Assert.AreEqual("-9223372036854775808", string -9223372036854775808n) + Assert.AreEqual("9223372036854775807", string 9223372036854775807n) + + + [] + let sbyte() = + // int + let result = Operators.sbyte 10 + Assert.AreEqual(10y, result) + + // double + let result = Operators.sbyte 10.0 + Assert.AreEqual(10y, result) + + // negative + let result = Operators.sbyte -10 + Assert.AreEqual(-10y, result) + + // zero + let result = Operators.sbyte 0 + Assert.AreEqual(0y, result) + + // Overflow + let result = Operators.sbyte Int64.MaxValue + Assert.AreEqual(-1y, result) + + // Overflow + let result = Operators.sbyte Int64.MinValue + Assert.AreEqual(0y, result) + + // Overflow + let result = Operators.sbyte Single.MinValue + Assert.AreEqual(0y, result) + + // Overflow + let result = Operators.sbyte Single.MaxValue + Assert.AreEqual(0y, result) + + // Overflow + let result = Operators.sbyte Double.MinValue + Assert.AreEqual(0y, result) + + // Overflow + let result = Operators.sbyte Double.MaxValue + Assert.AreEqual(0y, result) + + // Overflow + let result = Operators.sbyte (Int64.MaxValue * 8L) + Assert.AreEqual(-8y, result) // bit-complement + + // Overflow + let result = 127y + 1y + Assert.AreEqual(-128y, result) + + // OverflowException, from decimal is always checked + CheckThrowsOverflowException(fun () -> Operators.sbyte Decimal.MinValue |> ignore) + + [] + let single() = + // int + let result = Operators.float32 10 + Assert.AreEqual(10f, result) + + // double + let result = Operators.float32 10.0 + Assert.AreEqual(10f, result) + + // string + let result = Operators.float32 "10" + Assert.AreEqual(10f, result) + + + [] + let uint16() = + // int + let result = Operators.uint16 100 + Assert.AreEqual(100us, result) + + // double + let result = Operators.uint16 (100.0:double) + Assert.AreEqual(100us, result) + + // decimal + let result = Operators.uint16 100M + Assert.AreEqual(100us, result) + + // Overflow + let result = Operators.uint16 Single.MaxValue + Assert.AreEqual(0us, result) + + // Overflow + let result = Operators.uint16 Single.MinValue + Assert.AreEqual(0us, result) + + // Overflow + let result = Operators.uint16 Double.MaxValue + Assert.AreEqual(0us, result) + + // Overflow + let result = Operators.uint16 Double.MinValue + Assert.AreEqual(0us, result) + + // OverflowException, from decimal is always checked + CheckThrowsOverflowException(fun () -> Operators.uint16 Decimal.MinValue |> ignore) + + [] + let uint32() = + // int + let result = Operators.uint32 100 + Assert.AreEqual(100u, result) + + // double + let result = Operators.uint32 (100.0:double) + Assert.AreEqual(100u, result) + + // decimal + let result = Operators.uint32 100M + Assert.AreEqual(100u, result) + + // Overflow + let result = Operators.uint32 Single.MaxValue + Assert.AreEqual(0u, result) + + // Overflow + let result = Operators.uint32 Single.MinValue + Assert.AreEqual(0u, result) + + // Overflow + let result = Operators.uint32 Double.MaxValue + Assert.AreEqual(0u, result) + + // Overflow + let result = Operators.uint32 Double.MinValue + Assert.AreEqual(0u, result) + + // Overflow + let result = Operators.uint32 Int64.MaxValue + Assert.AreEqual(UInt32.MaxValue, result) + + // Overflow + let result = Operators.uint32 Int64.MinValue + Assert.AreEqual(0u, result) + + // Overflow + let result = UInt32.MaxValue + 5u + Assert.AreEqual(4u, result) + + // both 'u' and 'ul' are valid numeric suffixes for UInt32 + let result = 42u + 42ul + Assert.AreEqual(84u, result) + Assert.AreEqual(84ul, result) + + // OverflowException, from decimal is always checked + CheckThrowsOverflowException(fun () -> Operators.uint32 Decimal.MinValue |> ignore) + + [] + let uint64() = + // int + let result = Operators.uint64 100 + Assert.AreEqual(100UL, result) + + // double + let result = Operators.uint64 100.0 + Assert.AreEqual(100UL, result) + + // decimal + let result = Operators.uint64 100M + Assert.AreEqual(100UL, result) + + // Overflow + let result = Operators.uint64 Single.MaxValue + Assert.AreEqual(0UL, result) + + // Overflow + let result = Operators.uint64 Single.MinValue + Assert.AreEqual(9223372036854775808UL, result) // surprising, but true, 2^63 + 1 + + // Overflow + let result = Operators.uint64 Double.MaxValue + Assert.AreEqual(0UL, result) + + // Overflow + let result = Operators.uint64 Double.MinValue + Assert.AreEqual(9223372036854775808UL, result) // surprising, but true, 2^63 + 1 + + // Overflow + let result = Operators.uint64 Int64.MinValue + Assert.AreEqual(9223372036854775808UL, result) + + // Overflow + let result = Operators.uint64 SByte.MinValue + Assert.AreEqual(UInt64.MaxValue - 127UL, result) + + // Overflow + let result = UInt64.MaxValue + 5UL + Assert.AreEqual(4UL, result) + + // OverflowException, from decimal is always checked + CheckThrowsOverflowException(fun () -> Operators.uint64 Decimal.MinValue |> ignore) + + [] + let unativeint() = + // int + let result = Operators.unativeint 100 + let x: unativeint = 12un + Assert.AreEqual(100un, result) + + // double + let result = Operators.unativeint 100.0 + Assert.AreEqual(100un, result) + + // Overflow Single.MaxValue is equal on 32 bits and 64 bits runtimes + let result = Operators.unativeint Single.MaxValue + Assert.AreEqual(0un, result) + + // Overflow (depends on pointer size) + let result = Operators.unativeint Single.MinValue + if Info.isX86Runtime then + Assert.AreEqual(0un, result) + else + Assert.AreEqual(9223372036854775808un, result) // surprising, but true, 2^63 + 1 + + // Overflow Double.MaxValue is equal on 32 bits and 64 bits runtimes + let result = Operators.unativeint Double.MaxValue + Assert.AreEqual(0un, result) + + // Overflow (depends on pointer size) + let result = Operators.unativeint Double.MinValue + if Info.isX86Runtime then + Assert.AreEqual(0un, result) + else + Assert.AreEqual(9223372036854775808un, result) // surprising, but true, 2^63 + 1 + + // Overflow (depends on pointer size) + let result = Operators.unativeint Int64.MinValue + if Info.isX86Runtime then + Assert.AreEqual(0un, result) + else + Assert.AreEqual(9223372036854775808un, result) + + // Overflow (depends on pointer size) + let result = 0un - 1un + if Info.isX86Runtime then + Assert.AreEqual(4294967295un, result) + else + Assert.AreEqual(18446744073709551615un, result) + + open Operators.Checked + + [] + let Checkedbyte() = + // int type + let intByte = Operators.Checked.byte 100 + Assert.AreEqual(100uy, intByte) + + // char type + let charByte = Operators.Checked.byte '0' + Assert.AreEqual(48uy, charByte) + + // boundary value + let boundByte = Operators.Checked.byte 255.0 + Assert.AreEqual(255uy, boundByte) + + // overflow exception + CheckThrowsOverflowException(fun () -> Operators.Checked.byte 256 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.byte 256f |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.byte 256. |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> 255uy + 1uy |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> 0uy - 1uy |> ignore) + + [] + let Checkedchar() = + + // number + let numberChar = Operators.Checked.char 48 + Assert.AreEqual('0', numberChar) + + // letter + let letterChar = Operators.Checked.char 65 + Assert.AreEqual('A', letterChar) + + // boundary value + let boundchar = Operators.Checked.char 126 + Assert.AreEqual('~', boundchar) + + // overflow exception + CheckThrowsOverflowException(fun () -> Operators.Checked.char (int64 Char.MaxValue + 1L) |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.char Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.char Double.MaxValue |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> '\uFFFF' + '\u0001' |> ignore) + + + [] + let CheckedInt() = + + // char + let charInt = Operators.Checked.int '0' + Assert.AreEqual(48, charInt) + + // float + let floatInt = Operators.Checked.int 10.0 + Assert.AreEqual(10, floatInt) + + // boundary value + let boundInt = Operators.Checked.int 32767.0 + Assert.AreEqual(32767, boundInt) + + // overflow exception + CheckThrowsOverflowException(fun () -> Operators.Checked.int 2147483648.0 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int Double.MaxValue |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> Int32.MaxValue + 1 |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> Int32.MinValue - 1 |> ignore) + + [] + let CheckedInt16() = + + // char + let charInt16 = Operators.Checked.int16 '0' + Assert.AreEqual(48s, charInt16) + + // float + let floatInt16 = Operators.Checked.int16 10.0 + Assert.AreEqual(10s, floatInt16) + + // boundary value + let boundInt16 = Operators.Checked.int16 32767.0 + Assert.AreEqual(32767s, boundInt16) + + // overflow exception + CheckThrowsOverflowException(fun () -> Operators.Checked.int16 32768.0 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int16 Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int16 Double.MaxValue |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> Int16.MaxValue + 1s |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> Int16.MinValue - 1s |> ignore) + + [] + let CheckedInt32() = + + // char + let charInt32 = Operators.Checked.int32 '0' + Assert.AreEqual(48, charInt32) + + // float + let floatInt32 = Operators.Checked.int32 10.0 + Assert.AreEqual(10, floatInt32) + + // boundary value + let boundInt32 = Operators.Checked.int32 2147483647.0 + Assert.AreEqual(2147483647, boundInt32) + + // overflow exception + CheckThrowsOverflowException(fun () -> Operators.Checked.int32 2147483648.0 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int32 Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int32 Double.MaxValue |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> Int32.MaxValue + 1 |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> Int32.MinValue - 1 |> ignore) + + [] + let CheckedInt64() = + + // char + let charInt64 = Operators.Checked.int64 '0' + Assert.AreEqual(48L, charInt64) + + // float + let floatInt64 = Operators.Checked.int64 10.0 + Assert.AreEqual(10L, floatInt64) + + // boundary value + let boundInt64 = Operators.Checked.int64 9223372036854775807I + let _ = 9223372036854775807L + Assert.AreEqual(9223372036854775807L, boundInt64) + + // boundary value + let boundInt64 = Operators.Checked.int64 -9223372036854775808I + let _ = -9223372036854775808L + Assert.AreEqual(-9223372036854775808L, boundInt64) + + // overflow exception + CheckThrowsOverflowException(fun () -> Operators.Checked.int64 (float Int64.MaxValue + 1.0) |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int64 Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.int64 Double.MaxValue |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> Int64.MaxValue + 1L |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> Int64.MinValue - 1L |> ignore) + + [] + let CheckedNativeint() = + + // char + let charnativeint = Operators.Checked.nativeint '0' + Assert.AreEqual(48n, charnativeint) + + // float + let floatnativeint = Operators.Checked.nativeint 10.0 + Assert.AreEqual(10n, floatnativeint) + + // boundary value + let boundnativeint = Operators.Checked.nativeint 32767.0 + Assert.AreEqual(32767n, boundnativeint) + + // overflow exception (depends on pointer size) + CheckThrowsOverflowException(fun () -> + if Info.isX86Runtime then + Operators.Checked.nativeint 2147483648.0 |> ignore + else + Operators.Checked.nativeint 9223372036854775808.0 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.nativeint Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.nativeint Double.MaxValue |> ignore) + + + [] + let Checkedsbyte() = + + // char + let charsbyte = Operators.Checked.sbyte '0' + Assert.AreEqual(48y, charsbyte) + + // float + let floatsbyte = Operators.Checked.sbyte -10.0 + Assert.AreEqual(-10y, floatsbyte) + + // boundary value + let boundsbyte = Operators.Checked.sbyte -127.0 + Assert.AreEqual(-127y, boundsbyte) + + // overflow exception + CheckThrowsOverflowException(fun () -> Operators.Checked.sbyte -256 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.sbyte Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.sbyte Double.MaxValue |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> SByte.MaxValue + 1y |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> SByte.MinValue - 1y |> ignore) + + [] + let Checkeduint16() = + + // char + let charuint16 = Operators.Checked.uint16 '0' + Assert.AreEqual(48us, charuint16) + + // float + let floatuint16 = Operators.Checked.uint16 10.0 + Assert.AreEqual(10us, floatuint16) + + // boundary value + let bounduint16 = Operators.Checked.uint16 65535.0 + Assert.AreEqual(65535us, bounduint16) + + CheckThrowsOverflowException(fun () -> Operators.Checked.uint16 65536.0 |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.uint16 Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.uint16 Double.MaxValue |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> UInt16.MaxValue + 1us |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> UInt16.MinValue - 1us |> ignore) + + [] + let Checkeduint32() = + + // char + let charuint32 = Operators.Checked.uint32 '0' + Assert.AreEqual(48u, charuint32) + + // float + let floatuint32 = Operators.Checked.uint32 10.0 + Assert.AreEqual(10u, floatuint32) + + // boundary value + let bounduint32 = Operators.Checked.uint32 429496729.0 + Assert.AreEqual(429496729u, bounduint32) + + // overflow exception + CheckThrowsOverflowException(fun () -> Operators.Checked.uint32 (float UInt32.MaxValue + 1.0) |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.uint32 Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.uint32 Double.MaxValue |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> UInt32.MaxValue + 1u |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> UInt32.MinValue - 1u |> ignore) + + [] + let Checkeduint64() = + + // char + let charuint64 = Operators.Checked.uint64 '0' + Assert.AreEqual(48UL, charuint64) + + // float + let floatuint64 = Operators.Checked.uint64 10.0 + Assert.AreEqual(10UL, floatuint64) + + // boundary value + let bounduint64 = Operators.Checked.uint64 429496729.0 + Assert.AreEqual(429496729UL, bounduint64) + + // overflow exception + CheckThrowsOverflowException(fun () -> Operators.Checked.uint64 (float System.UInt64.MaxValue + 1.0) |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.uint64 Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.uint64 Double.MaxValue |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> UInt64.MaxValue + 1UL |> ignore) + + // overflow exception + CheckThrowsOverflowException(fun () -> UInt64.MinValue - 1UL |> ignore) + + [] + let Checkedunativeint() = + + // char + let charunativeint = Operators.Checked.unativeint '0' + Assert.AreEqual(48un, charunativeint) + + // float + let floatunativeint = Operators.Checked.unativeint 10.0 + Assert.AreEqual(10un, floatunativeint) + + // boundary value (dependent on pointer size) + if Info.isX86Runtime then + let boundunativeint = Operators.Checked.unativeint 4294967295.0 + Assert.AreEqual(4294967295un, boundunativeint) + else + let boundnativeint = Operators.Checked.unativeint 1.84467440737095505E+19 // 64 bit max value cannot be expressed exactly as double + Assert.AreEqual(18446744073709549568un, boundnativeint) + + // overflow exception (depends on pointer size) + CheckThrowsOverflowException(fun () -> + if Info.isX86Runtime then + Operators.Checked.unativeint (float UInt32.MaxValue + 1.0) |> ignore + else + Operators.Checked.unativeint (float UInt64.MaxValue + 1.0) |> ignore + ) + CheckThrowsOverflowException(fun () -> Operators.Checked.unativeint Single.MaxValue |> ignore) + CheckThrowsOverflowException(fun () -> Operators.Checked.unativeint Double.MaxValue |> ignore) + + type A = A + type B() = + static member op_Equality(_: B, _: B) = false + static member op_Inequality(_: B, _: B) = true + type [] C = + static member op_Equality(_: C, _: C) = true + static member op_Inequality(_: C, _: C) = true + static member op_Explicit(_: A) = C() // Explicit from another type + static member op_Explicit(_: C) = B() // Explicit to another type + static member op_Implicit(_: D) = C() // Duplicated implicit conversion + static member op_Explicit(_: C) = { D = 0 } // Duplicated explicit conversion + and D = { D : int } with + static member op_Implicit(_: A) = { D = 0 } // Implicit from another type + static member op_Implicit(_: D) = B() // Implicit to another type + static member op_Implicit(_: D) = C() // Duplicated implicit conversion + static member op_Explicit(_: C) = { D = 0 } // Duplicated explicit conversion + let [] Equality_ExplicitDynamicTests() = + Assert.False(LanguagePrimitives.EqualityDynamic(B())(B()) : bool) + Assert.True(LanguagePrimitives.InequalityDynamic(B())(B()) : bool) + Assert.True(LanguagePrimitives.EqualityDynamic(C())(C()) : bool) + Assert.True(LanguagePrimitives.InequalityDynamic(C())(C()) : bool) + Assert.NotNull(LanguagePrimitives.ExplicitDynamic(A) : C) + Assert.NotNull(LanguagePrimitives.ExplicitDynamic(A) : C) // Explicit from another type + Assert.NotNull(LanguagePrimitives.ExplicitDynamic(C()) : B) // Explicit to another type + Assert.NotNull(LanguagePrimitives.ExplicitDynamic({ D = 0 }) : C) // Duplicated implicit conversion + Assert.NotNull(LanguagePrimitives.ExplicitDynamic(C()) : D) // Duplicated explicit conversion + Assert.NotNull(LanguagePrimitives.ExplicitDynamic(A) : D) // Implicit from another type + Assert.NotNull(LanguagePrimitives.ExplicitDynamic({ D = 0 }) : B) // Implicit to another type + Assert.NotNull(LanguagePrimitives.ExplicitDynamic({ D = 0 }) : C) // Duplicated implicit conversion + Assert.NotNull(LanguagePrimitives.ExplicitDynamic(C()) : D) // Duplicated explicit conversion \ No newline at end of file diff --git a/tests/FSharp.Core.UnitTests/SurfaceArea.fs b/tests/FSharp.Core.UnitTests/SurfaceArea.fs index 31d2fa41d15..c214e76daf7 100644 --- a/tests/FSharp.Core.UnitTests/SurfaceArea.fs +++ b/tests/FSharp.Core.UnitTests/SurfaceArea.fs @@ -1486,6 +1486,7 @@ Microsoft.FSharp.Core.LanguagePrimitives: TResult AdditionDynamic[T1,T2,TResult] Microsoft.FSharp.Core.LanguagePrimitives: TResult BitwiseAndDynamic[T1,T2,TResult](T1, T2) Microsoft.FSharp.Core.LanguagePrimitives: TResult BitwiseOrDynamic[T1,T2,TResult](T1, T2) Microsoft.FSharp.Core.LanguagePrimitives: TResult CheckedAdditionDynamic[T1,T2,TResult](T1, T2) +Microsoft.FSharp.Core.LanguagePrimitives: TResult CheckedExplicitDynamic[T,TResult](T) Microsoft.FSharp.Core.LanguagePrimitives: TResult CheckedMultiplyDynamic[T1,T2,TResult](T1, T2) Microsoft.FSharp.Core.LanguagePrimitives: TResult CheckedSubtractionDynamic[T1,T2,TResult](T1, T2) Microsoft.FSharp.Core.LanguagePrimitives: TResult CheckedUnaryNegationDynamic[T,TResult](T) diff --git a/tests/fsharp/core/libtest/test.fsx b/tests/fsharp/core/libtest/test.fsx index bf58ea27d08..a2cdb2fd60f 100644 --- a/tests/fsharp/core/libtest/test.fsx +++ b/tests/fsharp/core/libtest/test.fsx @@ -3657,6 +3657,46 @@ module Optimiations = begin let _ = check "opt.oi20c77tb" (0x8000000000000000L >>> 63) (0xFFFFFFFFFFFFFFFFL) let _ = check "opt.oi20c77yb" (0x8000000000000000L >>> 64) (0x8000000000000000L) + let _ = check "opt.oi20c77qc" ('a' + '\025') ('z') + let _ = check "opt.oi20c77wc" ('z' - '\025') ('a') + let _ = check "opt.oi20c77ec" (nativeint -3m) (-3n) + let _ = check "opt.oi20c77rc" (nativeint 3m) (3n) + let _ = check "opt.oi20c77tc" (unativeint 3m) (3un) + let _ = check "opt.oi20c77yc" (char 65535m) ('\uFFFF') + let _ = check "opt.oi20c77uc" (decimal '\uFFFF') (65535m) + let _ = check "opt.oi20c77ic" (nativeint "3") (3n) + let _ = check "opt.oi20c77oc" (nativeint "-3") (-3n) + let _ = check "opt.oi20c77pc" (unativeint "3") (3un) + let _ = check "opt.oi20c77ac" (Checked.(+) 'a' '\025') ('z') + let _ = check "opt.oi20c77sc" (Checked.(-) 'z' '\025') ('a') + let _ = check "opt.oi20c77dc" (Checked.nativeint -3m) (-3n) + let _ = check "opt.oi20c77fc" (Checked.nativeint 3m) (3n) + let _ = check "opt.oi20c77gc" (Checked.unativeint 3m) (3un) + let _ = check "opt.oi20c77hc" (Checked.char 65535m) ('\uFFFF') + let _ = check "opt.oi20c77jc" (Checked.nativeint "3") (3n) + let _ = check "opt.oi20c77kc" (Checked.nativeint "-3") (-3n) + let _ = check "opt.oi20c77lc" (Checked.unativeint "3") (3un) + let _ = check "opt.oi20c77zc" (int8 3.9m) (3y) + let _ = check "opt.oi20c77xc" (uint8 3.9m) (3uy) + let _ = check "opt.oi20c77cc" (int16 3.9m) (3s) + let _ = check "opt.oi20c77vc" (uint16 3.9m) (3us) + let _ = check "opt.oi20c77bc" (int32 3.9m) (3l) + let _ = check "opt.oi20c77nc" (uint32 3.9m) (3ul) + let _ = check "opt.oi20c77mc" (int64 3.9m) (3L) + let _ = check "opt.oi20c77,c" (uint64 3.9m) (3uL) + let _ = check "opt.oi20c77.c" (nativeint 3.9m) (3n) + let _ = check "opt.oi20c77/c" (unativeint 3.9m) (3un) + let _ = check "opt.oi20c77zc'" (Checked.int8 3.9m) (3y) + let _ = check "opt.oi20c77xc'" (Checked.uint8 3.9m) (3uy) + let _ = check "opt.oi20c77cc'" (Checked.int16 3.9m) (3s) + let _ = check "opt.oi20c77vc'" (Checked.uint16 3.9m) (3us) + let _ = check "opt.oi20c77bc'" (Checked.int32 3.9m) (3l) + let _ = check "opt.oi20c77nc'" (Checked.uint32 3.9m) (3ul) + let _ = check "opt.oi20c77mc'" (Checked.int64 3.9m) (3L) + let _ = check "opt.oi20c77,c'" (Checked.uint64 3.9m) (3uL) + let _ = check "opt.oi20c77.c'" (Checked.nativeint 3.9m) (3n) + let _ = check "opt.oi20c77/c'" (Checked.unativeint 3.9m) (3un) + end diff --git a/tests/fsharp/core/quotes/test.fsx b/tests/fsharp/core/quotes/test.fsx index e394597f052..cc85cf23ad6 100644 --- a/tests/fsharp/core/quotes/test.fsx +++ b/tests/fsharp/core/quotes/test.fsx @@ -1543,7 +1543,7 @@ module MoreQuotationsTests = [Coerce (enumerator, Object)])), Dispose, []), Value ()))))""" - let t9() = <@@ try failwith "test" with Failure _ -> 0 @@> + let t9() = <@@ try failwith "test" with Failure _ -> 0 @@> checkStrings "vwewvwewe9" (sprintf "%A" (t9())) """TryWith (Call (None, FailWith, [Value ("test")]), matchValue, Let (activePatternResult1557, Call (None, FailurePattern, [matchValue]), @@ -3257,9 +3257,11 @@ module TestMatchBang = module WitnessTests = open FSharp.Data.UnitSystems.SI.UnitSymbols + open FSharp.Linq + open FSharp.Linq.NullableOperators test "check CallWithWitness" - (<@ 1 + 1 @> + (<@ 1 + 1 @> |> function | CallWithWitnesses(None, minfo1, minfo2, witnessArgs, args) -> minfo1.Name = "op_Addition" && @@ -3380,287 +3382,2045 @@ module WitnessTests = false | _ -> false) - test "check CallWithWitnesses all operators)" + test "check CallWithWitnesses all operators" (let tests = - [ <@@ sin 1.0 @@>, true - <@@ sin 1.0f @@>, true - <@@ sign 1.0f @@>, true - <@@ sqrt 1.0f @@>, true - <@@ 2.0f ** 2.0f @@>, true - <@@ atan2 3.0 4.0 @@>, true - <@@ 1.0f + 4.0f @@>, true - <@@ 1.0f - 4.0f @@>, true - <@@ 1.0f * 4.0f @@>, true - <@@ 1.0M * 4.0M @@>, true - <@@ 1.0f / 4.0f @@>, true - <@@ 1 % 4 @@>, true - <@@ -(4.0M) @@>, true - - <@@ 1y <<< 3 @@>, true - <@@ 1uy <<< 3 @@>, true - <@@ 1s <<< 3 @@>, true - <@@ 1us <<< 3 @@>, true - <@@ 1 <<< 3 @@>, true - <@@ 1u <<< 3 @@>, true - <@@ 1L <<< 3 @@>, true - <@@ 1UL <<< 3 @@>, true - <@@ LanguagePrimitives.GenericOne <<< 3 @@>, false - <@@ LanguagePrimitives.GenericOne <<< 3 @@>, false - - <@@ 1y >>> 3 @@>, true - <@@ 1uy >>> 3 @@>, true - <@@ 1s >>> 3 @@>, true - <@@ 1us >>> 3 @@>, true - <@@ 1 >>> 3 @@>, true - <@@ 1u >>> 3 @@>, true - <@@ 1L >>> 3 @@>, true - <@@ 1UL >>> 3 @@>, true - <@@ LanguagePrimitives.GenericOne >>> 3 @@>, false - <@@ LanguagePrimitives.GenericOne >>> 3 @@>, false + [|<@@ sin 1.0 @@>, box 0x3FEAED548F090CEELF // Around 0.841470984807897 + <@@ sin 1.0f @@>, box 0x3F576AA4lf // = 0.841471f + <@@ sign 1.0f @@>, box 1 + <@@ sqrt 1.0f @@>, box 1f + <@@ atan2 3.0 4.0 @@>, box 0x3FE4978FA3269EE1LF // Around 0.643501108793284 + <@@ atan2 3.0 4.0 @@>, box 0x3FE4978FA3269EE1LF // Around 0.643501108793284 - <@@ 1y &&& 3y @@>, true - <@@ 1uy &&& 3uy @@>, true - <@@ 1s &&& 3s @@>, true - <@@ 1us &&& 3us @@>, true - <@@ 1 &&& 3 @@>, true - <@@ 1u &&& 3u @@>, true - <@@ 1L &&& 3L @@>, true - <@@ 1UL &&& 3UL @@>, true - <@@ LanguagePrimitives.GenericOne &&& LanguagePrimitives.GenericOne @@>, false - <@@ LanguagePrimitives.GenericOne &&& LanguagePrimitives.GenericOne @@>, false - - <@@ 1y ||| 3y @@>, true - <@@ 1uy ||| 3uy @@>, true - <@@ 1s ||| 3s @@>, true - <@@ 1us ||| 3us @@>, true - <@@ 1 ||| 3 @@>, true - <@@ 1u ||| 3u @@>, true - <@@ 1L ||| 3L @@>, true - <@@ 1UL ||| 3UL @@>, true - <@@ LanguagePrimitives.GenericOne ||| LanguagePrimitives.GenericOne @@>, false - <@@ LanguagePrimitives.GenericOne ||| LanguagePrimitives.GenericOne @@>, false - - <@@ 1y ^^^ 3y @@>, true - <@@ 1uy ^^^ 3uy @@>, true - <@@ 1s ^^^ 3s @@>, true - <@@ 1us ^^^ 3us @@>, true - <@@ 1 ^^^ 3 @@>, true - <@@ 1u ^^^ 3u @@>, true - <@@ 1L ^^^ 3L @@>, true - <@@ 1UL ^^^ 3UL @@>, true - <@@ LanguagePrimitives.GenericOne ^^^ LanguagePrimitives.GenericOne @@>, false - <@@ LanguagePrimitives.GenericOne ^^^ LanguagePrimitives.GenericOne @@>, false - - <@@ ~~~3y @@>, true - <@@ ~~~3uy @@>, true - <@@ ~~~3s @@>, true - <@@ ~~~3us @@>, true - <@@ ~~~3 @@>, true - <@@ ~~~3u @@>, true - <@@ ~~~3L @@>, true - <@@ ~~~3UL @@>, true - <@@ ~~~LanguagePrimitives.GenericOne @@>, false - <@@ ~~~LanguagePrimitives.GenericOne @@>, false - - <@@ byte 3uy @@>, true - <@@ byte 3y @@>, true - <@@ byte 3s @@>, true - <@@ byte 3us @@>, true - <@@ byte 3 @@>, true - <@@ byte 3u @@>, true - <@@ byte 3L @@>, true - <@@ byte 3UL @@>, true - <@@ byte 3.0f @@>, true - <@@ byte 3.0 @@>, true - <@@ byte LanguagePrimitives.GenericOne @@>, false - <@@ byte LanguagePrimitives.GenericOne @@>, false - <@@ byte 3.0M @@>, true - <@@ byte "3" @@>, false - - <@@ sbyte 3uy @@>, true - <@@ sbyte 3y @@>, true - <@@ sbyte 3s @@>, true - <@@ sbyte 3us @@>, true - <@@ sbyte 3 @@>, true - <@@ sbyte 3u @@>, true - <@@ sbyte 3L @@>, true - <@@ sbyte 3UL @@>, true - <@@ sbyte 3.0f @@>, true - <@@ sbyte 3.0 @@>, true - <@@ sbyte LanguagePrimitives.GenericOne @@>, false - <@@ sbyte LanguagePrimitives.GenericOne @@>, false - <@@ sbyte 3.0M @@>, true - <@@ sbyte "3" @@>, false - - <@@ int16 3uy @@>, true - <@@ int16 3y @@>, true - <@@ int16 3s @@>, true - <@@ int16 3us @@>, true - <@@ int16 3 @@>, true - <@@ int16 3u @@>, true - <@@ int16 3L @@>, true - <@@ int16 3UL @@>, true - <@@ int16 3.0f @@>, true - <@@ int16 3.0 @@>, true - <@@ int16 LanguagePrimitives.GenericOne @@>, false - <@@ int16 LanguagePrimitives.GenericOne @@>, false - <@@ int16 3.0M @@>, true - <@@ int16 "3" @@>, false - - <@@ uint16 3uy @@>, true - <@@ uint16 3y @@>, true - <@@ uint16 3s @@>, true - <@@ uint16 3us @@>, true - <@@ uint16 3 @@>, true - <@@ uint16 3u @@>, true - <@@ uint16 3L @@>, true - <@@ uint16 3UL @@>, true - <@@ uint16 3.0f @@>, true - <@@ uint16 3.0 @@>, true - <@@ uint16 LanguagePrimitives.GenericOne @@>, false - <@@ uint16 LanguagePrimitives.GenericOne @@>, false - <@@ uint16 3.0M @@>, true - <@@ uint16 "3" @@>, false - - <@@ int32 3uy @@>, true - <@@ int32 3y @@>, true - <@@ int32 3s @@>, true - <@@ int32 3us @@>, true - <@@ int32 3 @@>, true - <@@ int32 3u @@>, true - <@@ int32 3L @@>, true - <@@ int32 3UL @@>, true - <@@ int32 3.0f @@>, true - <@@ int32 3.0 @@>, true - <@@ int32 LanguagePrimitives.GenericOne @@>, false - <@@ int32 LanguagePrimitives.GenericOne @@>, false - <@@ int32 3.0M @@>, true - <@@ int32 "3" @@>, false - - <@@ uint32 3uy @@>, true - <@@ uint32 3y @@>, true - <@@ uint32 3s @@>, true - <@@ uint32 3us @@>, true - <@@ uint32 3 @@>, true - <@@ uint32 3u @@>, true - <@@ uint32 3L @@>, true - <@@ uint32 3UL @@>, true - <@@ uint32 3.0f @@>, true - <@@ uint32 3.0 @@>, true - <@@ uint32 LanguagePrimitives.GenericOne @@>, false - <@@ uint32 LanguagePrimitives.GenericOne @@>, false - <@@ uint32 3.0M @@>, true - <@@ uint32 "3" @@>, false - - <@@ int64 3uy @@>, true - <@@ int64 3y @@>, true - <@@ int64 3s @@>, true - <@@ int64 3us @@>, true - <@@ int64 3 @@>, true - <@@ int64 3u @@>, true - <@@ int64 3L @@>, true - <@@ int64 3UL @@>, true - <@@ int64 3.0f @@>, true - <@@ int64 3.0 @@>, true - <@@ int64 LanguagePrimitives.GenericOne @@>, false - <@@ int64 LanguagePrimitives.GenericOne @@>, false - <@@ int64 3.0M @@>, true - <@@ int64 "3" @@>, false + <@@ 1y + 4y @@>, box 5y + <@@ 1uy + 4uy @@>, box 5uy + <@@ 1s + 4s @@>, box 5s + <@@ 1us + 4us @@>, box 5us + <@@ 1 + 4 @@>, box 5 + <@@ 1u + 4u @@>, box 5u + <@@ 1L + 4L @@>, box 5L + <@@ 1uL + 4uL @@>, box 5uL + <@@ 1.0f + 4.0f @@>, box 5f + <@@ 1.0 + 4.0 @@>, box 5. + <@@ 1m + 4m @@>, box 5m + <@@ 1m + 4m @@>, box 5m + <@@ 1I + 4I @@>, box 5I + <@@ '1' + '\004' @@>, box '5' + <@@ "abc" + "def" @@>, box "abcdef" + <@@ LanguagePrimitives.GenericOne + LanguagePrimitives.GenericOne @@>, box 2n + <@@ LanguagePrimitives.GenericOne + LanguagePrimitives.GenericOne @@>, box 2un + <@@ Checked.(+) 1y 4y @@>, box 5y + <@@ Checked.(+) 1uy 4uy @@>, box 5uy + <@@ Checked.(+) 1s 4s @@>, box 5s + <@@ Checked.(+) 1us 4us @@>, box 5us + <@@ Checked.(+) 1 4 @@>, box 5 + <@@ Checked.(+) 1u 4u @@>, box 5u + <@@ Checked.(+) 1L 4L @@>, box 5L + <@@ Checked.(+) 1uL 4uL @@>, box 5uL + <@@ Checked.(+) 1.0f 4.0f @@>, box 5f + <@@ Checked.(+) 1.0 4.0 @@>, box 5. + <@@ Checked.(+) 1m 4m @@>, box 5m + <@@ Checked.(+) 1m 4m @@>, box 5m + <@@ Checked.(+) 1I 4I @@>, box 5I + <@@ Checked.(+) '1' '\004' @@>, box '5' + <@@ Checked.(+) "abc" "def" @@>, box "abcdef" + <@@ Checked.(+) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box 2n + <@@ Checked.(+) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box 2un + + <@@ 4y - 1y @@>, box 3y + <@@ 4uy - 1uy @@>, box 3uy + <@@ 4s - 1s @@>, box 3s + <@@ 4us - 1us @@>, box 3us + <@@ 4 - 1 @@>, box 3 + <@@ 4u - 1u @@>, box 3u + <@@ 4L - 1L @@>, box 3L + <@@ 4uL - 1uL @@>, box 3uL + <@@ 4.0f - 1.0f @@>, box 3f + <@@ 4.0 - 1.0 @@>, box 3. + <@@ 4m - 1m @@>, box 3m + <@@ 4m - 1m @@>, box 3m + <@@ 4I - 1I @@>, box 3I + <@@ '4' - '\001' @@>, box '3' + <@@ LanguagePrimitives.GenericOne - LanguagePrimitives.GenericOne @@>, box 0n + <@@ LanguagePrimitives.GenericOne - LanguagePrimitives.GenericOne @@>, box 0un + <@@ Checked.(-) 4y 1y @@>, box 3y + <@@ Checked.(-) 4uy 1uy @@>, box 3uy + <@@ Checked.(-) 4s 1s @@>, box 3s + <@@ Checked.(-) 4us 1us @@>, box 3us + <@@ Checked.(-) 4 1 @@>, box 3 + <@@ Checked.(-) 4u 1u @@>, box 3u + <@@ Checked.(-) 4L 1L @@>, box 3L + <@@ Checked.(-) 4uL 1uL @@>, box 3uL + <@@ Checked.(-) 4.0f 1.0f @@>, box 3f + <@@ Checked.(-) 4.0 1.0 @@>, box 3. + <@@ Checked.(-) 4m 1m @@>, box 3m + <@@ Checked.(-) 4m 1m @@>, box 3m + <@@ Checked.(-) 4I 1I @@>, box 3I + <@@ Checked.(-) '4' '\001' @@>, box '3' + <@@ Checked.(-) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box 0n + <@@ Checked.(-) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box 0un + + <@@ 2y * 4y @@>, box 8y + <@@ 2uy * 4uy @@>, box 8uy + <@@ 2s * 4s @@>, box 8s + <@@ 2us * 4us @@>, box 8us + <@@ 2 * 4 @@>, box 8 + <@@ 2u * 4u @@>, box 8u + <@@ 2L * 4L @@>, box 8L + <@@ 2uL * 4uL @@>, box 8uL + <@@ 2.0f * 4.0f @@>, box 8f + <@@ 2.0 * 4.0 @@>, box 8. + <@@ 2m * 4m @@>, box 8m + <@@ 2m * 4m @@>, box 8m + <@@ 2I * 4I @@>, box 8I + <@@ LanguagePrimitives.GenericOne * LanguagePrimitives.GenericOne @@>, box 1n + <@@ LanguagePrimitives.GenericOne * LanguagePrimitives.GenericOne @@>, box 1un + <@@ Checked.(*) 2y 4y @@>, box 8y + <@@ Checked.(*) 2uy 4uy @@>, box 8uy + <@@ Checked.(*) 2s 4s @@>, box 8s + <@@ Checked.(*) 2us 4us @@>, box 8us + <@@ Checked.(*) 2 4 @@>, box 8 + <@@ Checked.(*) 2u 4u @@>, box 8u + <@@ Checked.(*) 2L 4L @@>, box 8L + <@@ Checked.(*) 2uL 4uL @@>, box 8uL + <@@ Checked.(*) 2.0f 4.0f @@>, box 8f + <@@ Checked.(*) 2.0 4.0 @@>, box 8. + <@@ Checked.(*) 2m 4m @@>, box 8m + <@@ Checked.(*) 2m 4m @@>, box 8m + <@@ Checked.(*) 2I 4I @@>, box 8I + <@@ Checked.(*) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box 1n + <@@ Checked.(*) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box 1un + + <@@ 6y / 3y @@>, box 2y + <@@ 6uy / 3uy @@>, box 2uy + <@@ 6s / 3s @@>, box 2s + <@@ 6us / 3us @@>, box 2us + <@@ 6 / 3 @@>, box 2 + <@@ 6u / 3u @@>, box 2u + <@@ 6L / 3L @@>, box 2L + <@@ 6uL / 3uL @@>, box 2uL + <@@ 6.0f / 3.0f @@>, box 2f + <@@ 6.0 / 3.0 @@>, box 2. + <@@ 6m / 3m @@>, box 2m + <@@ 6m / 3m @@>, box 2m + <@@ 6I / 3I @@>, box 2I + <@@ LanguagePrimitives.GenericOne / LanguagePrimitives.GenericOne @@>, box 1n + <@@ LanguagePrimitives.GenericOne / LanguagePrimitives.GenericOne @@>, box 1un + + <@@ 9y % 4y @@>, box 1y + <@@ 9uy % 4uy @@>, box 1uy + <@@ 9s % 4s @@>, box 1s + <@@ 9us % 4us @@>, box 1us + <@@ 9 % 4 @@>, box 1 + <@@ 9u % 4u @@>, box 1u + <@@ 9L % 4L @@>, box 1L + <@@ 9uL % 4uL @@>, box 1uL + <@@ 9.0f % 4.0f @@>, box 1f + <@@ 9.0 % 4.0 @@>, box 1. + <@@ 9m % 4m @@>, box 1m + <@@ 9m % 4m @@>, box 1m + <@@ 9I % 4I @@>, box 1I + <@@ LanguagePrimitives.GenericOne % LanguagePrimitives.GenericOne @@>, box 0n + <@@ LanguagePrimitives.GenericOne % LanguagePrimitives.GenericOne @@>, box 0un + + <@@ +(1y) @@>, box 1y + <@@ +(1uy) @@>, box 1uy + <@@ +(1s) @@>, box 1s + <@@ +(1us) @@>, box 1us + <@@ +(1) @@>, box 1 + <@@ +(1u) @@>, box 1u + <@@ +(1L) @@>, box 1L + <@@ +(1uL) @@>, box 1uL + <@@ +(1f) @@>, box 1f + <@@ +(1.) @@>, box 1. + <@@ +(1m) @@>, box 1m + <@@ +(1m) @@>, box 1m + <@@ +(1I) @@>, box 1I + <@@ +(LanguagePrimitives.GenericOne) @@>, box 1n + <@@ +(LanguagePrimitives.GenericOne) @@>, box 1un + + <@@ -(1y) @@>, box -1y + <@@ -(1s) @@>, box -1s + <@@ -(1) @@>, box -1 + <@@ -(1L) @@>, box -1L + <@@ -(1f) @@>, box -1f + <@@ -(1.) @@>, box -1. + <@@ -(1m) @@>, box -1m + <@@ -(1m) @@>, box -1m + <@@ -(1I) @@>, box -1I + <@@ -(LanguagePrimitives.GenericOne) @@>, box -1n + <@@ Checked.(~-) (1y) @@>, box -1y + <@@ Checked.(~-) (1s) @@>, box -1s + <@@ Checked.(~-) (1) @@>, box -1 + <@@ Checked.(~-) (1L) @@>, box -1L + <@@ Checked.(~-) (1f) @@>, box -1f + <@@ Checked.(~-) (1.) @@>, box -1. + <@@ Checked.(~-) (1m) @@>, box -1m + <@@ Checked.(~-) (1m) @@>, box -1m + <@@ Checked.(~-) (1I) @@>, box -1I + <@@ Checked.(~-) (LanguagePrimitives.GenericOne) @@>, box -1n + + <@@ 4f ** 3f @@>, box 64f + <@@ 4. ** 3. @@>, box 64. + <@@ 4I ** 3 @@>, box 64I + + <@@ 1y <<< 3 @@>, box 8y + <@@ 1uy <<< 3 @@>, box 8uy + <@@ 1s <<< 3 @@>, box 8s + <@@ 1us <<< 3 @@>, box 8us + <@@ 1 <<< 3 @@>, box 8 + <@@ 1u <<< 3 @@>, box 8u + <@@ 1L <<< 3 @@>, box 8L + <@@ 1UL <<< 3 @@>, box 8UL + <@@ 1I <<< 3 @@>, box 8I + <@@ LanguagePrimitives.GenericOne <<< 3 @@>, box 8n + <@@ LanguagePrimitives.GenericOne <<< 3 @@>, box 8un + + <@@ 1y >>> 3 @@>, box 0y + <@@ 1uy >>> 3 @@>, box 0uy + <@@ 1s >>> 3 @@>, box 0s + <@@ 1us >>> 3 @@>, box 0us + <@@ 1 >>> 3 @@>, box 0 + <@@ 1u >>> 3 @@>, box 0u + <@@ 1L >>> 3 @@>, box 0L + <@@ 1UL >>> 3 @@>, box 0UL + <@@ 1I >>> 3 @@>, box 0I + <@@ LanguagePrimitives.GenericOne >>> 3 @@>, box 0n + <@@ LanguagePrimitives.GenericOne >>> 3 @@>, box 0un - <@@ uint64 3uy @@>, true - <@@ uint64 3y @@>, true - <@@ uint64 3s @@>, true - <@@ uint64 3us @@>, true - <@@ uint64 3 @@>, true - <@@ uint64 3u @@>, true - <@@ uint64 3L @@>, true - <@@ uint64 3UL @@>, true - <@@ uint64 3.0f @@>, true - <@@ uint64 3.0 @@>, true - <@@ uint64 LanguagePrimitives.GenericOne @@>, false - <@@ uint64 LanguagePrimitives.GenericOne @@>, false - <@@ uint64 3.0M @@>, true - <@@ uint64 "3" @@>, false - - <@@ nativeint 3uy @@>, true - <@@ nativeint 3y @@>, true - <@@ nativeint 3s @@>, true - <@@ nativeint 3us @@>, true - <@@ nativeint 3 @@>, true - <@@ nativeint 3u @@>, true - <@@ nativeint 3L @@>, true - <@@ nativeint 3UL @@>, true - <@@ nativeint 3.0f @@>, true - <@@ nativeint 3.0 @@>, true - <@@ nativeint LanguagePrimitives.GenericOne @@>, false - <@@ nativeint LanguagePrimitives.GenericOne @@>, false - //<@@ nativeint 3.0M @@>, false - //<@@ nativeint "3" @@>, false - - <@@ unativeint 3uy @@>, true - <@@ unativeint 3y @@>, true - <@@ unativeint 3s @@>, true - <@@ unativeint 3us @@>, true - <@@ unativeint 3 @@>, true - <@@ unativeint 3u @@>, true - <@@ unativeint 3L @@>, true - <@@ unativeint 3UL @@>, true - <@@ unativeint 3.0f @@>, true - <@@ unativeint 3.0 @@>, true - <@@ unativeint LanguagePrimitives.GenericOne @@>, false - <@@ unativeint LanguagePrimitives.GenericOne @@>, false - //<@@ unativeint 3.0M @@>, true - //<@@ unativeint "3" @@>, true - - <@@ LanguagePrimitives.GenericZero @@>, true - <@@ LanguagePrimitives.GenericZero @@>, true - <@@ LanguagePrimitives.GenericZero @@>, true - <@@ LanguagePrimitives.GenericZero @@>, true - <@@ LanguagePrimitives.GenericZero @@>, true - <@@ LanguagePrimitives.GenericZero @@>, true - <@@ LanguagePrimitives.GenericOne @@>, true - <@@ LanguagePrimitives.GenericOne @@>, true - <@@ LanguagePrimitives.GenericOne @@>, true - <@@ LanguagePrimitives.GenericOne @@>, true - <@@ LanguagePrimitives.GenericOne @@>, true - <@@ LanguagePrimitives.GenericOne @@>, true - <@@ List.sum [ 1; 2 ] @@>, true - <@@ List.sum [ 1.0f; 2.0f ] @@>, true - <@@ List.sum [ 1.0; 2.0 ] @@>, true - <@@ List.sum [ 1.0M; 2.0M ] @@>, true - <@@ List.average [ 1.0; 2.0 ] @@>, true - <@@ List.average [ 1.0f; 2.0f ] @@>, true - <@@ List.average [ 1.0M; 2.0M ] @@>, true - ] - - tests |> List.forall (fun (test, canEval) -> - if canEval then - printfn "--> checking we can evaluate %A" test - FSharp.Linq.RuntimeHelpers.LeafExpressionConverter.EvaluateQuotation test |> ignore - printfn "<-- evaluated!" - else - printfn "skipping evaluation of %A because LinqExpressionConverter can't handle it" test - printfn "checking %A" test + <@@ 1y &&& 3y @@>, box 1y + <@@ 1uy &&& 3uy @@>, box 1uy + <@@ 1s &&& 3s @@>, box 1s + <@@ 1us &&& 3us @@>, box 1us + <@@ 1 &&& 3 @@>, box 1 + <@@ 1u &&& 3u @@>, box 1u + <@@ 1L &&& 3L @@>, box 1L + <@@ 1UL &&& 3UL @@>, box 1UL + <@@ 1I &&& 3I @@>, box 1I + <@@ LanguagePrimitives.GenericOne &&& LanguagePrimitives.GenericOne @@>, box 1n + <@@ LanguagePrimitives.GenericOne &&& LanguagePrimitives.GenericOne @@>, box 1un + + <@@ 1y ||| 3y @@>, box 3y + <@@ 1uy ||| 3uy @@>, box 3uy + <@@ 1s ||| 3s @@>, box 3s + <@@ 1us ||| 3us @@>, box 3us + <@@ 1 ||| 3 @@>, box 3 + <@@ 1u ||| 3u @@>, box 3u + <@@ 1L ||| 3L @@>, box 3L + <@@ 1UL ||| 3UL @@>, box 3UL + <@@ 1I ||| 3I @@>, box 3I + <@@ LanguagePrimitives.GenericOne ||| LanguagePrimitives.GenericOne @@>, box 1n + <@@ LanguagePrimitives.GenericOne ||| LanguagePrimitives.GenericOne @@>, box 1un + + <@@ 1y ^^^ 3y @@>, box 2y + <@@ 1uy ^^^ 3uy @@>, box 2uy + <@@ 1s ^^^ 3s @@>, box 2s + <@@ 1us ^^^ 3us @@>, box 2us + <@@ 1 ^^^ 3 @@>, box 2 + <@@ 1u ^^^ 3u @@>, box 2u + <@@ 1L ^^^ 3L @@>, box 2L + <@@ 1UL ^^^ 3UL @@>, box 2UL + <@@ 1I ^^^ 3I @@>, box 2I + <@@ LanguagePrimitives.GenericOne ^^^ LanguagePrimitives.GenericOne @@>, box 0n + <@@ LanguagePrimitives.GenericOne ^^^ LanguagePrimitives.GenericOne @@>, box 0un + + <@@ ~~~3y @@>, box -4y + <@@ ~~~3uy @@>, box 252uy + <@@ ~~~3s @@>, box -4s + <@@ ~~~3us @@>, box 65532us + <@@ ~~~3 @@>, box -4 + <@@ ~~~3u @@>, box 4294967292u + <@@ ~~~3L @@>, box -4L + <@@ ~~~3UL @@>, box 18446744073709551612UL + <@@ ~~~LanguagePrimitives.GenericOne @@>, box ~~~1n + <@@ ~~~LanguagePrimitives.GenericOne @@>, box ~~~1un + + <@@ byte 3uy @@>, box 3uy + <@@ byte 3y @@>, box 3uy + <@@ byte 3s @@>, box 3uy + <@@ byte 3us @@>, box 3uy + <@@ byte 3 @@>, box 3uy + <@@ byte 3u @@>, box 3uy + <@@ byte 3L @@>, box 3uy + <@@ byte 3UL @@>, box 3uy + <@@ byte '\003' @@>, box 3uy + <@@ byte 3.0f @@>, box 3uy + <@@ byte 3.0 @@>, box 3uy + <@@ byte 3.0 @@>, box 3uy + <@@ byte 3I @@>, box 3uy + <@@ byte LanguagePrimitives.GenericOne @@>, box 1uy + <@@ byte LanguagePrimitives.GenericOne @@>, box 1uy + <@@ byte 3.0M @@>, box 3uy + <@@ byte "3" @@>, box 3uy + <@@ uint8 3uy @@>, box 3uy + <@@ uint8 3y @@>, box 3uy + <@@ uint8 3s @@>, box 3uy + <@@ uint8 3us @@>, box 3uy + <@@ uint8 3 @@>, box 3uy + <@@ uint8 3u @@>, box 3uy + <@@ uint8 3L @@>, box 3uy + <@@ uint8 3UL @@>, box 3uy + <@@ uint8 '\003' @@>, box 3uy + <@@ uint8 3.0f @@>, box 3uy + <@@ uint8 3.0 @@>, box 3uy + <@@ uint8 3.0 @@>, box 3uy + <@@ uint8 3I @@>, box 3uy + <@@ uint8 LanguagePrimitives.GenericOne @@>, box 1uy + <@@ uint8 LanguagePrimitives.GenericOne @@>, box 1uy + <@@ uint8 3.0M @@>, box 3uy + <@@ uint8 "3" @@>, box 3uy + <@@ Checked.byte 3uy @@>, box 3uy + <@@ Checked.byte 3y @@>, box 3uy + <@@ Checked.byte 3s @@>, box 3uy + <@@ Checked.byte 3us @@>, box 3uy + <@@ Checked.byte 3 @@>, box 3uy + <@@ Checked.byte 3u @@>, box 3uy + <@@ Checked.byte 3L @@>, box 3uy + <@@ Checked.byte 3UL @@>, box 3uy + <@@ Checked.byte '\003' @@>, box 3uy + <@@ Checked.byte 3.0f @@>, box 3uy + <@@ Checked.byte 3.0 @@>, box 3uy + <@@ Checked.byte 3.0 @@>, box 3uy + <@@ Checked.byte 3I @@>, box 3uy + <@@ Checked.byte LanguagePrimitives.GenericOne @@>, box 1uy + <@@ Checked.byte LanguagePrimitives.GenericOne @@>, box 1uy + <@@ Checked.byte 3.0M @@>, box 3uy + <@@ Checked.byte "3" @@>, box 3uy + <@@ Checked.uint8 3uy @@>, box 3uy + <@@ Checked.uint8 3y @@>, box 3uy + <@@ Checked.uint8 3s @@>, box 3uy + <@@ Checked.uint8 3us @@>, box 3uy + <@@ Checked.uint8 3 @@>, box 3uy + <@@ Checked.uint8 3u @@>, box 3uy + <@@ Checked.uint8 3L @@>, box 3uy + <@@ Checked.uint8 3UL @@>, box 3uy + <@@ Checked.uint8 '\003' @@>, box 3uy + <@@ Checked.uint8 3.0f @@>, box 3uy + <@@ Checked.uint8 3.0 @@>, box 3uy + <@@ Checked.uint8 3.0 @@>, box 3uy + <@@ Checked.uint8 3I @@>, box 3uy + <@@ Checked.uint8 LanguagePrimitives.GenericOne @@>, box 1uy + <@@ Checked.uint8 LanguagePrimitives.GenericOne @@>, box 1uy + <@@ Checked.uint8 3.0M @@>, box 3uy + <@@ Checked.uint8 "3" @@>, box 3uy + + <@@ sbyte 3uy @@>, box 3y + <@@ sbyte 3y @@>, box 3y + <@@ sbyte 3s @@>, box 3y + <@@ sbyte 3us @@>, box 3y + <@@ sbyte 3 @@>, box 3y + <@@ sbyte 3u @@>, box 3y + <@@ sbyte 3L @@>, box 3y + <@@ sbyte 3UL @@>, box 3y + <@@ sbyte '\003' @@>, box 3y + <@@ sbyte 3.0f @@>, box 3y + <@@ sbyte 3.0 @@>, box 3y + <@@ sbyte 3.0 @@>, box 3y + <@@ sbyte 3I @@>, box 3y + <@@ sbyte LanguagePrimitives.GenericOne @@>, box 1y + <@@ sbyte LanguagePrimitives.GenericOne @@>, box 1y + <@@ sbyte 3.0M @@>, box 3y + <@@ sbyte "3" @@>, box 3y + <@@ int8 3uy @@>, box 3y + <@@ int8 3y @@>, box 3y + <@@ int8 3s @@>, box 3y + <@@ int8 3us @@>, box 3y + <@@ int8 3 @@>, box 3y + <@@ int8 3u @@>, box 3y + <@@ int8 3L @@>, box 3y + <@@ int8 3UL @@>, box 3y + <@@ int8 '\003' @@>, box 3y + <@@ int8 3.0f @@>, box 3y + <@@ int8 3.0 @@>, box 3y + <@@ int8 3.0 @@>, box 3y + <@@ int8 3I @@>, box 3y + <@@ int8 LanguagePrimitives.GenericOne @@>, box 1y + <@@ int8 LanguagePrimitives.GenericOne @@>, box 1y + <@@ int8 3.0M @@>, box 3y + <@@ int8 "3" @@>, box 3y + <@@ Checked.sbyte 3uy @@>, box 3y + <@@ Checked.sbyte 3y @@>, box 3y + <@@ Checked.sbyte 3s @@>, box 3y + <@@ Checked.sbyte 3us @@>, box 3y + <@@ Checked.sbyte 3 @@>, box 3y + <@@ Checked.sbyte 3u @@>, box 3y + <@@ Checked.sbyte 3L @@>, box 3y + <@@ Checked.sbyte 3UL @@>, box 3y + <@@ Checked.sbyte '\003' @@>, box 3y + <@@ Checked.sbyte 3.0f @@>, box 3y + <@@ Checked.sbyte 3.0 @@>, box 3y + <@@ Checked.sbyte 3.0 @@>, box 3y + <@@ Checked.sbyte 3I @@>, box 3y + <@@ Checked.sbyte LanguagePrimitives.GenericOne @@>, box 1y + <@@ Checked.sbyte LanguagePrimitives.GenericOne @@>, box 1y + <@@ Checked.sbyte 3.0M @@>, box 3y + <@@ Checked.sbyte "3" @@>, box 3y + <@@ Checked.int8 3uy @@>, box 3y + <@@ Checked.int8 3y @@>, box 3y + <@@ Checked.int8 3s @@>, box 3y + <@@ Checked.int8 3us @@>, box 3y + <@@ Checked.int8 3 @@>, box 3y + <@@ Checked.int8 3u @@>, box 3y + <@@ Checked.int8 3L @@>, box 3y + <@@ Checked.int8 3UL @@>, box 3y + <@@ Checked.int8 '\003' @@>, box 3y + <@@ Checked.int8 3.0f @@>, box 3y + <@@ Checked.int8 3.0 @@>, box 3y + <@@ Checked.int8 3.0 @@>, box 3y + <@@ Checked.int8 3I @@>, box 3y + <@@ Checked.int8 LanguagePrimitives.GenericOne @@>, box 1y + <@@ Checked.int8 LanguagePrimitives.GenericOne @@>, box 1y + <@@ Checked.int8 3.0M @@>, box 3y + <@@ Checked.int8 "3" @@>, box 3y + + <@@ int16 3uy @@>, box 3s + <@@ int16 3y @@>, box 3s + <@@ int16 3s @@>, box 3s + <@@ int16 3us @@>, box 3s + <@@ int16 3 @@>, box 3s + <@@ int16 3u @@>, box 3s + <@@ int16 3L @@>, box 3s + <@@ int16 3UL @@>, box 3s + <@@ int16 '\003' @@>, box 3s + <@@ int16 3.0f @@>, box 3s + <@@ int16 3.0 @@>, box 3s + <@@ int16 3.0 @@>, box 3s + <@@ int16 3I @@>, box 3s + <@@ int16 LanguagePrimitives.GenericOne @@>, box 1s + <@@ int16 LanguagePrimitives.GenericOne @@>, box 1s + <@@ int16 3.0M @@>, box 3s + <@@ int16 "3" @@>, box 3s + <@@ Checked.int16 3uy @@>, box 3s + <@@ Checked.int16 3y @@>, box 3s + <@@ Checked.int16 3s @@>, box 3s + <@@ Checked.int16 3us @@>, box 3s + <@@ Checked.int16 3 @@>, box 3s + <@@ Checked.int16 3u @@>, box 3s + <@@ Checked.int16 3L @@>, box 3s + <@@ Checked.int16 3UL @@>, box 3s + <@@ Checked.int16 '\003' @@>, box 3s + <@@ Checked.int16 3.0f @@>, box 3s + <@@ Checked.int16 3.0 @@>, box 3s + <@@ Checked.int16 3.0 @@>, box 3s + <@@ Checked.int16 3I @@>, box 3s + <@@ Checked.int16 LanguagePrimitives.GenericOne @@>, box 1s + <@@ Checked.int16 LanguagePrimitives.GenericOne @@>, box 1s + <@@ Checked.int16 3.0M @@>, box 3s + <@@ Checked.int16 "3" @@>, box 3s + + <@@ uint16 3uy @@>, box 3us + <@@ uint16 3y @@>, box 3us + <@@ uint16 3s @@>, box 3us + <@@ uint16 3us @@>, box 3us + <@@ uint16 3 @@>, box 3us + <@@ uint16 3u @@>, box 3us + <@@ uint16 3L @@>, box 3us + <@@ uint16 3UL @@>, box 3us + <@@ uint16 '\003' @@>, box 3us + <@@ uint16 3.0f @@>, box 3us + <@@ uint16 3.0 @@>, box 3us + <@@ uint16 3.0 @@>, box 3us + <@@ uint16 3I @@>, box 3us + <@@ uint16 LanguagePrimitives.GenericOne @@>, box 1us + <@@ uint16 LanguagePrimitives.GenericOne @@>, box 1us + <@@ uint16 3.0M @@>, box 3us + <@@ uint16 "3" @@>, box 3us + <@@ Checked.uint16 3uy @@>, box 3us + <@@ Checked.uint16 3y @@>, box 3us + <@@ Checked.uint16 3s @@>, box 3us + <@@ Checked.uint16 3us @@>, box 3us + <@@ Checked.uint16 3 @@>, box 3us + <@@ Checked.uint16 3u @@>, box 3us + <@@ Checked.uint16 3L @@>, box 3us + <@@ Checked.uint16 3UL @@>, box 3us + <@@ Checked.uint16 '\003' @@>, box 3us + <@@ Checked.uint16 3.0f @@>, box 3us + <@@ Checked.uint16 3.0 @@>, box 3us + <@@ Checked.uint16 3.0 @@>, box 3us + <@@ Checked.uint16 3I @@>, box 3us + <@@ Checked.uint16 LanguagePrimitives.GenericOne @@>, box 1us + <@@ Checked.uint16 LanguagePrimitives.GenericOne @@>, box 1us + <@@ Checked.uint16 3.0M @@>, box 3us + <@@ Checked.uint16 "3" @@>, box 3us + + <@@ int 3uy @@>, box 3 + <@@ int 3y @@>, box 3 + <@@ int 3s @@>, box 3 + <@@ int 3us @@>, box 3 + <@@ int 3 @@>, box 3 + <@@ int 3u @@>, box 3 + <@@ int 3L @@>, box 3 + <@@ int 3UL @@>, box 3 + <@@ int '\003' @@>, box 3 + <@@ int 3.0f @@>, box 3 + <@@ int 3.0 @@>, box 3 + <@@ int 3.0 @@>, box 3 + <@@ int 3I @@>, box 3 + <@@ int LanguagePrimitives.GenericOne @@>, box 1 + <@@ int LanguagePrimitives.GenericOne @@>, box 1 + <@@ int 3.0M @@>, box 3 + <@@ int "3" @@>, box 3 + <@@ int32 3uy @@>, box 3 + <@@ int32 3y @@>, box 3 + <@@ int32 3s @@>, box 3 + <@@ int32 3us @@>, box 3 + <@@ int32 3 @@>, box 3 + <@@ int32 3u @@>, box 3 + <@@ int32 3L @@>, box 3 + <@@ int32 3UL @@>, box 3 + <@@ int32 '\003' @@>, box 3 + <@@ int32 3.0f @@>, box 3 + <@@ int32 3.0 @@>, box 3 + <@@ int32 3.0 @@>, box 3 + <@@ int32 3I @@>, box 3 + <@@ int32 LanguagePrimitives.GenericOne @@>, box 1 + <@@ int32 LanguagePrimitives.GenericOne @@>, box 1 + <@@ int32 3.0M @@>, box 3 + <@@ int32 "3" @@>, box 3 + <@@ Checked.int 3uy @@>, box 3 + <@@ Checked.int 3y @@>, box 3 + <@@ Checked.int 3s @@>, box 3 + <@@ Checked.int 3us @@>, box 3 + <@@ Checked.int 3 @@>, box 3 + <@@ Checked.int 3u @@>, box 3 + <@@ Checked.int 3L @@>, box 3 + <@@ Checked.int 3UL @@>, box 3 + <@@ Checked.int '\003' @@>, box 3 + <@@ Checked.int 3.0f @@>, box 3 + <@@ Checked.int 3.0 @@>, box 3 + <@@ Checked.int 3.0 @@>, box 3 + <@@ Checked.int 3I @@>, box 3 + <@@ Checked.int LanguagePrimitives.GenericOne @@>, box 1 + <@@ Checked.int LanguagePrimitives.GenericOne @@>, box 1 + <@@ Checked.int 3.0M @@>, box 3 + <@@ Checked.int "3" @@>, box 3 + <@@ Checked.int32 3uy @@>, box 3 + <@@ Checked.int32 3y @@>, box 3 + <@@ Checked.int32 3s @@>, box 3 + <@@ Checked.int32 3us @@>, box 3 + <@@ Checked.int32 3 @@>, box 3 + <@@ Checked.int32 3u @@>, box 3 + <@@ Checked.int32 3L @@>, box 3 + <@@ Checked.int32 3UL @@>, box 3 + <@@ Checked.int32 '\003' @@>, box 3 + <@@ Checked.int32 3.0f @@>, box 3 + <@@ Checked.int32 3.0 @@>, box 3 + <@@ Checked.int32 3.0 @@>, box 3 + <@@ Checked.int32 3I @@>, box 3 + <@@ Checked.int32 LanguagePrimitives.GenericOne @@>, box 1 + <@@ Checked.int32 LanguagePrimitives.GenericOne @@>, box 1 + <@@ Checked.int32 3.0M @@>, box 3 + <@@ Checked.int32 "3" @@>, box 3 + + <@@ uint 3uy @@>, box 3u + <@@ uint 3y @@>, box 3u + <@@ uint 3s @@>, box 3u + <@@ uint 3us @@>, box 3u + <@@ uint 3 @@>, box 3u + <@@ uint 3u @@>, box 3u + <@@ uint 3L @@>, box 3u + <@@ uint 3UL @@>, box 3u + <@@ uint '\003' @@>, box 3u + <@@ uint 3.0f @@>, box 3u + <@@ uint 3.0 @@>, box 3u + <@@ uint 3.0 @@>, box 3u + <@@ uint 3I @@>, box 3u + <@@ uint LanguagePrimitives.GenericOne @@>, box 1u + <@@ uint LanguagePrimitives.GenericOne @@>, box 1u + <@@ uint 3.0M @@>, box 3u + <@@ uint "3" @@>, box 3u + <@@ uint32 3uy @@>, box 3u + <@@ uint32 3y @@>, box 3u + <@@ uint32 3s @@>, box 3u + <@@ uint32 3us @@>, box 3u + <@@ uint32 3 @@>, box 3u + <@@ uint32 3u @@>, box 3u + <@@ uint32 3L @@>, box 3u + <@@ uint32 3UL @@>, box 3u + <@@ uint32 '\003' @@>, box 3u + <@@ uint32 3.0f @@>, box 3u + <@@ uint32 3.0 @@>, box 3u + <@@ uint32 3.0 @@>, box 3u + <@@ uint32 3I @@>, box 3u + <@@ uint32 LanguagePrimitives.GenericOne @@>, box 1u + <@@ uint32 LanguagePrimitives.GenericOne @@>, box 1u + <@@ uint32 3.0M @@>, box 3u + <@@ uint32 "3" @@>, box 3u + <@@ Checked.uint32 3uy @@>, box 3u + <@@ Checked.uint32 3y @@>, box 3u + <@@ Checked.uint32 3s @@>, box 3u + <@@ Checked.uint32 3us @@>, box 3u + <@@ Checked.uint32 3 @@>, box 3u + <@@ Checked.uint32 3u @@>, box 3u + <@@ Checked.uint32 3L @@>, box 3u + <@@ Checked.uint32 3UL @@>, box 3u + <@@ Checked.uint32 '\003' @@>, box 3u + <@@ Checked.uint32 3.0f @@>, box 3u + <@@ Checked.uint32 3.0 @@>, box 3u + <@@ Checked.uint32 3.0 @@>, box 3u + <@@ Checked.uint32 3I @@>, box 3u + <@@ Checked.uint32 LanguagePrimitives.GenericOne @@>, box 1u + <@@ Checked.uint32 LanguagePrimitives.GenericOne @@>, box 1u + <@@ Checked.uint32 3.0M @@>, box 3u + <@@ Checked.uint32 "3" @@>, box 3u + + <@@ int64 3uy @@>, box 3L + <@@ int64 3y @@>, box 3L + <@@ int64 3s @@>, box 3L + <@@ int64 3us @@>, box 3L + <@@ int64 3 @@>, box 3L + <@@ int64 3u @@>, box 3L + <@@ int64 3L @@>, box 3L + <@@ int64 3UL @@>, box 3L + <@@ int64 '\003' @@>, box 3L + <@@ int64 3.0f @@>, box 3L + <@@ int64 3.0 @@>, box 3L + <@@ int64 3.0 @@>, box 3L + <@@ int64 3I @@>, box 3L + <@@ int64 LanguagePrimitives.GenericOne @@>, box 1L + <@@ int64 LanguagePrimitives.GenericOne @@>, box 1L + <@@ int64 3.0M @@>, box 3L + <@@ int64 "3" @@>, box 3L + <@@ Checked.int64 3uy @@>, box 3L + <@@ Checked.int64 3y @@>, box 3L + <@@ Checked.int64 3s @@>, box 3L + <@@ Checked.int64 3us @@>, box 3L + <@@ Checked.int64 3 @@>, box 3L + <@@ Checked.int64 3u @@>, box 3L + <@@ Checked.int64 3L @@>, box 3L + <@@ Checked.int64 3UL @@>, box 3L + <@@ Checked.int64 '\003' @@>, box 3L + <@@ Checked.int64 3.0f @@>, box 3L + <@@ Checked.int64 3.0 @@>, box 3L + <@@ Checked.int64 3.0 @@>, box 3L + <@@ Checked.int64 3I @@>, box 3L + <@@ Checked.int64 LanguagePrimitives.GenericOne @@>, box 1L + <@@ Checked.int64 LanguagePrimitives.GenericOne @@>, box 1L + <@@ Checked.int64 3.0M @@>, box 3L + <@@ Checked.int64 "3" @@>, box 3L + + <@@ uint64 3uy @@>, box 3UL + <@@ uint64 3y @@>, box 3UL + <@@ uint64 3s @@>, box 3UL + <@@ uint64 3us @@>, box 3UL + <@@ uint64 3 @@>, box 3UL + <@@ uint64 3u @@>, box 3UL + <@@ uint64 3L @@>, box 3UL + <@@ uint64 3UL @@>, box 3UL + <@@ uint64 '\003' @@>, box 3UL + <@@ uint64 3.0f @@>, box 3UL + <@@ uint64 3.0 @@>, box 3UL + <@@ uint64 3.0 @@>, box 3UL + <@@ uint64 3I @@>, box 3UL + <@@ uint64 LanguagePrimitives.GenericOne @@>, box 1UL + <@@ uint64 LanguagePrimitives.GenericOne @@>, box 1UL + <@@ uint64 3.0M @@>, box 3UL + <@@ uint64 "3" @@>, box 3UL + <@@ Checked.uint64 3uy @@>, box 3UL + <@@ Checked.uint64 3y @@>, box 3UL + <@@ Checked.uint64 3s @@>, box 3UL + <@@ Checked.uint64 3us @@>, box 3UL + <@@ Checked.uint64 3 @@>, box 3UL + <@@ Checked.uint64 3u @@>, box 3UL + <@@ Checked.uint64 3L @@>, box 3UL + <@@ Checked.uint64 3UL @@>, box 3UL + <@@ Checked.uint64 '\003' @@>, box 3UL + <@@ Checked.uint64 3.0f @@>, box 3UL + <@@ Checked.uint64 3.0 @@>, box 3UL + <@@ Checked.uint64 3.0 @@>, box 3UL + <@@ Checked.uint64 3I @@>, box 3UL + <@@ Checked.uint64 LanguagePrimitives.GenericOne @@>, box 1UL + <@@ Checked.uint64 LanguagePrimitives.GenericOne @@>, box 1UL + <@@ Checked.uint64 3.0M @@>, box 3UL + <@@ Checked.uint64 "3" @@>, box 3UL + + <@@ char 51uy @@>, box '3' + <@@ char 51y @@>, box '3' + <@@ char 51s @@>, box '3' + <@@ char 51us @@>, box '3' + <@@ char 51 @@>, box '3' + <@@ char 51u @@>, box '3' + <@@ char 51L @@>, box '3' + <@@ char 51UL @@>, box '3' + <@@ char '3' @@>, box '3' + <@@ char 51.0f @@>, box '3' + <@@ char 51.0 @@>, box '3' + <@@ char 51.0 @@>, box '3' + <@@ char LanguagePrimitives.GenericOne @@>, box '\001' + <@@ char LanguagePrimitives.GenericOne @@>, box '\001' + <@@ char 51.0M @@>, box '3' + <@@ char "3" @@>, box '3' + <@@ Checked.char 51uy @@>, box '3' + <@@ Checked.char 51y @@>, box '3' + <@@ Checked.char 51s @@>, box '3' + <@@ Checked.char 51us @@>, box '3' + <@@ Checked.char 51 @@>, box '3' + <@@ Checked.char 51u @@>, box '3' + <@@ Checked.char 51L @@>, box '3' + <@@ Checked.char 51UL @@>, box '3' + <@@ Checked.char '3' @@>, box '3' + <@@ Checked.char 51.0f @@>, box '3' + <@@ Checked.char 51.0 @@>, box '3' + <@@ Checked.char 51.0 @@>, box '3' + <@@ Checked.char LanguagePrimitives.GenericOne @@>, box '\001' + <@@ Checked.char LanguagePrimitives.GenericOne @@>, box '\001' + <@@ Checked.char 51.0M @@>, box '3' + <@@ Checked.char "3" @@>, box '3' + + <@@ nativeint 3uy @@>, box 3n + <@@ nativeint 3y @@>, box 3n + <@@ nativeint 3s @@>, box 3n + <@@ nativeint 3us @@>, box 3n + <@@ nativeint 3 @@>, box 3n + <@@ nativeint 3u @@>, box 3n + <@@ nativeint 3L @@>, box 3n + <@@ nativeint 3UL @@>, box 3n + <@@ nativeint '\003' @@>, box 3n + <@@ nativeint 3.0f @@>, box 3n + <@@ nativeint 3.0 @@>, box 3n + <@@ nativeint 3.0 @@>, box 3n + <@@ nativeint LanguagePrimitives.GenericOne @@>, box 1n + <@@ nativeint LanguagePrimitives.GenericOne @@>, box 1n + <@@ nativeint 3.0M @@>, box 3n + <@@ nativeint "3" @@>, box 3n + <@@ Checked.nativeint 3uy @@>, box 3n + <@@ Checked.nativeint 3y @@>, box 3n + <@@ Checked.nativeint 3s @@>, box 3n + <@@ Checked.nativeint 3us @@>, box 3n + <@@ Checked.nativeint 3 @@>, box 3n + <@@ Checked.nativeint 3u @@>, box 3n + <@@ Checked.nativeint 3L @@>, box 3n + <@@ Checked.nativeint 3UL @@>, box 3n + <@@ Checked.nativeint '\003' @@>, box 3n + <@@ Checked.nativeint 3.0f @@>, box 3n + <@@ Checked.nativeint 3.0 @@>, box 3n + <@@ Checked.nativeint 3.0 @@>, box 3n + <@@ Checked.nativeint LanguagePrimitives.GenericOne @@>, box 1n + <@@ Checked.nativeint LanguagePrimitives.GenericOne @@>, box 1n + <@@ Checked.nativeint 3.0M @@>, box 3n + <@@ Checked.nativeint "3" @@>, box 3n + + <@@ unativeint 3uy @@>, box 3un + <@@ unativeint 3y @@>, box 3un + <@@ unativeint 3s @@>, box 3un + <@@ unativeint 3us @@>, box 3un + <@@ unativeint 3 @@>, box 3un + <@@ unativeint 3u @@>, box 3un + <@@ unativeint 3L @@>, box 3un + <@@ unativeint 3UL @@>, box 3un + <@@ unativeint '\003' @@>, box 3un + <@@ unativeint 3.0f @@>, box 3un + <@@ unativeint 3.0 @@>, box 3un + <@@ unativeint 3.0 @@>, box 3un + <@@ unativeint LanguagePrimitives.GenericOne @@>, box 1un + <@@ unativeint LanguagePrimitives.GenericOne @@>, box 1un + <@@ unativeint 3.0M @@>, box 3un + <@@ unativeint "3" @@>, box 3un + <@@ Checked.unativeint 3uy @@>, box 3un + <@@ Checked.unativeint 3y @@>, box 3un + <@@ Checked.unativeint 3s @@>, box 3un + <@@ Checked.unativeint 3us @@>, box 3un + <@@ Checked.unativeint 3 @@>, box 3un + <@@ Checked.unativeint 3u @@>, box 3un + <@@ Checked.unativeint 3L @@>, box 3un + <@@ Checked.unativeint 3UL @@>, box 3un + <@@ Checked.unativeint '\003' @@>, box 3un + <@@ Checked.unativeint 3.0f @@>, box 3un + <@@ Checked.unativeint 3.0 @@>, box 3un + <@@ Checked.unativeint 3.0 @@>, box 3un + <@@ Checked.unativeint LanguagePrimitives.GenericOne @@>, box 1un + <@@ Checked.unativeint LanguagePrimitives.GenericOne @@>, box 1un + <@@ Checked.unativeint 3.0M @@>, box 3un + <@@ Checked.unativeint "3" @@>, box 3un + + <@@ single 3uy @@>, box 3f + <@@ single 3y @@>, box 3f + <@@ single 3s @@>, box 3f + <@@ single 3us @@>, box 3f + <@@ single 3 @@>, box 3f + <@@ single 3u @@>, box 3f + <@@ single 3L @@>, box 3f + <@@ single 3UL @@>, box 3f + <@@ single '\003' @@>, box 3f + <@@ single 3.0f @@>, box 3f + <@@ single 3.0 @@>, box 3f + <@@ single 3.0 @@>, box 3f + <@@ single 3I @@>, box 3f + <@@ single LanguagePrimitives.GenericOne @@>, box 1f + <@@ single LanguagePrimitives.GenericOne @@>, box 1f + <@@ single 3.0M @@>, box 3f + <@@ single "3" @@>, box 3f + <@@ float32 3uy @@>, box 3f + <@@ float32 3y @@>, box 3f + <@@ float32 3s @@>, box 3f + <@@ float32 3us @@>, box 3f + <@@ float32 3 @@>, box 3f + <@@ float32 3u @@>, box 3f + <@@ float32 3L @@>, box 3f + <@@ float32 3UL @@>, box 3f + <@@ float32 '\003' @@>, box 3f + <@@ float32 3.0f @@>, box 3f + <@@ float32 3.0 @@>, box 3f + <@@ float32 3.0 @@>, box 3f + <@@ float32 3I @@>, box 3f + <@@ float32 LanguagePrimitives.GenericOne @@>, box 1f + <@@ float32 LanguagePrimitives.GenericOne @@>, box 1f + <@@ float32 3.0M @@>, box 3f + <@@ float32 "3" @@>, box 3f + + <@@ double 3uy @@>, box 3. + <@@ double 3y @@>, box 3. + <@@ double 3s @@>, box 3. + <@@ double 3us @@>, box 3. + <@@ double 3 @@>, box 3. + <@@ double 3u @@>, box 3. + <@@ double 3L @@>, box 3. + <@@ double 3UL @@>, box 3. + <@@ double '\003' @@>, box 3. + <@@ double 3.0f @@>, box 3. + <@@ double 3.0 @@>, box 3. + <@@ double 3.0 @@>, box 3. + <@@ double 3I @@>, box 3. + <@@ double LanguagePrimitives.GenericOne @@>, box 1. + <@@ double LanguagePrimitives.GenericOne @@>, box 1. + <@@ double 3.0M @@>, box 3. + <@@ double "3" @@>, box 3. + <@@ float 3uy @@>, box 3. + <@@ float 3y @@>, box 3. + <@@ float 3s @@>, box 3. + <@@ float 3us @@>, box 3. + <@@ float 3 @@>, box 3. + <@@ float 3u @@>, box 3. + <@@ float 3L @@>, box 3. + <@@ float 3UL @@>, box 3. + <@@ float '\003' @@>, box 3. + <@@ float 3.0f @@>, box 3. + <@@ float 3.0 @@>, box 3. + <@@ float 3.0 @@>, box 3. + <@@ float 3I @@>, box 3. + <@@ float LanguagePrimitives.GenericOne @@>, box 1. + <@@ float LanguagePrimitives.GenericOne @@>, box 1. + <@@ float 3.0M @@>, box 3. + <@@ float "3" @@>, box 3. + + <@@ decimal 3uy @@>, box 3m + <@@ decimal 3y @@>, box 3m + <@@ decimal 3s @@>, box 3m + <@@ decimal 3us @@>, box 3m + <@@ decimal 3 @@>, box 3m + <@@ decimal 3u @@>, box 3m + <@@ decimal 3L @@>, box 3m + <@@ decimal 3UL @@>, box 3m + <@@ decimal '\003' @@>, box 3m + <@@ decimal 3.0f @@>, box 3m + <@@ decimal 3.0 @@>, box 3m + <@@ decimal 3.0 @@>, box 3m + <@@ decimal 3I @@>, box 3m + <@@ decimal LanguagePrimitives.GenericOne @@>, box 1m + <@@ decimal LanguagePrimitives.GenericOne @@>, box 1m + <@@ decimal 3.0M @@>, box 3m + <@@ decimal "3" @@>, box 3m + + <@@ LanguagePrimitives.GenericZero @@>, box 0uy + <@@ LanguagePrimitives.GenericZero @@>, box 0uy + <@@ LanguagePrimitives.GenericZero @@>, box 0y + <@@ LanguagePrimitives.GenericZero @@>, box 0y + <@@ LanguagePrimitives.GenericZero @@>, box 0s + <@@ LanguagePrimitives.GenericZero @@>, box 0us + <@@ LanguagePrimitives.GenericZero @@>, box 0 + <@@ LanguagePrimitives.GenericZero @@>, box 0 + <@@ LanguagePrimitives.GenericZero @@>, box 0u + <@@ LanguagePrimitives.GenericZero @@>, box 0u + <@@ LanguagePrimitives.GenericZero @@>, box 0L + <@@ LanguagePrimitives.GenericZero @@>, box 0UL + <@@ LanguagePrimitives.GenericZero @@>, box 0I + <@@ LanguagePrimitives.GenericZero @@>, box '\000' + <@@ LanguagePrimitives.GenericZero @@>, box 0n + <@@ LanguagePrimitives.GenericZero @@>, box 0un + <@@ LanguagePrimitives.GenericZero @@>, box 0f + <@@ LanguagePrimitives.GenericZero @@>, box 0. + <@@ LanguagePrimitives.GenericZero @@>, box 0m + <@@ LanguagePrimitives.GenericZero> @@>, box 0m + + <@@ LanguagePrimitives.GenericOne @@>, box 1uy + <@@ LanguagePrimitives.GenericOne @@>, box 1uy + <@@ LanguagePrimitives.GenericOne @@>, box 1y + <@@ LanguagePrimitives.GenericOne @@>, box 1y + <@@ LanguagePrimitives.GenericOne @@>, box 1s + <@@ LanguagePrimitives.GenericOne @@>, box 1us + <@@ LanguagePrimitives.GenericOne @@>, box 1 + <@@ LanguagePrimitives.GenericOne @@>, box 1 + <@@ LanguagePrimitives.GenericOne @@>, box 1u + <@@ LanguagePrimitives.GenericOne @@>, box 1u + <@@ LanguagePrimitives.GenericOne @@>, box 1L + <@@ LanguagePrimitives.GenericOne @@>, box 1UL + <@@ LanguagePrimitives.GenericOne @@>, box 1I + <@@ LanguagePrimitives.GenericOne @@>, box '\001' + <@@ LanguagePrimitives.GenericOne @@>, box 1n + <@@ LanguagePrimitives.GenericOne @@>, box 1un + <@@ LanguagePrimitives.GenericOne @@>, box 1f + <@@ LanguagePrimitives.GenericOne @@>, box 1. + <@@ LanguagePrimitives.GenericOne @@>, box 1m + //<@@ LanguagePrimitives.GenericOne> @@>, box 1m // Doesn't typecheck + + <@@ List.sum [ 1; 2 ] @@>, box 3 + <@@ List.sum [ 1I; 2I ] @@>, box 3I + <@@ List.sum [ 1.0f; 2.0f ] @@>, box 3f + <@@ List.sum [ 1.0; 2.0 ] @@>, box 3. + <@@ List.sum [ 1.0M; 2.0M ] @@>, box 3m + <@@ List.sum [ 1.0M; 2.0M ] @@>, box 3m + <@@ List.average [ 1.0; 2.0 ] @@>, box 1.5 + <@@ List.average [ 1.0f; 2.0f ] @@>, box 1.5f + <@@ List.average [ 1.0M; 2.0M ] @@>, box 1.5m + <@@ List.average [ 1.0M; 2.0M ] @@>, box 1.5m + + <@@ Nullable.byte (Nullable<_> 3uy) @@>, box 3uy + <@@ Nullable.byte (Nullable<_> 3y) @@>, box 3uy + <@@ Nullable.byte (Nullable<_> 3s) @@>, box 3uy + <@@ Nullable.byte (Nullable<_> 3us) @@>, box 3uy + <@@ Nullable.byte (Nullable<_> 3) @@>, box 3uy + <@@ Nullable.byte (Nullable<_> 3u) @@>, box 3uy + <@@ Nullable.byte (Nullable<_> 3L) @@>, box 3uy + <@@ Nullable.byte (Nullable<_> 3UL) @@>, box 3uy + <@@ Nullable.byte (Nullable<_> '\003') @@>, box 3uy + <@@ Nullable.byte (Nullable<_> 3.0f) @@>, box 3uy + <@@ Nullable.byte (Nullable<_> 3.0) @@>, box 3uy + <@@ Nullable.byte (Nullable<_> 3.0) @@>, box 3uy + <@@ Nullable.byte (Nullable<_> 3I) @@>, box 3uy + <@@ Nullable.byte (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1uy + <@@ Nullable.byte (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1uy + <@@ Nullable.byte (Nullable<_> 3.0M) @@>, box 3uy + <@@ Nullable.uint8 (Nullable<_> 3uy) @@>, box 3uy + <@@ Nullable.uint8 (Nullable<_> 3y) @@>, box 3uy + <@@ Nullable.uint8 (Nullable<_> 3s) @@>, box 3uy + <@@ Nullable.uint8 (Nullable<_> 3us) @@>, box 3uy + <@@ Nullable.uint8 (Nullable<_> 3) @@>, box 3uy + <@@ Nullable.uint8 (Nullable<_> 3u) @@>, box 3uy + <@@ Nullable.uint8 (Nullable<_> 3L) @@>, box 3uy + <@@ Nullable.uint8 (Nullable<_> 3UL) @@>, box 3uy + <@@ Nullable.uint8 (Nullable<_> '\003') @@>, box 3uy + <@@ Nullable.uint8 (Nullable<_> 3.0f) @@>, box 3uy + <@@ Nullable.uint8 (Nullable<_> 3.0) @@>, box 3uy + <@@ Nullable.uint8 (Nullable<_> 3.0) @@>, box 3uy + <@@ Nullable.uint8 (Nullable<_> 3I) @@>, box 3uy + <@@ Nullable.uint8 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1uy + <@@ Nullable.uint8 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1uy + <@@ Nullable.uint8 (Nullable<_> 3.0M) @@>, box 3uy + + <@@ Nullable.sbyte (Nullable<_> 3uy) @@>, box 3y + <@@ Nullable.sbyte (Nullable<_> 3y) @@>, box 3y + <@@ Nullable.sbyte (Nullable<_> 3s) @@>, box 3y + <@@ Nullable.sbyte (Nullable<_> 3us) @@>, box 3y + <@@ Nullable.sbyte (Nullable<_> 3) @@>, box 3y + <@@ Nullable.sbyte (Nullable<_> 3u) @@>, box 3y + <@@ Nullable.sbyte (Nullable<_> 3L) @@>, box 3y + <@@ Nullable.sbyte (Nullable<_> 3UL) @@>, box 3y + <@@ Nullable.sbyte (Nullable<_> '\003') @@>, box 3y + <@@ Nullable.sbyte (Nullable<_> 3.0f) @@>, box 3y + <@@ Nullable.sbyte (Nullable<_> 3.0) @@>, box 3y + <@@ Nullable.sbyte (Nullable<_> 3.0) @@>, box 3y + <@@ Nullable.sbyte (Nullable<_> 3I) @@>, box 3y + <@@ Nullable.sbyte (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1y + <@@ Nullable.sbyte (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1y + <@@ Nullable.sbyte (Nullable<_> 3.0M) @@>, box 3y + <@@ Nullable.int8 (Nullable<_> 3uy) @@>, box 3y + <@@ Nullable.int8 (Nullable<_> 3y) @@>, box 3y + <@@ Nullable.int8 (Nullable<_> 3s) @@>, box 3y + <@@ Nullable.int8 (Nullable<_> 3us) @@>, box 3y + <@@ Nullable.int8 (Nullable<_> 3) @@>, box 3y + <@@ Nullable.int8 (Nullable<_> 3u) @@>, box 3y + <@@ Nullable.int8 (Nullable<_> 3L) @@>, box 3y + <@@ Nullable.int8 (Nullable<_> 3UL) @@>, box 3y + <@@ Nullable.int8 (Nullable<_> '\003') @@>, box 3y + <@@ Nullable.int8 (Nullable<_> 3.0f) @@>, box 3y + <@@ Nullable.int8 (Nullable<_> 3.0) @@>, box 3y + <@@ Nullable.int8 (Nullable<_> 3.0) @@>, box 3y + <@@ Nullable.int8 (Nullable<_> 3I) @@>, box 3y + <@@ Nullable.int8 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1y + <@@ Nullable.int8 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1y + <@@ Nullable.int8 (Nullable<_> 3.0M) @@>, box 3y + + <@@ Nullable.int16 (Nullable<_> 3uy) @@>, box 3s + <@@ Nullable.int16 (Nullable<_> 3y) @@>, box 3s + <@@ Nullable.int16 (Nullable<_> 3s) @@>, box 3s + <@@ Nullable.int16 (Nullable<_> 3us) @@>, box 3s + <@@ Nullable.int16 (Nullable<_> 3) @@>, box 3s + <@@ Nullable.int16 (Nullable<_> 3u) @@>, box 3s + <@@ Nullable.int16 (Nullable<_> 3L) @@>, box 3s + <@@ Nullable.int16 (Nullable<_> 3UL) @@>, box 3s + <@@ Nullable.int16 (Nullable<_> '\003') @@>, box 3s + <@@ Nullable.int16 (Nullable<_> 3.0f) @@>, box 3s + <@@ Nullable.int16 (Nullable<_> 3.0) @@>, box 3s + <@@ Nullable.int16 (Nullable<_> 3.0) @@>, box 3s + <@@ Nullable.int16 (Nullable<_> 3I) @@>, box 3s + <@@ Nullable.int16 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1s + <@@ Nullable.int16 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1s + <@@ Nullable.int16 (Nullable<_> 3.0M) @@>, box 3s + + <@@ Nullable.uint16 (Nullable<_> 3uy) @@>, box 3us + <@@ Nullable.uint16 (Nullable<_> 3y) @@>, box 3us + <@@ Nullable.uint16 (Nullable<_> 3s) @@>, box 3us + <@@ Nullable.uint16 (Nullable<_> 3us) @@>, box 3us + <@@ Nullable.uint16 (Nullable<_> 3) @@>, box 3us + <@@ Nullable.uint16 (Nullable<_> 3u) @@>, box 3us + <@@ Nullable.uint16 (Nullable<_> 3L) @@>, box 3us + <@@ Nullable.uint16 (Nullable<_> 3UL) @@>, box 3us + <@@ Nullable.uint16 (Nullable<_> '\003') @@>, box 3us + <@@ Nullable.uint16 (Nullable<_> 3.0f) @@>, box 3us + <@@ Nullable.uint16 (Nullable<_> 3.0) @@>, box 3us + <@@ Nullable.uint16 (Nullable<_> 3.0) @@>, box 3us + <@@ Nullable.uint16 (Nullable<_> 3I) @@>, box 3us + <@@ Nullable.uint16 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1us + <@@ Nullable.uint16 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1us + <@@ Nullable.uint16 (Nullable<_> 3.0M) @@>, box 3us + + <@@ Nullable.int (Nullable<_> 3uy) @@>, box 3 + <@@ Nullable.int (Nullable<_> 3y) @@>, box 3 + <@@ Nullable.int (Nullable<_> 3s) @@>, box 3 + <@@ Nullable.int (Nullable<_> 3us) @@>, box 3 + <@@ Nullable.int (Nullable<_> 3) @@>, box 3 + <@@ Nullable.int (Nullable<_> 3u) @@>, box 3 + <@@ Nullable.int (Nullable<_> 3L) @@>, box 3 + <@@ Nullable.int (Nullable<_> 3UL) @@>, box 3 + <@@ Nullable.int (Nullable<_> '\003') @@>, box 3 + <@@ Nullable.int (Nullable<_> 3.0f) @@>, box 3 + <@@ Nullable.int (Nullable<_> 3.0) @@>, box 3 + <@@ Nullable.int (Nullable<_> 3.0) @@>, box 3 + <@@ Nullable.int (Nullable<_> 3I) @@>, box 3 + <@@ Nullable.int (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1 + <@@ Nullable.int (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1 + <@@ Nullable.int (Nullable<_> 3.0M) @@>, box 3 + <@@ Nullable.int32 (Nullable<_> 3uy) @@>, box 3 + <@@ Nullable.int32 (Nullable<_> 3y) @@>, box 3 + <@@ Nullable.int32 (Nullable<_> 3s) @@>, box 3 + <@@ Nullable.int32 (Nullable<_> 3us) @@>, box 3 + <@@ Nullable.int32 (Nullable<_> 3) @@>, box 3 + <@@ Nullable.int32 (Nullable<_> 3u) @@>, box 3 + <@@ Nullable.int32 (Nullable<_> 3L) @@>, box 3 + <@@ Nullable.int32 (Nullable<_> 3UL) @@>, box 3 + <@@ Nullable.int32 (Nullable<_> '\003') @@>, box 3 + <@@ Nullable.int32 (Nullable<_> 3.0f) @@>, box 3 + <@@ Nullable.int32 (Nullable<_> 3.0) @@>, box 3 + <@@ Nullable.int32 (Nullable<_> 3.0) @@>, box 3 + <@@ Nullable.int32 (Nullable<_> 3I) @@>, box 3 + <@@ Nullable.int32 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1 + <@@ Nullable.int32 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1 + <@@ Nullable.int32 (Nullable<_> 3.0M) @@>, box 3 + + <@@ Nullable.uint (Nullable<_> 3uy) @@>, box 3u + <@@ Nullable.uint (Nullable<_> 3y) @@>, box 3u + <@@ Nullable.uint (Nullable<_> 3s) @@>, box 3u + <@@ Nullable.uint (Nullable<_> 3us) @@>, box 3u + <@@ Nullable.uint (Nullable<_> 3) @@>, box 3u + <@@ Nullable.uint (Nullable<_> 3u) @@>, box 3u + <@@ Nullable.uint (Nullable<_> 3L) @@>, box 3u + <@@ Nullable.uint (Nullable<_> 3UL) @@>, box 3u + <@@ Nullable.uint (Nullable<_> '\003') @@>, box 3u + <@@ Nullable.uint (Nullable<_> 3.0f) @@>, box 3u + <@@ Nullable.uint (Nullable<_> 3.0) @@>, box 3u + <@@ Nullable.uint (Nullable<_> 3.0) @@>, box 3u + <@@ Nullable.uint (Nullable<_> 3I) @@>, box 3u + <@@ Nullable.uint (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1u + <@@ Nullable.uint (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1u + <@@ Nullable.uint (Nullable<_> 3.0M) @@>, box 3u + <@@ Nullable.uint32 (Nullable<_> 3uy) @@>, box 3u + <@@ Nullable.uint32 (Nullable<_> 3y) @@>, box 3u + <@@ Nullable.uint32 (Nullable<_> 3s) @@>, box 3u + <@@ Nullable.uint32 (Nullable<_> 3us) @@>, box 3u + <@@ Nullable.uint32 (Nullable<_> 3) @@>, box 3u + <@@ Nullable.uint32 (Nullable<_> 3u) @@>, box 3u + <@@ Nullable.uint32 (Nullable<_> 3L) @@>, box 3u + <@@ Nullable.uint32 (Nullable<_> 3UL) @@>, box 3u + <@@ Nullable.uint32 (Nullable<_> '\003') @@>, box 3u + <@@ Nullable.uint32 (Nullable<_> 3.0f) @@>, box 3u + <@@ Nullable.uint32 (Nullable<_> 3.0) @@>, box 3u + <@@ Nullable.uint32 (Nullable<_> 3.0) @@>, box 3u + <@@ Nullable.uint32 (Nullable<_> 3I) @@>, box 3u + <@@ Nullable.uint32 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1u + <@@ Nullable.uint32 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1u + <@@ Nullable.uint32 (Nullable<_> 3.0M) @@>, box 3u + + <@@ Nullable.int64 (Nullable<_> 3uy) @@>, box 3L + <@@ Nullable.int64 (Nullable<_> 3y) @@>, box 3L + <@@ Nullable.int64 (Nullable<_> 3s) @@>, box 3L + <@@ Nullable.int64 (Nullable<_> 3us) @@>, box 3L + <@@ Nullable.int64 (Nullable<_> 3) @@>, box 3L + <@@ Nullable.int64 (Nullable<_> 3u) @@>, box 3L + <@@ Nullable.int64 (Nullable<_> 3L) @@>, box 3L + <@@ Nullable.int64 (Nullable<_> 3UL) @@>, box 3L + <@@ Nullable.int64 (Nullable<_> '\003') @@>, box 3L + <@@ Nullable.int64 (Nullable<_> 3.0f) @@>, box 3L + <@@ Nullable.int64 (Nullable<_> 3.0) @@>, box 3L + <@@ Nullable.int64 (Nullable<_> 3.0) @@>, box 3L + <@@ Nullable.int64 (Nullable<_> 3I) @@>, box 3L + <@@ Nullable.int64 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1L + <@@ Nullable.int64 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1L + <@@ Nullable.int64 (Nullable<_> 3.0M) @@>, box 3L + + <@@ Nullable.uint64 (Nullable<_> 3uy) @@>, box 3UL + <@@ Nullable.uint64 (Nullable<_> 3y) @@>, box 3UL + <@@ Nullable.uint64 (Nullable<_> 3s) @@>, box 3UL + <@@ Nullable.uint64 (Nullable<_> 3us) @@>, box 3UL + <@@ Nullable.uint64 (Nullable<_> 3) @@>, box 3UL + <@@ Nullable.uint64 (Nullable<_> 3u) @@>, box 3UL + <@@ Nullable.uint64 (Nullable<_> 3L) @@>, box 3UL + <@@ Nullable.uint64 (Nullable<_> 3UL) @@>, box 3UL + <@@ Nullable.uint64 (Nullable<_> '\003') @@>, box 3UL + <@@ Nullable.uint64 (Nullable<_> 3.0f) @@>, box 3UL + <@@ Nullable.uint64 (Nullable<_> 3.0) @@>, box 3UL + <@@ Nullable.uint64 (Nullable<_> 3.0) @@>, box 3UL + <@@ Nullable.uint64 (Nullable<_> 3I) @@>, box 3UL + <@@ Nullable.uint64 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1UL + <@@ Nullable.uint64 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1UL + <@@ Nullable.uint64 (Nullable<_> 3.0M) @@>, box 3UL + + <@@ Nullable.char (Nullable<_> 51uy) @@>, box '3' + <@@ Nullable.char (Nullable<_> 51y) @@>, box '3' + <@@ Nullable.char (Nullable<_> 51s) @@>, box '3' + <@@ Nullable.char (Nullable<_> 51us) @@>, box '3' + <@@ Nullable.char (Nullable<_> 51) @@>, box '3' + <@@ Nullable.char (Nullable<_> 51u) @@>, box '3' + <@@ Nullable.char (Nullable<_> 51L) @@>, box '3' + <@@ Nullable.char (Nullable<_> 51UL) @@>, box '3' + <@@ Nullable.char (Nullable<_> '3') @@>, box '3' + <@@ Nullable.char (Nullable<_> 51.0f) @@>, box '3' + <@@ Nullable.char (Nullable<_> 51.0) @@>, box '3' + <@@ Nullable.char (Nullable<_> 51.0) @@>, box '3' + <@@ Nullable.char (Nullable<_> LanguagePrimitives.GenericOne) @@>, box '\001' + <@@ Nullable.char (Nullable<_> LanguagePrimitives.GenericOne) @@>, box '\001' + <@@ Nullable.char (Nullable<_> 51.0M) @@>, box '3' + + <@@ Nullable.single (Nullable<_> 3uy) @@>, box 3f + <@@ Nullable.single (Nullable<_> 3y) @@>, box 3f + <@@ Nullable.single (Nullable<_> 3s) @@>, box 3f + <@@ Nullable.single (Nullable<_> 3us) @@>, box 3f + <@@ Nullable.single (Nullable<_> 3) @@>, box 3f + <@@ Nullable.single (Nullable<_> 3u) @@>, box 3f + <@@ Nullable.single (Nullable<_> 3L) @@>, box 3f + <@@ Nullable.single (Nullable<_> 3UL) @@>, box 3f + <@@ Nullable.single (Nullable<_> '\003') @@>, box 3f + <@@ Nullable.single (Nullable<_> 3.0f) @@>, box 3f + <@@ Nullable.single (Nullable<_> 3.0) @@>, box 3f + <@@ Nullable.single (Nullable<_> 3.0) @@>, box 3f + <@@ Nullable.single (Nullable<_> 3I) @@>, box 3f + <@@ Nullable.single (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1f + <@@ Nullable.single (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1f + <@@ Nullable.single (Nullable<_> 3.0M) @@>, box 3f + <@@ Nullable.float32 (Nullable<_> 3uy) @@>, box 3f + <@@ Nullable.float32 (Nullable<_> 3y) @@>, box 3f + <@@ Nullable.float32 (Nullable<_> 3s) @@>, box 3f + <@@ Nullable.float32 (Nullable<_> 3us) @@>, box 3f + <@@ Nullable.float32 (Nullable<_> 3) @@>, box 3f + <@@ Nullable.float32 (Nullable<_> 3u) @@>, box 3f + <@@ Nullable.float32 (Nullable<_> 3L) @@>, box 3f + <@@ Nullable.float32 (Nullable<_> 3UL) @@>, box 3f + <@@ Nullable.float32 (Nullable<_> '\003') @@>, box 3f + <@@ Nullable.float32 (Nullable<_> 3.0f) @@>, box 3f + <@@ Nullable.float32 (Nullable<_> 3.0) @@>, box 3f + <@@ Nullable.float32 (Nullable<_> 3.0) @@>, box 3f + <@@ Nullable.float32 (Nullable<_> 3I) @@>, box 3f + <@@ Nullable.float32 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1f + <@@ Nullable.float32 (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1f + <@@ Nullable.float32 (Nullable<_> 3.0M) @@>, box 3f + + <@@ Nullable.double (Nullable<_> 3uy) @@>, box 3. + <@@ Nullable.double (Nullable<_> 3y) @@>, box 3. + <@@ Nullable.double (Nullable<_> 3s) @@>, box 3. + <@@ Nullable.double (Nullable<_> 3us) @@>, box 3. + <@@ Nullable.double (Nullable<_> 3) @@>, box 3. + <@@ Nullable.double (Nullable<_> 3u) @@>, box 3. + <@@ Nullable.double (Nullable<_> 3L) @@>, box 3. + <@@ Nullable.double (Nullable<_> 3UL) @@>, box 3. + <@@ Nullable.double (Nullable<_> '\003') @@>, box 3. + <@@ Nullable.double (Nullable<_> 3.0f) @@>, box 3. + <@@ Nullable.double (Nullable<_> 3.0) @@>, box 3. + <@@ Nullable.double (Nullable<_> 3.0) @@>, box 3. + <@@ Nullable.double (Nullable<_> 3I) @@>, box 3. + <@@ Nullable.double (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1. + <@@ Nullable.double (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1. + <@@ Nullable.double (Nullable<_> 3.0M) @@>, box 3. + <@@ Nullable.float (Nullable<_> 3uy) @@>, box 3. + <@@ Nullable.float (Nullable<_> 3y) @@>, box 3. + <@@ Nullable.float (Nullable<_> 3s) @@>, box 3. + <@@ Nullable.float (Nullable<_> 3us) @@>, box 3. + <@@ Nullable.float (Nullable<_> 3) @@>, box 3. + <@@ Nullable.float (Nullable<_> 3u) @@>, box 3. + <@@ Nullable.float (Nullable<_> 3L) @@>, box 3. + <@@ Nullable.float (Nullable<_> 3UL) @@>, box 3. + <@@ Nullable.float (Nullable<_> '\003') @@>, box 3. + <@@ Nullable.float (Nullable<_> 3.0f) @@>, box 3. + <@@ Nullable.float (Nullable<_> 3.0) @@>, box 3. + <@@ Nullable.float (Nullable<_> 3.0) @@>, box 3. + <@@ Nullable.float (Nullable<_> 3I) @@>, box 3. + <@@ Nullable.float (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1. + <@@ Nullable.float (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1. + <@@ Nullable.float (Nullable<_> 3.0M) @@>, box 3. + + <@@ Nullable.decimal (Nullable<_> 3uy) @@>, box 3m + <@@ Nullable.decimal (Nullable<_> 3y) @@>, box 3m + <@@ Nullable.decimal (Nullable<_> 3s) @@>, box 3m + <@@ Nullable.decimal (Nullable<_> 3us) @@>, box 3m + <@@ Nullable.decimal (Nullable<_> 3) @@>, box 3m + <@@ Nullable.decimal (Nullable<_> 3u) @@>, box 3m + <@@ Nullable.decimal (Nullable<_> 3L) @@>, box 3m + <@@ Nullable.decimal (Nullable<_> 3UL) @@>, box 3m + <@@ Nullable.decimal (Nullable<_> '\003') @@>, box 3m + <@@ Nullable.decimal (Nullable<_> 3.0f) @@>, box 3m + <@@ Nullable.decimal (Nullable<_> 3.0) @@>, box 3m + <@@ Nullable.decimal (Nullable<_> 3.0) @@>, box 3m + <@@ Nullable.decimal (Nullable<_> 3I) @@>, box 3m + <@@ Nullable.decimal (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1m + <@@ Nullable.decimal (Nullable<_> LanguagePrimitives.GenericOne) @@>, box 1m + <@@ Nullable.decimal (Nullable<_> 3.0M) @@>, box 3m + + <@@ Nullable<_> 1y ?+ 4y @@>, box 5y + <@@ Nullable<_> 1uy ?+ 4uy @@>, box 5uy + <@@ Nullable<_> 1s ?+ 4s @@>, box 5s + <@@ Nullable<_> 1us ?+ 4us @@>, box 5us + <@@ Nullable<_> 1 ?+ 4 @@>, box 5 + <@@ Nullable<_> 1u ?+ 4u @@>, box 5u + <@@ Nullable<_> 1L ?+ 4L @@>, box 5L + <@@ Nullable<_> 1uL ?+ 4uL @@>, box 5uL + <@@ Nullable<_> 1.0f ?+ 4.0f @@>, box 5f + <@@ Nullable<_> 1.0 ?+ 4.0 @@>, box 5. + <@@ Nullable<_> 1m ?+ 4m @@>, box 5m + <@@ Nullable<_> 1m ?+ 4m @@>, box 5m + <@@ Nullable<_> 1I ?+ 4I @@>, box 5I + <@@ Nullable<_> '1' ?+ '\004' @@>, box '5' + <@@ Nullable<_> LanguagePrimitives.GenericOne ?+ LanguagePrimitives.GenericOne @@>, box 2n + <@@ Nullable<_> LanguagePrimitives.GenericOne ?+ LanguagePrimitives.GenericOne @@>, box 2un + + <@@ 1y +? Nullable<_> 4y @@>, box 5y + <@@ 1uy +? Nullable<_> 4uy @@>, box 5uy + <@@ 1s +? Nullable<_> 4s @@>, box 5s + <@@ 1us +? Nullable<_> 4us @@>, box 5us + <@@ 1 +? Nullable<_> 4 @@>, box 5 + <@@ 1u +? Nullable<_> 4u @@>, box 5u + <@@ 1L +? Nullable<_> 4L @@>, box 5L + <@@ 1uL +? Nullable<_> 4uL @@>, box 5uL + <@@ 1.0f +? Nullable<_> 4.0f @@>, box 5f + <@@ 1.0 +? Nullable<_> 4.0 @@>, box 5. + <@@ 1m +? Nullable<_> 4m @@>, box 5m + <@@ 1m +? Nullable<_> 4m @@>, box 5m + <@@ 1I +? Nullable<_> 4I @@>, box 5I + <@@ '1' +? Nullable<_> '\004' @@>, box '5' + <@@ LanguagePrimitives.GenericOne +? Nullable<_> LanguagePrimitives.GenericOne @@>, box 2n + <@@ LanguagePrimitives.GenericOne +? Nullable<_> LanguagePrimitives.GenericOne @@>, box 2un + + <@@ Nullable<_> 1y ?+? Nullable<_> 4y @@>, box 5y + <@@ Nullable<_> 1uy ?+? Nullable<_> 4uy @@>, box 5uy + <@@ Nullable<_> 1s ?+? Nullable<_> 4s @@>, box 5s + <@@ Nullable<_> 1us ?+? Nullable<_> 4us @@>, box 5us + <@@ Nullable<_> 1 ?+? Nullable<_> 4 @@>, box 5 + <@@ Nullable<_> 1u ?+? Nullable<_> 4u @@>, box 5u + <@@ Nullable<_> 1L ?+? Nullable<_> 4L @@>, box 5L + <@@ Nullable<_> 1uL ?+? Nullable<_> 4uL @@>, box 5uL + <@@ Nullable<_> 1.0f ?+? Nullable<_> 4.0f @@>, box 5f + <@@ Nullable<_> 1.0 ?+? Nullable<_> 4.0 @@>, box 5. + <@@ Nullable<_> 1m ?+? Nullable<_> 4m @@>, box 5m + <@@ Nullable<_> 1m ?+? Nullable<_> 4m @@>, box 5m + <@@ Nullable<_> 1I ?+? Nullable<_> 4I @@>, box 5I + <@@ Nullable<_> '1' ?+? Nullable<_> '\004' @@>, box '5' + <@@ Nullable<_> LanguagePrimitives.GenericOne ?+? Nullable<_> LanguagePrimitives.GenericOne @@>, box 2n + <@@ Nullable<_> LanguagePrimitives.GenericOne ?+? Nullable<_> LanguagePrimitives.GenericOne @@>, box 2un + + <@@ Nullable<_> 4y ?- 1y @@>, box 3y + <@@ Nullable<_> 4uy ?- 1uy @@>, box 3uy + <@@ Nullable<_> 4s ?- 1s @@>, box 3s + <@@ Nullable<_> 4us ?- 1us @@>, box 3us + <@@ Nullable<_> 4 ?- 1 @@>, box 3 + <@@ Nullable<_> 4u ?- 1u @@>, box 3u + <@@ Nullable<_> 4L ?- 1L @@>, box 3L + <@@ Nullable<_> 4uL ?- 1uL @@>, box 3uL + <@@ Nullable<_> 4.0f ?- 1.0f @@>, box 3f + <@@ Nullable<_> 4.0 ?- 1.0 @@>, box 3. + <@@ Nullable<_> 4m ?- 1m @@>, box 3m + <@@ Nullable<_> 4m ?- 1m @@>, box 3m + <@@ Nullable<_> 4I ?- 1I @@>, box 3I + <@@ Nullable<_> '4' ?- '\001' @@>, box '3' + <@@ Nullable<_> LanguagePrimitives.GenericOne ?- LanguagePrimitives.GenericOne @@>, box 0n + <@@ Nullable<_> LanguagePrimitives.GenericOne ?- LanguagePrimitives.GenericOne @@>, box 0un + + <@@ 4y -? Nullable<_> 1y @@>, box 3y + <@@ 4uy -? Nullable<_> 1uy @@>, box 3uy + <@@ 4s -? Nullable<_> 1s @@>, box 3s + <@@ 4us -? Nullable<_> 1us @@>, box 3us + <@@ 4 -? Nullable<_> 1 @@>, box 3 + <@@ 4u -? Nullable<_> 1u @@>, box 3u + <@@ 4L -? Nullable<_> 1L @@>, box 3L + <@@ 4uL -? Nullable<_> 1uL @@>, box 3uL + <@@ 4.0f -? Nullable<_> 1.0f @@>, box 3f + <@@ 4.0 -? Nullable<_> 1.0 @@>, box 3. + <@@ 4m -? Nullable<_> 1m @@>, box 3m + <@@ 4m -? Nullable<_> 1m @@>, box 3m + <@@ 4I -? Nullable<_> 1I @@>, box 3I + <@@ '4' -? Nullable<_> '\001' @@>, box '3' + <@@ LanguagePrimitives.GenericOne -? Nullable<_> LanguagePrimitives.GenericOne @@>, box 0n + <@@ LanguagePrimitives.GenericOne -? Nullable<_> LanguagePrimitives.GenericOne @@>, box 0un + + <@@ Nullable<_> 4y ?-? Nullable<_> 1y @@>, box 3y + <@@ Nullable<_> 4uy ?-? Nullable<_> 1uy @@>, box 3uy + <@@ Nullable<_> 4s ?-? Nullable<_> 1s @@>, box 3s + <@@ Nullable<_> 4us ?-? Nullable<_> 1us @@>, box 3us + <@@ Nullable<_> 4 ?-? Nullable<_> 1 @@>, box 3 + <@@ Nullable<_> 4u ?-? Nullable<_> 1u @@>, box 3u + <@@ Nullable<_> 4L ?-? Nullable<_> 1L @@>, box 3L + <@@ Nullable<_> 4uL ?-? Nullable<_> 1uL @@>, box 3uL + <@@ Nullable<_> 4.0f ?-? Nullable<_> 1.0f @@>, box 3f + <@@ Nullable<_> 4.0 ?-? Nullable<_> 1.0 @@>, box 3. + <@@ Nullable<_> 4m ?-? Nullable<_> 1m @@>, box 3m + <@@ Nullable<_> 4m ?-? Nullable<_> 1m @@>, box 3m + <@@ Nullable<_> 4I ?-? Nullable<_> 1I @@>, box 3I + <@@ Nullable<_> '4' ?-? Nullable<_> '\001' @@>, box '3' + <@@ Nullable<_> LanguagePrimitives.GenericOne ?-? Nullable<_> LanguagePrimitives.GenericOne @@>, box 0n + <@@ Nullable<_> LanguagePrimitives.GenericOne ?-? Nullable<_> LanguagePrimitives.GenericOne @@>, box 0un + + <@@ Nullable<_> 2y ?* 4y @@>, box 8y + <@@ Nullable<_> 2uy ?* 4uy @@>, box 8uy + <@@ Nullable<_> 2s ?* 4s @@>, box 8s + <@@ Nullable<_> 2us ?* 4us @@>, box 8us + <@@ Nullable<_> 2 ?* 4 @@>, box 8 + <@@ Nullable<_> 2u ?* 4u @@>, box 8u + <@@ Nullable<_> 2L ?* 4L @@>, box 8L + <@@ Nullable<_> 2uL ?* 4uL @@>, box 8uL + <@@ Nullable<_> 2.0f ?* 4.0f @@>, box 8f + <@@ Nullable<_> 2.0 ?* 4.0 @@>, box 8. + <@@ Nullable<_> 2m ?* 4m @@>, box 8m + <@@ Nullable<_> 2m ?* 4m @@>, box 8m + <@@ Nullable<_> 2I ?* 4I @@>, box 8I + <@@ Nullable<_> LanguagePrimitives.GenericOne ?* LanguagePrimitives.GenericOne @@>, box 1n + <@@ Nullable<_> LanguagePrimitives.GenericOne ?* LanguagePrimitives.GenericOne @@>, box 1un + + <@@ 2y *? Nullable<_> 4y @@>, box 8y + <@@ 2uy *? Nullable<_> 4uy @@>, box 8uy + <@@ 2s *? Nullable<_> 4s @@>, box 8s + <@@ 2us *? Nullable<_> 4us @@>, box 8us + <@@ 2 *? Nullable<_> 4 @@>, box 8 + <@@ 2u *? Nullable<_> 4u @@>, box 8u + <@@ 2L *? Nullable<_> 4L @@>, box 8L + <@@ 2uL *? Nullable<_> 4uL @@>, box 8uL + <@@ 2.0f *? Nullable<_> 4.0f @@>, box 8f + <@@ 2.0 *? Nullable<_> 4.0 @@>, box 8. + <@@ 2m *? Nullable<_> 4m @@>, box 8m + <@@ 2m *? Nullable<_> 4m @@>, box 8m + <@@ 2I *? Nullable<_> 4I @@>, box 8I + <@@ LanguagePrimitives.GenericOne *? Nullable<_> LanguagePrimitives.GenericOne @@>, box 1n + <@@ LanguagePrimitives.GenericOne *? Nullable<_> LanguagePrimitives.GenericOne @@>, box 1un + + <@@ Nullable<_> 2y ?*? Nullable<_> 4y @@>, box 8y + <@@ Nullable<_> 2uy ?*? Nullable<_> 4uy @@>, box 8uy + <@@ Nullable<_> 2s ?*? Nullable<_> 4s @@>, box 8s + <@@ Nullable<_> 2us ?*? Nullable<_> 4us @@>, box 8us + <@@ Nullable<_> 2 ?*? Nullable<_> 4 @@>, box 8 + <@@ Nullable<_> 2u ?*? Nullable<_> 4u @@>, box 8u + <@@ Nullable<_> 2L ?*? Nullable<_> 4L @@>, box 8L + <@@ Nullable<_> 2uL ?*? Nullable<_> 4uL @@>, box 8uL + <@@ Nullable<_> 2.0f ?*? Nullable<_> 4.0f @@>, box 8f + <@@ Nullable<_> 2.0 ?*? Nullable<_> 4.0 @@>, box 8. + <@@ Nullable<_> 2m ?*? Nullable<_> 4m @@>, box 8m + <@@ Nullable<_> 2m ?*? Nullable<_> 4m @@>, box 8m + <@@ Nullable<_> 2I ?*? Nullable<_> 4I @@>, box 8I + <@@ Nullable<_> LanguagePrimitives.GenericOne ?*? Nullable<_> LanguagePrimitives.GenericOne @@>, box 1n + <@@ Nullable<_> LanguagePrimitives.GenericOne ?*? Nullable<_> LanguagePrimitives.GenericOne @@>, box 1un + + <@@ Nullable<_> 6y ?/ 3y @@>, box 2y + <@@ Nullable<_> 6uy ?/ 3uy @@>, box 2uy + <@@ Nullable<_> 6s ?/ 3s @@>, box 2s + <@@ Nullable<_> 6us ?/ 3us @@>, box 2us + <@@ Nullable<_> 6 ?/ 3 @@>, box 2 + <@@ Nullable<_> 6u ?/ 3u @@>, box 2u + <@@ Nullable<_> 6L ?/ 3L @@>, box 2L + <@@ Nullable<_> 6uL ?/ 3uL @@>, box 2uL + <@@ Nullable<_> 6.0f ?/ 3.0f @@>, box 2f + <@@ Nullable<_> 6.0 ?/ 3.0 @@>, box 2. + <@@ Nullable<_> 6m ?/ 3m @@>, box 2m + <@@ Nullable<_> 6m ?/ 3m @@>, box 2m + <@@ Nullable<_> 6I ?/ 3I @@>, box 2I + <@@ Nullable<_> LanguagePrimitives.GenericOne ?/ LanguagePrimitives.GenericOne @@>, box 1n + <@@ Nullable<_> LanguagePrimitives.GenericOne ?/ LanguagePrimitives.GenericOne @@>, box 1un + + <@@ 6y /? Nullable<_> 3y @@>, box 2y + <@@ 6uy /? Nullable<_> 3uy @@>, box 2uy + <@@ 6s /? Nullable<_> 3s @@>, box 2s + <@@ 6us /? Nullable<_> 3us @@>, box 2us + <@@ 6 /? Nullable<_> 3 @@>, box 2 + <@@ 6u /? Nullable<_> 3u @@>, box 2u + <@@ 6L /? Nullable<_> 3L @@>, box 2L + <@@ 6uL /? Nullable<_> 3uL @@>, box 2uL + <@@ 6.0f /? Nullable<_> 3.0f @@>, box 2f + <@@ 6.0 /? Nullable<_> 3.0 @@>, box 2. + <@@ 6m /? Nullable<_> 3m @@>, box 2m + <@@ 6m /? Nullable<_> 3m @@>, box 2m + <@@ 6I /? Nullable<_> 3I @@>, box 2I + <@@ LanguagePrimitives.GenericOne /? Nullable<_> LanguagePrimitives.GenericOne @@>, box 1n + <@@ LanguagePrimitives.GenericOne /? Nullable<_> LanguagePrimitives.GenericOne @@>, box 1un + + <@@ Nullable<_> 6y ?/? Nullable<_> 3y @@>, box 2y + <@@ Nullable<_> 6uy ?/? Nullable<_> 3uy @@>, box 2uy + <@@ Nullable<_> 6s ?/? Nullable<_> 3s @@>, box 2s + <@@ Nullable<_> 6us ?/? Nullable<_> 3us @@>, box 2us + <@@ Nullable<_> 6 ?/? Nullable<_> 3 @@>, box 2 + <@@ Nullable<_> 6u ?/? Nullable<_> 3u @@>, box 2u + <@@ Nullable<_> 6L ?/? Nullable<_> 3L @@>, box 2L + <@@ Nullable<_> 6uL ?/? Nullable<_> 3uL @@>, box 2uL + <@@ Nullable<_> 6.0f ?/? Nullable<_> 3.0f @@>, box 2f + <@@ Nullable<_> 6.0 ?/? Nullable<_> 3.0 @@>, box 2. + <@@ Nullable<_> 6m ?/? Nullable<_> 3m @@>, box 2m + <@@ Nullable<_> 6m ?/? Nullable<_> 3m @@>, box 2m + <@@ Nullable<_> 6I ?/? Nullable<_> 3I @@>, box 2I + <@@ Nullable<_> LanguagePrimitives.GenericOne ?/? Nullable<_> LanguagePrimitives.GenericOne @@>, box 1n + <@@ Nullable<_> LanguagePrimitives.GenericOne ?/? Nullable<_> LanguagePrimitives.GenericOne @@>, box 1un + + <@@ Nullable<_> 9y ?% 4y @@>, box 1y + <@@ Nullable<_> 9uy ?% 4uy @@>, box 1uy + <@@ Nullable<_> 9s ?% 4s @@>, box 1s + <@@ Nullable<_> 9us ?% 4us @@>, box 1us + <@@ Nullable<_> 9 ?% 4 @@>, box 1 + <@@ Nullable<_> 9u ?% 4u @@>, box 1u + <@@ Nullable<_> 9L ?% 4L @@>, box 1L + <@@ Nullable<_> 9uL ?% 4uL @@>, box 1uL + <@@ Nullable<_> 9.0f ?% 4.0f @@>, box 1f + <@@ Nullable<_> 9.0 ?% 4.0 @@>, box 1. + <@@ Nullable<_> 9m ?% 4m @@>, box 1m + <@@ Nullable<_> 9m ?% 4m @@>, box 1m + <@@ Nullable<_> 9I ?% 4I @@>, box 1I + <@@ Nullable<_> LanguagePrimitives.GenericOne ?% LanguagePrimitives.GenericOne @@>, box 0n + <@@ Nullable<_> LanguagePrimitives.GenericOne ?% LanguagePrimitives.GenericOne @@>, box 0un + + <@@ 9y %? Nullable<_> 4y @@>, box 1y + <@@ 9uy %? Nullable<_> 4uy @@>, box 1uy + <@@ 9s %? Nullable<_> 4s @@>, box 1s + <@@ 9us %? Nullable<_> 4us @@>, box 1us + <@@ 9 %? Nullable<_> 4 @@>, box 1 + <@@ 9u %? Nullable<_> 4u @@>, box 1u + <@@ 9L %? Nullable<_> 4L @@>, box 1L + <@@ 9uL %? Nullable<_> 4uL @@>, box 1uL + <@@ 9.0f %? Nullable<_> 4.0f @@>, box 1f + <@@ 9.0 %? Nullable<_> 4.0 @@>, box 1. + <@@ 9m %? Nullable<_> 4m @@>, box 1m + <@@ 9m %? Nullable<_> 4m @@>, box 1m + <@@ 9I %? Nullable<_> 4I @@>, box 1I + <@@ LanguagePrimitives.GenericOne %? Nullable<_> LanguagePrimitives.GenericOne @@>, box 0n + <@@ LanguagePrimitives.GenericOne %? Nullable<_> LanguagePrimitives.GenericOne @@>, box 0un + + <@@ Nullable<_> 9y ?%? Nullable<_> 4y @@>, box 1y + <@@ Nullable<_> 9uy ?%? Nullable<_> 4uy @@>, box 1uy + <@@ Nullable<_> 9s ?%? Nullable<_> 4s @@>, box 1s + <@@ Nullable<_> 9us ?%? Nullable<_> 4us @@>, box 1us + <@@ Nullable<_> 9 ?%? Nullable<_> 4 @@>, box 1 + <@@ Nullable<_> 9u ?%? Nullable<_> 4u @@>, box 1u + <@@ Nullable<_> 9L ?%? Nullable<_> 4L @@>, box 1L + <@@ Nullable<_> 9uL ?%? Nullable<_> 4uL @@>, box 1uL + <@@ Nullable<_> 9.0f ?%? Nullable<_> 4.0f @@>, box 1f + <@@ Nullable<_> 9.0 ?%? Nullable<_> 4.0 @@>, box 1. + <@@ Nullable<_> 9m ?%? Nullable<_> 4m @@>, box 1m + <@@ Nullable<_> 9m ?%? Nullable<_> 4m @@>, box 1m + <@@ Nullable<_> 9I ?%? Nullable<_> 4I @@>, box 1I + <@@ Nullable<_> LanguagePrimitives.GenericOne ?%? Nullable<_> LanguagePrimitives.GenericOne @@>, box 0n + <@@ Nullable<_> LanguagePrimitives.GenericOne ?%? Nullable<_> LanguagePrimitives.GenericOne @@>, box 0un + + <@@ NonStructuralComparison.(=) 3y 3y @@>, box true + <@@ NonStructuralComparison.(=) 3uy 3uy @@>, box true + <@@ NonStructuralComparison.(=) 3s 3s @@>, box true + <@@ NonStructuralComparison.(=) 3us 3us @@>, box true + <@@ NonStructuralComparison.(=) 3 3 @@>, box true + <@@ NonStructuralComparison.(=) 3u 3u @@>, box true + <@@ NonStructuralComparison.(=) 3L 3L @@>, box true + <@@ NonStructuralComparison.(=) 3UL 3UL @@>, box true + <@@ NonStructuralComparison.(=) '3' '3' @@>, box true + <@@ NonStructuralComparison.(=) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box true + <@@ NonStructuralComparison.(=) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box true + <@@ NonStructuralComparison.(=) 3f 3f @@>, box true + <@@ NonStructuralComparison.(=) 3. 3. @@>, box true + <@@ NonStructuralComparison.(=) 3m 3m @@>, box true + <@@ NonStructuralComparison.(=) 3m 3m @@>, box true + <@@ NonStructuralComparison.(=) 3I 3I @@>, box true + <@@ NonStructuralComparison.(=) "3" "3" @@>, box true + + <@@ NonStructuralComparison.(<>) 3y 3y @@>, box false + <@@ NonStructuralComparison.(<>) 3uy 3uy @@>, box false + <@@ NonStructuralComparison.(<>) 3s 3s @@>, box false + <@@ NonStructuralComparison.(<>) 3us 3us @@>, box false + <@@ NonStructuralComparison.(<>) 3 3 @@>, box false + <@@ NonStructuralComparison.(<>) 3u 3u @@>, box false + <@@ NonStructuralComparison.(<>) 3L 3L @@>, box false + <@@ NonStructuralComparison.(<>) 3UL 3UL @@>, box false + <@@ NonStructuralComparison.(<>) '3' '3' @@>, box false + <@@ NonStructuralComparison.(<>) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box false + <@@ NonStructuralComparison.(<>) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box false + <@@ NonStructuralComparison.(<>) 3f 3f @@>, box false + <@@ NonStructuralComparison.(<>) 3. 3. @@>, box false + <@@ NonStructuralComparison.(<>) 3m 3m @@>, box false + <@@ NonStructuralComparison.(<>) 3m 3m @@>, box false + <@@ NonStructuralComparison.(<>) 3I 3I @@>, box false + <@@ NonStructuralComparison.(<>) "3" "3" @@>, box false + + <@@ NonStructuralComparison.(<=) 3y 3y @@>, box true + <@@ NonStructuralComparison.(<=) 3uy 3uy @@>, box true + <@@ NonStructuralComparison.(<=) 3s 3s @@>, box true + <@@ NonStructuralComparison.(<=) 3us 3us @@>, box true + <@@ NonStructuralComparison.(<=) 3 3 @@>, box true + <@@ NonStructuralComparison.(<=) 3u 3u @@>, box true + <@@ NonStructuralComparison.(<=) 3L 3L @@>, box true + <@@ NonStructuralComparison.(<=) 3UL 3UL @@>, box true + <@@ NonStructuralComparison.(<=) '3' '3' @@>, box true + <@@ NonStructuralComparison.(<=) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box true + <@@ NonStructuralComparison.(<=) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box true + <@@ NonStructuralComparison.(<=) 3f 3f @@>, box true + <@@ NonStructuralComparison.(<=) 3. 3. @@>, box true + <@@ NonStructuralComparison.(<=) 3m 3m @@>, box true + <@@ NonStructuralComparison.(<=) 3m 3m @@>, box true + <@@ NonStructuralComparison.(<=) 3I 3I @@>, box true + <@@ NonStructuralComparison.(<=) "3" "3" @@>, box true + + <@@ NonStructuralComparison.(<) 3y 3y @@>, box false + <@@ NonStructuralComparison.(<) 3uy 3uy @@>, box false + <@@ NonStructuralComparison.(<) 3s 3s @@>, box false + <@@ NonStructuralComparison.(<) 3us 3us @@>, box false + <@@ NonStructuralComparison.(<) 3 3 @@>, box false + <@@ NonStructuralComparison.(<) 3u 3u @@>, box false + <@@ NonStructuralComparison.(<) 3L 3L @@>, box false + <@@ NonStructuralComparison.(<) 3UL 3UL @@>, box false + <@@ NonStructuralComparison.(<) '3' '3' @@>, box false + <@@ NonStructuralComparison.(<) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box false + <@@ NonStructuralComparison.(<) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box false + <@@ NonStructuralComparison.(<) 3f 3f @@>, box false + <@@ NonStructuralComparison.(<) 3. 3. @@>, box false + <@@ NonStructuralComparison.(<) 3m 3m @@>, box false + <@@ NonStructuralComparison.(<) 3m 3m @@>, box false + <@@ NonStructuralComparison.(<) 3I 3I @@>, box false + <@@ NonStructuralComparison.(<) "3" "3" @@>, box false + + <@@ NonStructuralComparison.(>=) 3y 3y @@>, box true + <@@ NonStructuralComparison.(>=) 3uy 3uy @@>, box true + <@@ NonStructuralComparison.(>=) 3s 3s @@>, box true + <@@ NonStructuralComparison.(>=) 3us 3us @@>, box true + <@@ NonStructuralComparison.(>=) 3 3 @@>, box true + <@@ NonStructuralComparison.(>=) 3u 3u @@>, box true + <@@ NonStructuralComparison.(>=) 3L 3L @@>, box true + <@@ NonStructuralComparison.(>=) 3UL 3UL @@>, box true + <@@ NonStructuralComparison.(>=) '3' '3' @@>, box true + <@@ NonStructuralComparison.(>=) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box true + <@@ NonStructuralComparison.(>=) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box true + <@@ NonStructuralComparison.(>=) 3f 3f @@>, box true + <@@ NonStructuralComparison.(>=) 3. 3. @@>, box true + <@@ NonStructuralComparison.(>=) 3m 3m @@>, box true + <@@ NonStructuralComparison.(>=) 3m 3m @@>, box true + <@@ NonStructuralComparison.(>=) 3I 3I @@>, box true + <@@ NonStructuralComparison.(>=) "3" "3" @@>, box true + + <@@ NonStructuralComparison.(>) 3y 3y @@>, box false + <@@ NonStructuralComparison.(>) 3uy 3uy @@>, box false + <@@ NonStructuralComparison.(>) 3s 3s @@>, box false + <@@ NonStructuralComparison.(>) 3us 3us @@>, box false + <@@ NonStructuralComparison.(>) 3 3 @@>, box false + <@@ NonStructuralComparison.(>) 3u 3u @@>, box false + <@@ NonStructuralComparison.(>) 3L 3L @@>, box false + <@@ NonStructuralComparison.(>) 3UL 3UL @@>, box false + <@@ NonStructuralComparison.(>) '3' '3' @@>, box false + <@@ NonStructuralComparison.(>) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box false + <@@ NonStructuralComparison.(>) LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box false + <@@ NonStructuralComparison.(>) 3f 3f @@>, box false + <@@ NonStructuralComparison.(>) 3. 3. @@>, box false + <@@ NonStructuralComparison.(>) 3m 3m @@>, box false + <@@ NonStructuralComparison.(>) 3m 3m @@>, box false + <@@ NonStructuralComparison.(>) 3I 3I @@>, box false + <@@ NonStructuralComparison.(>) "3" "3" @@>, box false + |] + + tests |> Array.map (fun (test, eval) -> + begin + printfn "--> Checking we can evaluate %A" test + let res = FSharp.Linq.RuntimeHelpers.LeafExpressionConverter.EvaluateQuotation test + let b = res = eval + if b then printfn "--- Success, it is %A which is equal to %A" res eval + else printfn "!!! FAILURE, it is %A which is not equal to %A" res eval + b + end + && match test with - | CallWithWitnesses(None, minfo1, minfo2, witnessArgs, args) -> - minfo1.IsStatic && - minfo2.IsStatic && - minfo2.Name = minfo1.Name + "$W" && + | CallWithWitnesses(None, minfo1, minfo2, witnessArgs, args) -> + minfo1.IsStatic && + minfo2.IsStatic && + minfo2.Name = minfo1.Name + "$W" && (* - (printfn "checking minfo2.GetParameters().Length = %d..." (minfo2.GetParameters().Length); true) && - minfo2.GetParameters().Length = 3 && - (printfn "checking witnessArgs.Length..."; true) && - witnessArgs.Length = 1 && - (printfn "checking args.Length..."; true) && - args.Length = 2 && - (printfn "witnessArgs..."; true) && - (match witnessArgs with [ Lambda _ ] -> true | _ -> false) && - (printfn "args..."; true) && - (match args with [ _; _ ] -> true | _ -> false) - *) - true - | _ -> false)) + (printfn "checking minfo2.GetParameters().Length = %d..." (minfo2.GetParameters().Length); true) && + minfo2.GetParameters().Length = 3 && + (printfn "checking witnessArgs.Length..."; true) && + witnessArgs.Length = 1 && + (printfn "checking args.Length..."; true) && + args.Length = 2 && + (printfn "witnessArgs..."; true) && + (match witnessArgs with [ Lambda _ ] -> true | _ -> false) && + (printfn "args..."; true) && + (match args with [ _; _ ] -> true | _ -> false) + *) + (printfn "<-- Successfully checked with Quotations.Patterns.(|CallWithWitnesses|_|)"; true) + || (printfn "<-- FAILURE, failed after matching with Quotations.Patterns.(|CallWithWitnesses|_|)"; true) + | _ -> + printfn " Array.forall id) // Don't short circuit on a failed test + + test "check non-CallWithWitnesses operators" + (let tests = [| + <@@ LanguagePrimitives.PhysicalEquality [|3|] [|3|] @@>, box false + <@@ let x = [|3|] in LanguagePrimitives.PhysicalEquality x x @@>, box true + <@@ LanguagePrimitives.PhysicalEquality (seq { 3 }) (seq { 3 }) @@>, box false + <@@ let x = seq { 3 } in LanguagePrimitives.PhysicalEquality x x @@>, box true + <@@ LanguagePrimitives.PhysicalEquality (obj()) (obj()) @@>, box false + <@@ let x = obj() in LanguagePrimitives.PhysicalEquality x x @@>, box true + + <@@ 3y = 3y @@>, box true + <@@ 3uy = 3uy @@>, box true + <@@ 3s = 3s @@>, box true + <@@ 3us = 3us @@>, box true + <@@ 3 = 3 @@>, box true + <@@ 3u = 3u @@>, box true + <@@ 3L = 3L @@>, box true + <@@ 3UL = 3UL @@>, box true + <@@ '3' = '3' @@>, box true + <@@ LanguagePrimitives.GenericOne = LanguagePrimitives.GenericOne @@>, box true + <@@ LanguagePrimitives.GenericOne = LanguagePrimitives.GenericOne @@>, box true + <@@ 3f = 3f @@>, box true + <@@ 3. = 3. @@>, box true + <@@ 3m = 3m @@>, box true + <@@ 3m = 3m @@>, box true + <@@ 3I = 3I @@>, box true + <@@ "3" = "3" @@>, box true + <@@ [3] = [3] @@>, box true + <@@ [|3|] = [|3|] @@>, box true + <@@ seq { 3 } = seq { 3 } @@>, box false // Reference equality + <@@ let x = seq { 3 } in x = x @@>, box true + <@@ obj() = obj() @@>, box false + <@@ let x = obj() in x = x @@>, box true + + <@@ 3y <> 3y @@>, box false + <@@ 3uy <> 3uy @@>, box false + <@@ 3s <> 3s @@>, box false + <@@ 3us <> 3us @@>, box false + <@@ 3 <> 3 @@>, box false + <@@ 3u <> 3u @@>, box false + <@@ 3L <> 3L @@>, box false + <@@ 3UL <> 3UL @@>, box false + <@@ '3' <> '3' @@>, box false + <@@ LanguagePrimitives.GenericOne <> LanguagePrimitives.GenericOne @@>, box false + <@@ LanguagePrimitives.GenericOne <> LanguagePrimitives.GenericOne @@>, box false + <@@ 3f <> 3f @@>, box false + <@@ 3. <> 3. @@>, box false + <@@ 3m <> 3m @@>, box false + <@@ 3m <> 3m @@>, box false + <@@ 3I <> 3I @@>, box false + <@@ "3" <> "3" @@>, box false + <@@ [3] <> [3] @@>, box false + <@@ [|3|] <> [|3|] @@>, box false + <@@ seq { 3 } <> seq { 3 } @@>, box true // Reference equality + <@@ let x = seq { 3 } in x <> x @@>, box false + <@@ obj() <> obj() @@>, box true + <@@ let x = obj() in x <> x @@>, box false + + <@@ 3y <= 3y @@>, box true + <@@ 3uy <= 3uy @@>, box true + <@@ 3s <= 3s @@>, box true + <@@ 3us <= 3us @@>, box true + <@@ 3 <= 3 @@>, box true + <@@ 3u <= 3u @@>, box true + <@@ 3L <= 3L @@>, box true + <@@ 3UL <= 3UL @@>, box true + <@@ '3' <= '3' @@>, box true + <@@ LanguagePrimitives.GenericOne <= LanguagePrimitives.GenericOne @@>, box true + <@@ LanguagePrimitives.GenericOne <= LanguagePrimitives.GenericOne @@>, box true + <@@ 3f <= 3f @@>, box true + <@@ 3. <= 3. @@>, box true + <@@ 3m <= 3m @@>, box true + <@@ 3m <= 3m @@>, box true + <@@ 3I <= 3I @@>, box true + <@@ "3" <= "3" @@>, box true + <@@ [3] <= [3] @@>, box true + <@@ [|3|] <= [|3|] @@>, box true + + <@@ 3y < 3y @@>, box false + <@@ 3uy < 3uy @@>, box false + <@@ 3s < 3s @@>, box false + <@@ 3us < 3us @@>, box false + <@@ 3 < 3 @@>, box false + <@@ 3u < 3u @@>, box false + <@@ 3L < 3L @@>, box false + <@@ 3UL < 3UL @@>, box false + <@@ '3' < '3' @@>, box false + <@@ LanguagePrimitives.GenericOne < LanguagePrimitives.GenericOne @@>, box false + <@@ LanguagePrimitives.GenericOne < LanguagePrimitives.GenericOne @@>, box false + <@@ 3f < 3f @@>, box false + <@@ 3. < 3. @@>, box false + <@@ 3m < 3m @@>, box false + <@@ 3m < 3m @@>, box false + <@@ 3I < 3I @@>, box false + <@@ "3" < "3" @@>, box false + <@@ [3] < [3] @@>, box false + <@@ [|3|] < [|3|] @@>, box false + + <@@ 3y >= 3y @@>, box true + <@@ 3uy >= 3uy @@>, box true + <@@ 3s >= 3s @@>, box true + <@@ 3us >= 3us @@>, box true + <@@ 3 >= 3 @@>, box true + <@@ 3u >= 3u @@>, box true + <@@ 3L >= 3L @@>, box true + <@@ 3UL >= 3UL @@>, box true + <@@ '3' >= '3' @@>, box true + <@@ LanguagePrimitives.GenericOne >= LanguagePrimitives.GenericOne @@>, box true + <@@ LanguagePrimitives.GenericOne >= LanguagePrimitives.GenericOne @@>, box true + <@@ 3f >= 3f @@>, box true + <@@ 3. >= 3. @@>, box true + <@@ 3m >= 3m @@>, box true + <@@ 3m >= 3m @@>, box true + <@@ 3I >= 3I @@>, box true + <@@ "3" >= "3" @@>, box true + <@@ [3] >= [3] @@>, box true + <@@ [|3|] >= [|3|] @@>, box true + + <@@ 3y > 3y @@>, box false + <@@ 3uy > 3uy @@>, box false + <@@ 3s > 3s @@>, box false + <@@ 3us > 3us @@>, box false + <@@ 3 > 3 @@>, box false + <@@ 3u > 3u @@>, box false + <@@ 3L > 3L @@>, box false + <@@ 3UL > 3UL @@>, box false + <@@ '3' > '3' @@>, box false + <@@ LanguagePrimitives.GenericOne > LanguagePrimitives.GenericOne @@>, box false + <@@ LanguagePrimitives.GenericOne > LanguagePrimitives.GenericOne @@>, box false + <@@ 3f > 3f @@>, box false + <@@ 3. > 3. @@>, box false + <@@ 3m > 3m @@>, box false + <@@ 3m > 3m @@>, box false + <@@ 3I > 3I @@>, box false + <@@ "3" > "3" @@>, box false + <@@ [3] > [3] @@>, box false + <@@ [|3|] > [|3|] @@>, box false + + <@@ Nullable<_> 1y ?= 1y @@>, box true + <@@ Nullable<_> 1uy ?= 1uy @@>, box true + <@@ Nullable<_> 1s ?= 1s @@>, box true + <@@ Nullable<_> 1us ?= 1us @@>, box true + <@@ Nullable<_> 1 ?= 1 @@>, box true + <@@ Nullable<_> 1u ?= 1u @@>, box true + <@@ Nullable<_> 1L ?= 1L @@>, box true + <@@ Nullable<_> 1uL ?= 1uL @@>, box true + <@@ Nullable<_> 1.0f ?= 1.0f @@>, box true + <@@ Nullable<_> 1.0 ?= 1.0 @@>, box true + <@@ Nullable<_> 1m ?= 1m @@>, box true + <@@ Nullable<_> 1m ?= 1m @@>, box true + <@@ Nullable<_> 1I ?= 1I @@>, box true + <@@ Nullable<_> '1' ?= '1' @@>, box true + <@@ Nullable<_> LanguagePrimitives.GenericOne ?= LanguagePrimitives.GenericOne @@>, box true + <@@ Nullable<_> LanguagePrimitives.GenericOne ?= LanguagePrimitives.GenericOne @@>, box true + + <@@ 1y =? Nullable<_> 1y @@>, box true + <@@ 1uy =? Nullable<_> 1uy @@>, box true + <@@ 1s =? Nullable<_> 1s @@>, box true + <@@ 1us =? Nullable<_> 1us @@>, box true + <@@ 1 =? Nullable<_> 1 @@>, box true + <@@ 1u =? Nullable<_> 1u @@>, box true + <@@ 1L =? Nullable<_> 1L @@>, box true + <@@ 1uL =? Nullable<_> 1uL @@>, box true + <@@ 1.0f =? Nullable<_> 1.0f @@>, box true + <@@ 1.0 =? Nullable<_> 1.0 @@>, box true + <@@ 1m =? Nullable<_> 1m @@>, box true + <@@ 1m =? Nullable<_> 1m @@>, box true + <@@ 1I =? Nullable<_> 1I @@>, box true + <@@ '1' =? Nullable<_> '1' @@>, box true + <@@ LanguagePrimitives.GenericOne =? Nullable<_> LanguagePrimitives.GenericOne @@>, box true + <@@ LanguagePrimitives.GenericOne =? Nullable<_> LanguagePrimitives.GenericOne @@>, box true + + <@@ Nullable<_> 1y ?=? Nullable<_> 1y @@>, box true + <@@ Nullable<_> 1uy ?=? Nullable<_> 1uy @@>, box true + <@@ Nullable<_> 1s ?=? Nullable<_> 1s @@>, box true + <@@ Nullable<_> 1us ?=? Nullable<_> 1us @@>, box true + <@@ Nullable<_> 1 ?=? Nullable<_> 1 @@>, box true + <@@ Nullable<_> 1u ?=? Nullable<_> 1u @@>, box true + <@@ Nullable<_> 1L ?=? Nullable<_> 1L @@>, box true + <@@ Nullable<_> 1uL ?=? Nullable<_> 1uL @@>, box true + <@@ Nullable<_> 1.0f ?=? Nullable<_> 1.0f @@>, box true + <@@ Nullable<_> 1.0 ?=? Nullable<_> 1.0 @@>, box true + <@@ Nullable<_> 1m ?=? Nullable<_> 1m @@>, box true + <@@ Nullable<_> 1m ?=? Nullable<_> 1m @@>, box true + <@@ Nullable<_> 1I ?=? Nullable<_> 1I @@>, box true + <@@ Nullable<_> '1' ?=? Nullable<_> '1' @@>, box true + <@@ Nullable<_> LanguagePrimitives.GenericOne ?=? Nullable<_> LanguagePrimitives.GenericOne @@>, box true + <@@ Nullable<_> LanguagePrimitives.GenericOne ?=? Nullable<_> LanguagePrimitives.GenericOne @@>, box true + + <@@ Nullable<_> 3y ?<> 3y @@>, box false + <@@ Nullable<_> 3uy ?<> 3uy @@>, box false + <@@ Nullable<_> 3s ?<> 3s @@>, box false + <@@ Nullable<_> 3us ?<> 3us @@>, box false + <@@ Nullable<_> 3 ?<> 3 @@>, box false + <@@ Nullable<_> 3u ?<> 3u @@>, box false + <@@ Nullable<_> 3L ?<> 3L @@>, box false + <@@ Nullable<_> 3UL ?<> 3UL @@>, box false + <@@ Nullable<_> '3' ?<> '3' @@>, box false + <@@ Nullable<_> LanguagePrimitives.GenericOne ?<> LanguagePrimitives.GenericOne @@>, box false + <@@ Nullable<_> LanguagePrimitives.GenericOne ?<> LanguagePrimitives.GenericOne @@>, box false + <@@ Nullable<_> 3f ?<> 3f @@>, box false + <@@ Nullable<_> 3. ?<> 3. @@>, box false + <@@ Nullable<_> 3m ?<> 3m @@>, box false + <@@ Nullable<_> 3m ?<> 3m @@>, box false + <@@ Nullable<_> 3I ?<> 3I @@>, box false + + <@@ 3y <>? Nullable<_> 3y @@>, box false + <@@ 3uy <>? Nullable<_> 3uy @@>, box false + <@@ 3s <>? Nullable<_> 3s @@>, box false + <@@ 3us <>? Nullable<_> 3us @@>, box false + <@@ 3 <>? Nullable<_> 3 @@>, box false + <@@ 3u <>? Nullable<_> 3u @@>, box false + <@@ 3L <>? Nullable<_> 3L @@>, box false + <@@ 3UL <>? Nullable<_> 3UL @@>, box false + <@@ '3' <>? Nullable<_> '3' @@>, box false + <@@ LanguagePrimitives.GenericOne <>? Nullable<_> LanguagePrimitives.GenericOne @@>, box false + <@@ LanguagePrimitives.GenericOne <>? Nullable<_> LanguagePrimitives.GenericOne @@>, box false + <@@ 3f <>? Nullable<_> 3f @@>, box false + <@@ 3. <>? Nullable<_> 3. @@>, box false + <@@ 3m <>? Nullable<_> 3m @@>, box false + <@@ 3m <>? Nullable<_> 3m @@>, box false + <@@ 3I <>? Nullable<_> 3I @@>, box false + + <@@ Nullable<_> 3y ?<>? Nullable<_> 3y @@>, box false + <@@ Nullable<_> 3uy ?<>? Nullable<_> 3uy @@>, box false + <@@ Nullable<_> 3s ?<>? Nullable<_> 3s @@>, box false + <@@ Nullable<_> 3us ?<>? Nullable<_> 3us @@>, box false + <@@ Nullable<_> 3 ?<>? Nullable<_> 3 @@>, box false + <@@ Nullable<_> 3u ?<>? Nullable<_> 3u @@>, box false + <@@ Nullable<_> 3L ?<>? Nullable<_> 3L @@>, box false + <@@ Nullable<_> 3UL ?<>? Nullable<_> 3UL @@>, box false + <@@ Nullable<_> '3' ?<>? Nullable<_> '3' @@>, box false + <@@ Nullable<_> LanguagePrimitives.GenericOne ?<>? Nullable<_> LanguagePrimitives.GenericOne @@>, box false + <@@ Nullable<_> LanguagePrimitives.GenericOne ?<>? Nullable<_> LanguagePrimitives.GenericOne @@>, box false + <@@ Nullable<_> 3f ?<>? Nullable<_> 3f @@>, box false + <@@ Nullable<_> 3. ?<>? Nullable<_> 3. @@>, box false + <@@ Nullable<_> 3m ?<>? Nullable<_> 3m @@>, box false + <@@ Nullable<_> 3m ?<>? Nullable<_> 3m @@>, box false + <@@ Nullable<_> 3I ?<>? Nullable<_> 3I @@>, box false + + <@@ Nullable<_> 3y ?<= 3y @@>, box true + <@@ Nullable<_> 3uy ?<= 3uy @@>, box true + <@@ Nullable<_> 3s ?<= 3s @@>, box true + <@@ Nullable<_> 3us ?<= 3us @@>, box true + <@@ Nullable<_> 3 ?<= 3 @@>, box true + <@@ Nullable<_> 3u ?<= 3u @@>, box true + <@@ Nullable<_> 3L ?<= 3L @@>, box true + <@@ Nullable<_> 3UL ?<= 3UL @@>, box true + <@@ Nullable<_> '3' ?<= '3' @@>, box true + <@@ Nullable<_> LanguagePrimitives.GenericOne ?<= LanguagePrimitives.GenericOne @@>, box true + <@@ Nullable<_> LanguagePrimitives.GenericOne ?<= LanguagePrimitives.GenericOne @@>, box true + <@@ Nullable<_> 3f ?<= 3f @@>, box true + <@@ Nullable<_> 3. ?<= 3. @@>, box true + <@@ Nullable<_> 3m ?<= 3m @@>, box true + <@@ Nullable<_> 3m ?<= 3m @@>, box true + <@@ Nullable<_> 3I ?<= 3I @@>, box true + + <@@ 3y <=? Nullable<_> 3y @@>, box true + <@@ 3uy <=? Nullable<_> 3uy @@>, box true + <@@ 3s <=? Nullable<_> 3s @@>, box true + <@@ 3us <=? Nullable<_> 3us @@>, box true + <@@ 3 <=? Nullable<_> 3 @@>, box true + <@@ 3u <=? Nullable<_> 3u @@>, box true + <@@ 3L <=? Nullable<_> 3L @@>, box true + <@@ 3UL <=? Nullable<_> 3UL @@>, box true + <@@ '3' <=? Nullable<_> '3' @@>, box true + <@@ LanguagePrimitives.GenericOne <=? Nullable<_> LanguagePrimitives.GenericOne @@>, box true + <@@ LanguagePrimitives.GenericOne <=? Nullable<_> LanguagePrimitives.GenericOne @@>, box true + <@@ 3f <=? Nullable<_> 3f @@>, box true + <@@ 3. <=? Nullable<_> 3. @@>, box true + <@@ 3m <=? Nullable<_> 3m @@>, box true + <@@ 3m <=? Nullable<_> 3m @@>, box true + <@@ 3I <=? Nullable<_> 3I @@>, box true + + <@@ Nullable<_> 3y ?<=? Nullable<_> 3y @@>, box true + <@@ Nullable<_> 3uy ?<=? Nullable<_> 3uy @@>, box true + <@@ Nullable<_> 3s ?<=? Nullable<_> 3s @@>, box true + <@@ Nullable<_> 3us ?<=? Nullable<_> 3us @@>, box true + <@@ Nullable<_> 3 ?<=? Nullable<_> 3 @@>, box true + <@@ Nullable<_> 3u ?<=? Nullable<_> 3u @@>, box true + <@@ Nullable<_> 3L ?<=? Nullable<_> 3L @@>, box true + <@@ Nullable<_> 3UL ?<=? Nullable<_> 3UL @@>, box true + <@@ Nullable<_> '3' ?<=? Nullable<_> '3' @@>, box true + <@@ Nullable<_> LanguagePrimitives.GenericOne ?<=? Nullable<_> LanguagePrimitives.GenericOne @@>, box true + <@@ Nullable<_> LanguagePrimitives.GenericOne ?<=? Nullable<_> LanguagePrimitives.GenericOne @@>, box true + <@@ Nullable<_> 3f ?<=? Nullable<_> 3f @@>, box true + <@@ Nullable<_> 3. ?<=? Nullable<_> 3. @@>, box true + <@@ Nullable<_> 3m ?<=? Nullable<_> 3m @@>, box true + <@@ Nullable<_> 3m ?<=? Nullable<_> 3m @@>, box true + <@@ Nullable<_> 3I ?<=? Nullable<_> 3I @@>, box true + + <@@ Nullable<_> 3y ?< 3y @@>, box false + <@@ Nullable<_> 3uy ?< 3uy @@>, box false + <@@ Nullable<_> 3s ?< 3s @@>, box false + <@@ Nullable<_> 3us ?< 3us @@>, box false + <@@ Nullable<_> 3 ?< 3 @@>, box false + <@@ Nullable<_> 3u ?< 3u @@>, box false + <@@ Nullable<_> 3L ?< 3L @@>, box false + <@@ Nullable<_> 3UL ?< 3UL @@>, box false + <@@ Nullable<_> '3' ?< '3' @@>, box false + <@@ Nullable<_> LanguagePrimitives.GenericOne ?< LanguagePrimitives.GenericOne @@>, box false + <@@ Nullable<_> LanguagePrimitives.GenericOne ?< LanguagePrimitives.GenericOne @@>, box false + <@@ Nullable<_> 3f ?< 3f @@>, box false + <@@ Nullable<_> 3. ?< 3. @@>, box false + <@@ Nullable<_> 3m ?< 3m @@>, box false + <@@ Nullable<_> 3m ?< 3m @@>, box false + <@@ Nullable<_> 3I ?< 3I @@>, box false + + <@@ 3y 3y @@>, box false + <@@ 3uy 3uy @@>, box false + <@@ 3s 3s @@>, box false + <@@ 3us 3us @@>, box false + <@@ 3 3 @@>, box false + <@@ 3u 3u @@>, box false + <@@ 3L 3L @@>, box false + <@@ 3UL 3UL @@>, box false + <@@ '3' '3' @@>, box false + <@@ LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box false + <@@ LanguagePrimitives.GenericOne LanguagePrimitives.GenericOne @@>, box false + <@@ 3f 3f @@>, box false + <@@ 3. 3. @@>, box false + <@@ 3m 3m @@>, box false + <@@ 3m 3m @@>, box false + <@@ 3I 3I @@>, box false + + <@@ Nullable<_> 3y ? 3y @@>, box false + <@@ Nullable<_> 3uy ? 3uy @@>, box false + <@@ Nullable<_> 3s ? 3s @@>, box false + <@@ Nullable<_> 3us ? 3us @@>, box false + <@@ Nullable<_> 3 ? 3 @@>, box false + <@@ Nullable<_> 3u ? 3u @@>, box false + <@@ Nullable<_> 3L ? 3L @@>, box false + <@@ Nullable<_> 3UL ? 3UL @@>, box false + <@@ Nullable<_> '3' ? '3' @@>, box false + <@@ Nullable<_> LanguagePrimitives.GenericOne ? LanguagePrimitives.GenericOne @@>, box false + <@@ Nullable<_> LanguagePrimitives.GenericOne ? LanguagePrimitives.GenericOne @@>, box false + <@@ Nullable<_> 3f ? 3f @@>, box false + <@@ Nullable<_> 3. ? 3. @@>, box false + <@@ Nullable<_> 3m ? 3m @@>, box false + <@@ Nullable<_> 3m ? 3m @@>, box false + <@@ Nullable<_> 3I ? 3I @@>, box false + + <@@ Nullable<_> 3y ?>= 3y @@>, box true + <@@ Nullable<_> 3uy ?>= 3uy @@>, box true + <@@ Nullable<_> 3s ?>= 3s @@>, box true + <@@ Nullable<_> 3us ?>= 3us @@>, box true + <@@ Nullable<_> 3 ?>= 3 @@>, box true + <@@ Nullable<_> 3u ?>= 3u @@>, box true + <@@ Nullable<_> 3L ?>= 3L @@>, box true + <@@ Nullable<_> 3UL ?>= 3UL @@>, box true + <@@ Nullable<_> '3' ?>= '3' @@>, box true + <@@ Nullable<_> LanguagePrimitives.GenericOne ?>= LanguagePrimitives.GenericOne @@>, box true + <@@ Nullable<_> LanguagePrimitives.GenericOne ?>= LanguagePrimitives.GenericOne @@>, box true + <@@ Nullable<_> 3f ?>= 3f @@>, box true + <@@ Nullable<_> 3. ?>= 3. @@>, box true + <@@ Nullable<_> 3m ?>= 3m @@>, box true + <@@ Nullable<_> 3m ?>= 3m @@>, box true + <@@ Nullable<_> 3I ?>= 3I @@>, box true + + <@@ 3y >=? Nullable<_> 3y @@>, box true + <@@ 3uy >=? Nullable<_> 3uy @@>, box true + <@@ 3s >=? Nullable<_> 3s @@>, box true + <@@ 3us >=? Nullable<_> 3us @@>, box true + <@@ 3 >=? Nullable<_> 3 @@>, box true + <@@ 3u >=? Nullable<_> 3u @@>, box true + <@@ 3L >=? Nullable<_> 3L @@>, box true + <@@ 3UL >=? Nullable<_> 3UL @@>, box true + <@@ '3' >=? Nullable<_> '3' @@>, box true + <@@ LanguagePrimitives.GenericOne >=? Nullable<_> LanguagePrimitives.GenericOne @@>, box true + <@@ LanguagePrimitives.GenericOne >=? Nullable<_> LanguagePrimitives.GenericOne @@>, box true + <@@ 3f >=? Nullable<_> 3f @@>, box true + <@@ 3. >=? Nullable<_> 3. @@>, box true + <@@ 3m >=? Nullable<_> 3m @@>, box true + <@@ 3m >=? Nullable<_> 3m @@>, box true + <@@ 3I >=? Nullable<_> 3I @@>, box true + + <@@ Nullable<_> 3y ?>=? Nullable<_> 3y @@>, box true + <@@ Nullable<_> 3uy ?>=? Nullable<_> 3uy @@>, box true + <@@ Nullable<_> 3s ?>=? Nullable<_> 3s @@>, box true + <@@ Nullable<_> 3us ?>=? Nullable<_> 3us @@>, box true + <@@ Nullable<_> 3 ?>=? Nullable<_> 3 @@>, box true + <@@ Nullable<_> 3u ?>=? Nullable<_> 3u @@>, box true + <@@ Nullable<_> 3L ?>=? Nullable<_> 3L @@>, box true + <@@ Nullable<_> 3UL ?>=? Nullable<_> 3UL @@>, box true + <@@ Nullable<_> '3' ?>=? Nullable<_> '3' @@>, box true + <@@ Nullable<_> LanguagePrimitives.GenericOne ?>=? Nullable<_> LanguagePrimitives.GenericOne @@>, box true + <@@ Nullable<_> LanguagePrimitives.GenericOne ?>=? Nullable<_> LanguagePrimitives.GenericOne @@>, box true + <@@ Nullable<_> 3f ?>=? Nullable<_> 3f @@>, box true + <@@ Nullable<_> 3. ?>=? Nullable<_> 3. @@>, box true + <@@ Nullable<_> 3m ?>=? Nullable<_> 3m @@>, box true + <@@ Nullable<_> 3m ?>=? Nullable<_> 3m @@>, box true + <@@ Nullable<_> 3I ?>=? Nullable<_> 3I @@>, box true + + <@@ Nullable<_> 3y ?> 3y @@>, box false + <@@ Nullable<_> 3uy ?> 3uy @@>, box false + <@@ Nullable<_> 3s ?> 3s @@>, box false + <@@ Nullable<_> 3us ?> 3us @@>, box false + <@@ Nullable<_> 3 ?> 3 @@>, box false + <@@ Nullable<_> 3u ?> 3u @@>, box false + <@@ Nullable<_> 3L ?> 3L @@>, box false + <@@ Nullable<_> 3UL ?> 3UL @@>, box false + <@@ Nullable<_> '3' ?> '3' @@>, box false + <@@ Nullable<_> LanguagePrimitives.GenericOne ?> LanguagePrimitives.GenericOne @@>, box false + <@@ Nullable<_> LanguagePrimitives.GenericOne ?> LanguagePrimitives.GenericOne @@>, box false + <@@ Nullable<_> 3f ?> 3f @@>, box false + <@@ Nullable<_> 3. ?> 3. @@>, box false + <@@ Nullable<_> 3m ?> 3m @@>, box false + <@@ Nullable<_> 3m ?> 3m @@>, box false + <@@ Nullable<_> 3I ?> 3I @@>, box false + + <@@ 3y >? Nullable<_> 3y @@>, box false + <@@ 3uy >? Nullable<_> 3uy @@>, box false + <@@ 3s >? Nullable<_> 3s @@>, box false + <@@ 3us >? Nullable<_> 3us @@>, box false + <@@ 3 >? Nullable<_> 3 @@>, box false + <@@ 3u >? Nullable<_> 3u @@>, box false + <@@ 3L >? Nullable<_> 3L @@>, box false + <@@ 3UL >? Nullable<_> 3UL @@>, box false + <@@ '3' >? Nullable<_> '3' @@>, box false + <@@ LanguagePrimitives.GenericOne >? Nullable<_> LanguagePrimitives.GenericOne @@>, box false + <@@ LanguagePrimitives.GenericOne >? Nullable<_> LanguagePrimitives.GenericOne @@>, box false + <@@ 3f >? Nullable<_> 3f @@>, box false + <@@ 3. >? Nullable<_> 3. @@>, box false + <@@ 3m >? Nullable<_> 3m @@>, box false + <@@ 3m >? Nullable<_> 3m @@>, box false + <@@ 3I >? Nullable<_> 3I @@>, box false + + <@@ Nullable<_> 3y ?>? Nullable<_> 3y @@>, box false + <@@ Nullable<_> 3uy ?>? Nullable<_> 3uy @@>, box false + <@@ Nullable<_> 3s ?>? Nullable<_> 3s @@>, box false + <@@ Nullable<_> 3us ?>? Nullable<_> 3us @@>, box false + <@@ Nullable<_> 3 ?>? Nullable<_> 3 @@>, box false + <@@ Nullable<_> 3u ?>? Nullable<_> 3u @@>, box false + <@@ Nullable<_> 3L ?>? Nullable<_> 3L @@>, box false + <@@ Nullable<_> 3UL ?>? Nullable<_> 3UL @@>, box false + <@@ Nullable<_> '3' ?>? Nullable<_> '3' @@>, box false + <@@ Nullable<_> LanguagePrimitives.GenericOne ?>? Nullable<_> LanguagePrimitives.GenericOne @@>, box false + <@@ Nullable<_> LanguagePrimitives.GenericOne ?>? Nullable<_> LanguagePrimitives.GenericOne @@>, box false + <@@ Nullable<_> 3f ?>? Nullable<_> 3f @@>, box false + <@@ Nullable<_> 3. ?>? Nullable<_> 3. @@>, box false + <@@ Nullable<_> 3m ?>? Nullable<_> 3m @@>, box false + <@@ Nullable<_> 3m ?>? Nullable<_> 3m @@>, box false + <@@ Nullable<_> 3I ?>? Nullable<_> 3I @@>, box false + |] + tests |> Array.map (fun (test, eval) -> + begin + printfn "--> Checking we can evaluate %A" test + let res = FSharp.Linq.RuntimeHelpers.LeafExpressionConverter.EvaluateQuotation test + let b = res = eval + if b then printfn "--- Success, it is %A which is equal to %A" res eval + else printfn "!!! FAILURE, it is %A which is not equal to %A" res eval + b + end + && + match test with + | CallWithWitnesses(None, minfo1, minfo2, witnessArgs, args) -> + printfn " + printfn "<-- Success, it did not match Quotations.Patterns.(|CallWithWitnesses|_|)" + true) |> Array.forall id) // Don't short circuit on a failed test module MoreWitnessTests = open System.Runtime.CompilerServices diff --git a/tests/fsharp/tools/eval/test.fsx b/tests/fsharp/tools/eval/test.fsx index a289c17794a..f6a669653ce 100644 --- a/tests/fsharp/tools/eval/test.fsx +++ b/tests/fsharp/tools/eval/test.fsx @@ -1236,6 +1236,7 @@ module EvaluationTests = check "vroievr097q" (LanguagePrimitives.AdditionDynamic 3.0 4.0) 7.0 check "vroievr097w" (LanguagePrimitives.AdditionDynamic 3.0f 4.0f) 7.0f check "vroievr097e" (LanguagePrimitives.AdditionDynamic 3.0M 4.0M) 7.0M + check "vroievr097n" (LanguagePrimitives.AdditionDynamic '3' '\004') '7' check "vroievr097r" (LanguagePrimitives.CheckedAdditionDynamic 3y 4y) 7y check "vroievr097t" (LanguagePrimitives.CheckedAdditionDynamic 3s 4s) 7s @@ -1250,6 +1251,37 @@ module EvaluationTests = check "vroievr097f" (LanguagePrimitives.CheckedAdditionDynamic 3.0 4.0) 7.0 check "vroievr097g" (LanguagePrimitives.CheckedAdditionDynamic 3.0f 4.0f) 7.0f check "vroievr097h" (LanguagePrimitives.CheckedAdditionDynamic 3.0M 4.0M) 7.0M + check "vroievr097u" (LanguagePrimitives.CheckedAdditionDynamic '3' '\004') '7' + + check "vroievr0981" (LanguagePrimitives.SubtractionDynamic 7y 4y) 3y + check "vroievr0982" (LanguagePrimitives.SubtractionDynamic 7s 4s) 3s + check "vroievr0983" (LanguagePrimitives.SubtractionDynamic 7 4) 3 + check "vroievr0984" (LanguagePrimitives.SubtractionDynamic 7L 4L) 3L + check "vroievr0985" (LanguagePrimitives.SubtractionDynamic 7n 4n) 3n + check "vroievr0986" (LanguagePrimitives.SubtractionDynamic 7uy 4uy) 3uy + check "vroievr0987" (LanguagePrimitives.SubtractionDynamic 7us 4us) 3us + check "vroievr0988" (LanguagePrimitives.SubtractionDynamic 7u 4u) 3u + check "vroievr0989" (LanguagePrimitives.SubtractionDynamic 7UL 4UL) 3UL + check "vroievr0980" (LanguagePrimitives.SubtractionDynamic 7un 4un) 3un + check "vroievr098q" (LanguagePrimitives.SubtractionDynamic 7.0 4.0) 3.0 + check "vroievr098w" (LanguagePrimitives.SubtractionDynamic 7.0f 4.0f) 3.0f + check "vroievr098e" (LanguagePrimitives.SubtractionDynamic 7.0M 4.0M) 3.0M + check "vroievr098n" (LanguagePrimitives.SubtractionDynamic '7' '\004') '3' + + check "vroievr098r" (LanguagePrimitives.CheckedSubtractionDynamic 7y 4y) 3y + check "vroievr098t" (LanguagePrimitives.CheckedSubtractionDynamic 7s 4s) 3s + check "vroievr098y" (LanguagePrimitives.CheckedSubtractionDynamic 7 4) 3 + check "vroievr098u" (LanguagePrimitives.CheckedSubtractionDynamic 7L 4L) 3L + check "vroievr098i" (LanguagePrimitives.CheckedSubtractionDynamic 7n 4n) 3n + check "vroievr098o" (LanguagePrimitives.CheckedSubtractionDynamic 7uy 4uy) 3uy + check "vroievr098p" (LanguagePrimitives.CheckedSubtractionDynamic 7us 4us) 3us + check "vroievr098a" (LanguagePrimitives.CheckedSubtractionDynamic 7u 4u) 3u + check "vroievr098s" (LanguagePrimitives.CheckedSubtractionDynamic 7UL 4UL) 3UL + check "vroievr098d" (LanguagePrimitives.CheckedSubtractionDynamic 7un 4un) 3un + check "vroievr098f" (LanguagePrimitives.CheckedSubtractionDynamic 7.0 4.0) 3.0 + check "vroievr098g" (LanguagePrimitives.CheckedSubtractionDynamic 7.0f 4.0f) 3.0f + check "vroievr098h" (LanguagePrimitives.CheckedSubtractionDynamic 7.0M 4.0M) 3.0M + check "vroievr098u" (LanguagePrimitives.CheckedSubtractionDynamic '7' '\004') '3' check "vroievr0912q" (LanguagePrimitives.MultiplyDynamic 3y 4y) 12y check "vroievr0912w" (LanguagePrimitives.MultiplyDynamic 3s 4s) 12s @@ -1265,7 +1297,6 @@ module EvaluationTests = check "vroievr0912s" (LanguagePrimitives.MultiplyDynamic 3.0f 4.0f) 12.0f check "vroievr0912d" (LanguagePrimitives.MultiplyDynamic 3.0M 4.0M) 12.0M - check "vroievr0912f" (LanguagePrimitives.CheckedMultiplyDynamic 3y 4y) 12y check "vroievr0912g" (LanguagePrimitives.CheckedMultiplyDynamic 3s 4s) 12s check "vroievr0912h" (LanguagePrimitives.CheckedMultiplyDynamic 3 4) 12 diff --git a/tests/service/ExprTests.fs b/tests/service/ExprTests.fs index 05b42f7a67d..9a1f6d6bb56 100644 --- a/tests/service/ExprTests.fs +++ b/tests/service/ExprTests.fs @@ -1184,7 +1184,7 @@ let ``Test Operator Declarations for Byte`` () = [], "let testByteAdditionChecked(e1) (e2) = Checked.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),Checked.op_Addition (fun arg0_0 -> fun arg1_0 -> LanguagePrimitives.AdditionDynamic (arg0_0,arg1_0),e1,e2)) @ (24,53--24,70)" [], "let testByteSubtractionChecked(e1) (e2) = Checked.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),Checked.op_Subtraction (fun arg0_0 -> fun arg1_0 -> LanguagePrimitives.SubtractionDynamic (arg0_0,arg1_0),e1,e2)) @ (25,53--25,70)" [], "let testByteMultiplyChecked(e1) (e2) = Checked.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),Checked.op_Multiply (fun arg0_0 -> fun arg1_0 -> LanguagePrimitives.MultiplyDynamic (arg0_0,arg1_0),e1,e2)) @ (26,53--26,70)" - [], "let testByteToByteChecked(e1) = Checked.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (29,43--29,58)" + [], "let testByteToByteChecked(e1) = e1 @ (29,56--29,58)" [], "let testByteToSByteChecked(e1) = Checked.ToSByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (30,43--30,59)" [], "let testByteToInt16Checked(e1) = Checked.ToInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (31,43--31,59)" [], "let testByteToUInt16Checked(e1) = Checked.ToUInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (32,43--32,60)" @@ -1195,7 +1195,7 @@ let ``Test Operator Declarations for Byte`` () = [], "let testByteToUInt64Checked(e1) = Checked.ToUInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (37,43--37,60)" [], "let testByteToIntPtrChecked(e1) = Checked.ToIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (38,43--38,63)" [], "let testByteToUIntPtrChecked(e1) = Checked.ToUIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (39,43--39,64)" - [], "let testByteToByteOperator(e1) = Operators.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (41,43--41,50)" + [], "let testByteToByteOperator(e1) = e1 @ (41,48--41,50)" [], "let testByteToSByteOperator(e1) = Operators.ToSByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (42,43--42,51)" [], "let testByteToInt16Operator(e1) = Operators.ToInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (43,43--43,51)" [], "let testByteToUInt16Operator(e1) = Operators.ToUInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (44,43--44,52)" @@ -1296,7 +1296,7 @@ let ``Test Operator Declarations for SByte`` () = [], "let testSByteMultiplyChecked(e1) (e2) = Checked.ToSByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),Checked.op_Multiply (fun arg0_0 -> fun arg1_0 -> LanguagePrimitives.MultiplyDynamic (arg0_0,arg1_0),e1,e2)) @ (26,56--26,73)" [], "let testSByteUnaryNegChecked(e1) = Checked.op_Subtraction (fun arg0_0 -> fun arg1_0 -> LanguagePrimitives.SubtractionDynamic (arg0_0,arg1_0),0,e1) @ (27,45--27,60)" [], "let testSByteToByteChecked(e1) = Checked.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (29,45--29,60)" - [], "let testSByteToSByteChecked(e1) = Checked.ToSByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (30,45--30,61)" + [], "let testSByteToSByteChecked(e1) = e1 @ (30,59--30,61)" [], "let testSByteToInt16Checked(e1) = Checked.ToInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (31,45--31,61)" [], "let testSByteToUInt16Checked(e1) = Checked.ToUInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (32,45--32,62)" [], "let testSByteToIntChecked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (33,45--33,59)" @@ -1307,7 +1307,7 @@ let ``Test Operator Declarations for SByte`` () = [], "let testSByteToIntPtrChecked(e1) = Checked.ToIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (38,45--38,65)" [], "let testSByteToUIntPtrChecked(e1) = Checked.ToUIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (39,45--39,66)" [], "let testSByteToByteOperator(e1) = Operators.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (41,45--41,52)" - [], "let testSByteToSByteOperator(e1) = Operators.ToSByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (42,45--42,53)" + [], "let testSByteToSByteOperator(e1) = e1 @ (42,51--42,53)" [], "let testSByteToInt16Operator(e1) = Operators.ToInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (43,45--43,53)" [], "let testSByteToUInt16Operator(e1) = Operators.ToUInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (44,45--44,54)" [], "let testSByteToIntOperator(e1) = Operators.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (45,45--45,51)" @@ -1406,7 +1406,7 @@ let ``Test Operator Declarations for Int16`` () = [], "let testInt16UnaryNegChecked(e1) = Checked.op_Subtraction (fun arg0_0 -> fun arg1_0 -> LanguagePrimitives.SubtractionDynamic (arg0_0,arg1_0),0,e1) @ (27,45--27,60)" [], "let testInt16ToByteChecked(e1) = Checked.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (29,45--29,60)" [], "let testInt16ToSByteChecked(e1) = Checked.ToSByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (30,45--30,61)" - [], "let testInt16ToInt16Checked(e1) = Checked.ToInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (31,45--31,61)" + [], "let testInt16ToInt16Checked(e1) = e1 @ (31,59--31,61)" [], "let testInt16ToUInt16Checked(e1) = Checked.ToUInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (32,45--32,62)" [], "let testInt16ToIntChecked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (33,45--33,59)" [], "let testInt16ToInt32Checked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (34,45--34,61)" @@ -1417,7 +1417,7 @@ let ``Test Operator Declarations for Int16`` () = [], "let testInt16ToUIntPtrChecked(e1) = Checked.ToUIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (39,45--39,66)" [], "let testInt16ToByteOperator(e1) = Operators.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (41,45--41,52)" [], "let testInt16ToSByteOperator(e1) = Operators.ToSByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (42,45--42,53)" - [], "let testInt16ToInt16Operator(e1) = Operators.ToInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (43,45--43,53)" + [], "let testInt16ToInt16Operator(e1) = e1 @ (43,51--43,53)" [], "let testInt16ToUInt16Operator(e1) = Operators.ToUInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (44,45--44,54)" [], "let testInt16ToIntOperator(e1) = Operators.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (45,45--45,51)" [], "let testInt16ToInt32Operator(e1) = Operators.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (46,45--46,53)" @@ -1515,7 +1515,7 @@ let ``Test Operator Declarations for UInt16`` () = [], "let testUInt16ToByteChecked(e1) = Checked.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (29,47--29,62)" [], "let testUInt16ToSByteChecked(e1) = Checked.ToSByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (30,47--30,63)" [], "let testUInt16ToInt16Checked(e1) = Checked.ToInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (31,47--31,63)" - [], "let testUInt16ToUInt16Checked(e1) = Checked.ToUInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (32,47--32,64)" + [], "let testUInt16ToUInt16Checked(e1) = e1 @ (32,62--32,64)" [], "let testUInt16ToIntChecked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (33,47--33,61)" [], "let testUInt16ToInt32Checked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (34,47--34,63)" [], "let testUInt16ToUInt32Checked(e1) = Checked.ToUInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (35,47--35,64)" @@ -1526,7 +1526,7 @@ let ``Test Operator Declarations for UInt16`` () = [], "let testUInt16ToByteOperator(e1) = Operators.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (41,47--41,54)" [], "let testUInt16ToSByteOperator(e1) = Operators.ToSByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (42,47--42,55)" [], "let testUInt16ToInt16Operator(e1) = Operators.ToInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (43,47--43,55)" - [], "let testUInt16ToUInt16Operator(e1) = Operators.ToUInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (44,47--44,56)" + [], "let testUInt16ToUInt16Operator(e1) = e1 @ (44,54--44,56)" [], "let testUInt16ToIntOperator(e1) = Operators.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (45,47--45,53)" [], "let testUInt16ToInt32Operator(e1) = Operators.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (46,47--46,55)" [], "let testUInt16ToUInt32Operator(e1) = Operators.ToUInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (47,47--47,56)" @@ -1537,7 +1537,7 @@ let ``Test Operator Declarations for UInt16`` () = [], "let testUInt16ToSingleOperator(e1) = Operators.ToSingle (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),Operators.ToDouble (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1)) @ (52,47--52,57)" [], "let testUInt16ToDoubleOperator(e1) = Operators.ToDouble (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),Operators.ToDouble (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1)) @ (53,47--53,55)" [], "let testUInt16ToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,47--54,57)" - [], "let testUInt16ToCharOperator(e1) = Operators.ToChar (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (55,47--55,54)" + [], "let testUInt16ToCharOperator(e1) = e1 @ (55,47--55,54)" [FC47; FC50], "let testUInt16ToStringOperator(e1) = let mutable copyOfStruct: Microsoft.FSharp.Core.uint16 = e1 in copyOfStruct.ToString() @ (56,47--56,56)" ] @@ -1625,8 +1625,8 @@ let ``Test Operator Declarations for Int`` () = [], "let testIntToSByteChecked(e1) = Checked.ToSByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (30,41--30,57)" [], "let testIntToInt16Checked(e1) = Checked.ToInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (31,41--31,57)" [], "let testIntToUInt16Checked(e1) = Checked.ToUInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (32,41--32,58)" - [], "let testIntToIntChecked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (33,41--33,55)" - [], "let testIntToInt32Checked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (34,41--34,57)" + [], "let testIntToIntChecked(e1) = e1 @ (33,53--33,55)" + [], "let testIntToInt32Checked(e1) = e1 @ (34,55--34,57)" [], "let testIntToUInt32Checked(e1) = Checked.ToUInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (35,41--35,58)" [], "let testIntToInt64Checked(e1) = Checked.ToInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (36,41--36,57)" [], "let testIntToUInt64Checked(e1) = Checked.ToUInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (37,41--37,58)" @@ -1734,8 +1734,8 @@ let ``Test Operator Declarations for Int32`` () = [], "let testInt32ToSByteChecked(e1) = Checked.ToSByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (30,45--30,61)" [], "let testInt32ToInt16Checked(e1) = Checked.ToInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (31,45--31,61)" [], "let testInt32ToUInt16Checked(e1) = Checked.ToUInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (32,45--32,62)" - [], "let testInt32ToIntChecked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (33,45--33,59)" - [], "let testInt32ToInt32Checked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (34,45--34,61)" + [], "let testInt32ToIntChecked(e1) = e1 @ (33,57--33,59)" + [], "let testInt32ToInt32Checked(e1) = e1 @ (34,59--34,61)" [], "let testInt32ToUInt32Checked(e1) = Checked.ToUInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (35,45--35,62)" [], "let testInt32ToInt64Checked(e1) = Checked.ToInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (36,45--36,61)" [], "let testInt32ToUInt64Checked(e1) = Checked.ToUInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (37,45--37,62)" @@ -1845,7 +1845,7 @@ let ``Test Operator Declarations for UInt32`` () = [], "let testUInt32ToUInt16Checked(e1) = Checked.ToUInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (32,47--32,64)" [], "let testUInt32ToIntChecked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (33,47--33,61)" [], "let testUInt32ToInt32Checked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (34,47--34,63)" - [], "let testUInt32ToUInt32Checked(e1) = Checked.ToUInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (35,47--35,64)" + [], "let testUInt32ToUInt32Checked(e1) = e1 @ (35,62--35,64)" [], "let testUInt32ToInt64Checked(e1) = Checked.ToInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (36,47--36,63)" [], "let testUInt32ToUInt64Checked(e1) = Checked.ToUInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (37,47--37,64)" [], "let testUInt32ToIntPtrChecked(e1) = Checked.ToIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (38,47--38,67)" @@ -1856,7 +1856,7 @@ let ``Test Operator Declarations for UInt32`` () = [], "let testUInt32ToUInt16Operator(e1) = Operators.ToUInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (44,47--44,56)" [], "let testUInt32ToIntOperator(e1) = Operators.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (45,47--45,53)" [], "let testUInt32ToInt32Operator(e1) = Operators.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (46,47--46,55)" - [], "let testUInt32ToUInt32Operator(e1) = Operators.ToUInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (47,47--47,56)" + [], "let testUInt32ToUInt32Operator(e1) = e1 @ (47,54--47,56)" [], "let testUInt32ToInt64Operator(e1) = Operators.ToUInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (48,47--48,55)" [], "let testUInt32ToUInt64Operator(e1) = Operators.ToUInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (49,47--49,56)" [], "let testUInt32ToIntPtrOperator(e1) = Operators.ToUIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (50,47--50,59)" @@ -1955,7 +1955,7 @@ let ``Test Operator Declarations for Int64`` () = [], "let testInt64ToIntChecked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (33,45--33,59)" [], "let testInt64ToInt32Checked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (34,45--34,61)" [], "let testInt64ToUInt32Checked(e1) = Checked.ToUInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (35,45--35,62)" - [], "let testInt64ToInt64Checked(e1) = Checked.ToInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (36,45--36,61)" + [], "let testInt64ToInt64Checked(e1) = e1 @ (36,59--36,61)" [], "let testInt64ToUInt64Checked(e1) = Checked.ToUInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (37,45--37,62)" [], "let testInt64ToIntPtrChecked(e1) = Checked.ToIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (38,45--38,65)" [], "let testInt64ToUIntPtrChecked(e1) = Checked.ToUIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (39,45--39,66)" @@ -1966,7 +1966,7 @@ let ``Test Operator Declarations for Int64`` () = [], "let testInt64ToIntOperator(e1) = Operators.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (45,45--45,51)" [], "let testInt64ToInt32Operator(e1) = Operators.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (46,45--46,53)" [], "let testInt64ToUInt32Operator(e1) = Operators.ToUInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (47,45--47,54)" - [], "let testInt64ToInt64Operator(e1) = Operators.ToInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (48,45--48,53)" + [], "let testInt64ToInt64Operator(e1) = e1 @ (48,51--48,53)" [], "let testInt64ToUInt64Operator(e1) = Operators.ToUInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (49,45--49,54)" [], "let testInt64ToIntPtrOperator(e1) = Operators.ToIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (50,45--50,57)" [], "let testInt64ToUIntPtrOperator(e1) = Operators.ToIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (51,45--51,58)" @@ -2065,7 +2065,7 @@ let ``Test Operator Declarations for UInt64`` () = [], "let testUInt64ToInt32Checked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (34,47--34,63)" [], "let testUInt64ToUInt32Checked(e1) = Checked.ToUInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (35,47--35,64)" [], "let testUInt64ToInt64Checked(e1) = Checked.ToInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (36,47--36,63)" - [], "let testUInt64ToUInt64Checked(e1) = Checked.ToUInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (37,47--37,64)" + [], "let testUInt64ToUInt64Checked(e1) = e1 @ (37,62--37,64)" [], "let testUInt64ToIntPtrChecked(e1) = Checked.ToIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (38,47--38,67)" [], "let testUInt64ToUIntPtrChecked(e1) = Checked.ToUIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (39,47--39,68)" [], "let testUInt64ToByteOperator(e1) = Operators.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (41,47--41,54)" @@ -2175,7 +2175,7 @@ let ``Test Operator Declarations for IntPtr`` () = [], "let testIntPtrToUInt32Checked(e1) = Checked.ToUInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (35,50--35,67)" [], "let testIntPtrToInt64Checked(e1) = Checked.ToInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (36,50--36,66)" [], "let testIntPtrToUInt64Checked(e1) = Checked.ToUInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (37,50--37,67)" - [], "let testIntPtrToIntPtrChecked(e1) = Checked.ToIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (38,50--38,70)" + [], "let testIntPtrToIntPtrChecked(e1) = e1 @ (38,68--38,70)" [], "let testIntPtrToUIntPtrChecked(e1) = Checked.ToUIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (39,50--39,71)" [], "let testIntPtrToByteOperator(e1) = Operators.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (41,50--41,57)" [], "let testIntPtrToSByteOperator(e1) = Operators.ToSByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (42,50--42,58)" @@ -2186,7 +2186,7 @@ let ``Test Operator Declarations for IntPtr`` () = [], "let testIntPtrToUInt32Operator(e1) = Operators.ToUInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (47,50--47,59)" [], "let testIntPtrToInt64Operator(e1) = Operators.ToInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (48,50--48,58)" [], "let testIntPtrToUInt64Operator(e1) = Operators.ToInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (49,50--49,59)" - [], "let testIntPtrToIntPtrOperator(e1) = Operators.ToIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (50,50--50,62)" + [], "let testIntPtrToIntPtrOperator(e1) = e1 @ (50,60--50,62)" [], "let testIntPtrToUIntPtrOperator(e1) = Operators.ToUIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (51,50--51,63)" [], "let testIntPtrToSingleOperator(e1) = Operators.ToSingle (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (52,50--52,60)" [], "let testIntPtrToDoubleOperator(e1) = Operators.ToDouble (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (53,50--53,58)" @@ -2284,7 +2284,7 @@ let ``Test Operator Declarations for UIntPtr`` () = [], "let testUIntPtrToInt64Checked(e1) = Checked.ToInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (36,52--36,68)" [], "let testUIntPtrToUInt64Checked(e1) = Checked.ToUInt64 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (37,52--37,69)" [], "let testUIntPtrToIntPtrChecked(e1) = Checked.ToIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (38,52--38,72)" - [], "let testUIntPtrToUIntPtrChecked(e1) = Checked.ToUIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (39,52--39,73)" + [], "let testUIntPtrToUIntPtrChecked(e1) = e1 @ (39,71--39,73)" [], "let testUIntPtrToByteOperator(e1) = Operators.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (41,52--41,59)" [], "let testUIntPtrToSByteOperator(e1) = Operators.ToSByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (42,52--42,60)" [], "let testUIntPtrToInt16Operator(e1) = Operators.ToInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (43,52--43,60)" @@ -2870,7 +2870,7 @@ let ``Test Operator Declarations for Char`` () = [], "let testCharToByteChecked(e1) = Checked.ToByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (29,43--29,58)" [], "let testCharToSByteChecked(e1) = Checked.ToSByte (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (30,43--30,59)" [], "let testCharToInt16Checked(e1) = Checked.ToInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (31,43--31,59)" - [], "let testCharToUInt16Checked(e1) = Checked.ToUInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (32,43--32,60)" + [], "let testCharToUInt16Checked(e1) = Operators.ToUInt16 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (32,43--32,60)" [], "let testCharToIntChecked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (33,43--33,57)" [], "let testCharToInt32Checked(e1) = Checked.ToInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (34,43--34,59)" [], "let testCharToUInt32Checked(e1) = Checked.ToUInt32 (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (35,43--35,60)" @@ -2891,7 +2891,7 @@ let ``Test Operator Declarations for Char`` () = [], "let testCharToUIntPtrOperator(e1) = Operators.ToUIntPtr (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (51,43--51,56)" [], "let testCharToSingleOperator(e1) = Operators.ToSingle (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),Operators.ToDouble (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1)) @ (52,43--52,53)" [], "let testCharToDoubleOperator(e1) = Operators.ToDouble (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),Operators.ToDouble (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1)) @ (53,43--53,51)" - [], "let testCharToCharOperator(e1) = Operators.ToChar (fun arg0_0 -> LanguagePrimitives.ExplicitDynamic (arg0_0),e1) @ (55,43--55,50)" + [], "let testCharToCharOperator(e1) = e1 @ (55,48--55,50)" [FC47; FC50], "let testCharToStringOperator(e1) = let mutable copyOfStruct: Microsoft.FSharp.Core.char = e1 in copyOfStruct.ToString() @ (56,43--56,52)" ]