From 990457ef0b0b63275bcbc3726b3ef6cf2621511b Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Fri, 20 Oct 2017 14:33:11 +0200 Subject: [PATCH 01/21] Optimize in FCS --- src/fsharp/service/service.fs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/fsharp/service/service.fs b/src/fsharp/service/service.fs index 80b55834f02..dcd484297eb 100644 --- a/src/fsharp/service/service.fs +++ b/src/fsharp/service/service.fs @@ -1814,6 +1814,23 @@ type FSharpCheckProjectResults(projectFileName:string, keepAssemblyContents, err | Some mimpls -> mimpls FSharpAssemblyContents(tcGlobals, thisCcu, tcImports, mimpls) + + member info.GetOptimizedAssemblyContents(tcConfig, outfile) = + if not keepAssemblyContents then invalidOp "The 'keepAssemblyContents' flag must be set to true on the FSharpChecker in order to access the checked contents of assemblies" + let (tcGlobals, tcImports, thisCcu, _ccuSig, _tcSymbolUses, _topAttribs, _tcAssemblyData, _ilAssemRef, _ad, tcAssemblyExpr, _dependencyFiles) = getDetails() + let mimpls = + match tcAssemblyExpr with + | None -> [] + | Some mimpls -> + let importMap = tcImports.GetImportMap() + let optEnv0 = GetInitialOptimizationEnv (tcImports, tcGlobals) + let optimizedImpls, _optimizationData, _ = ApplyAllOptimizations (tcConfig, tcGlobals, (LightweightTcValForUsingInBuildMethodCall tcGlobals), outfile, importMap, false, optEnv0, thisCcu, mimpls) + match optimizedImpls with + | TypedAssemblyAfterOptimization files -> + files |> List.map fst + + FSharpAssemblyContents(tcGlobals, thisCcu, tcImports, mimpls) + // Not, this does not have to be a SyncOp, it can be called from any thread member info.GetUsesOfSymbol(symbol:FSharpSymbol) = let (tcGlobals, _tcImports, _thisCcu, _ccuSig, tcSymbolUses, _topAttribs, _tcAssemblyData, _ilAssemRef, _ad, _tcAssemblyExpr, _dependencyFiles) = getDetails() From 167f8fafe62244981fbd3c36eb81285284023b24 Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Fri, 20 Oct 2017 14:43:01 +0200 Subject: [PATCH 02/21] Transport tcConfig --- src/fsharp/service/service.fs | 18 ++++++++++++------ src/fsharp/service/service.fsi | 3 +++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/fsharp/service/service.fs b/src/fsharp/service/service.fs index dcd484297eb..4a0030bb90b 100644 --- a/src/fsharp/service/service.fs +++ b/src/fsharp/service/service.fs @@ -1790,13 +1790,18 @@ type FSharpProjectContext(thisCcu: CcuThunk, assemblies: FSharpAssembly list, ad [] // 'details' is an option because the creation of the tcGlobals etc. for the project may have failed. -type FSharpCheckProjectResults(projectFileName:string, keepAssemblyContents, errors: FSharpErrorInfo[], details:(TcGlobals*TcImports*CcuThunk*ModuleOrNamespaceType*TcSymbolUses list*TopAttribs option*CompileOps.IRawFSharpAssemblyData option * ILAssemblyRef * AccessorDomain * TypedImplFile list option * string[]) option, _reactorOps: IReactorOperations) = +type FSharpCheckProjectResults(projectFileName:string, tcConfigOption, keepAssemblyContents, errors: FSharpErrorInfo[], details:(TcGlobals*TcImports*CcuThunk*ModuleOrNamespaceType*TcSymbolUses list*TopAttribs option*CompileOps.IRawFSharpAssemblyData option * ILAssemblyRef * AccessorDomain * TypedImplFile list option * string[]) option, _reactorOps: IReactorOperations) = let getDetails() = match details with | None -> invalidOp ("The project has no results due to critical errors in the project options. Check the HasCriticalErrors before accessing the detaild results. Errors: " + String.concat "\n" [ for e in errors -> e.Message ]) | Some d -> d + let tcConfig() = + match tcConfigOption with + | None -> invalidOp ("The project has no results due to critical errors in the project options. Check the HasCriticalErrors before accessing the detaild results. Errors: " + String.concat "\n" [ for e in errors -> e.Message ]) + | Some d -> d + member info.Errors = errors member info.HasCriticalErrors = details.IsNone @@ -1815,16 +1820,17 @@ type FSharpCheckProjectResults(projectFileName:string, keepAssemblyContents, err FSharpAssemblyContents(tcGlobals, thisCcu, tcImports, mimpls) - member info.GetOptimizedAssemblyContents(tcConfig, outfile) = + member info.OptimizedAssemblyContents = if not keepAssemblyContents then invalidOp "The 'keepAssemblyContents' flag must be set to true on the FSharpChecker in order to access the checked contents of assemblies" let (tcGlobals, tcImports, thisCcu, _ccuSig, _tcSymbolUses, _topAttribs, _tcAssemblyData, _ilAssemRef, _ad, tcAssemblyExpr, _dependencyFiles) = getDetails() let mimpls = match tcAssemblyExpr with | None -> [] | Some mimpls -> + let outfile = null let importMap = tcImports.GetImportMap() let optEnv0 = GetInitialOptimizationEnv (tcImports, tcGlobals) - let optimizedImpls, _optimizationData, _ = ApplyAllOptimizations (tcConfig, tcGlobals, (LightweightTcValForUsingInBuildMethodCall tcGlobals), outfile, importMap, false, optEnv0, thisCcu, mimpls) + let optimizedImpls, _optimizationData, _ = ApplyAllOptimizations (tcConfig(), tcGlobals, (LightweightTcValForUsingInBuildMethodCall tcGlobals), outfile, importMap, false, optEnv0, thisCcu, mimpls) match optimizedImpls with | TypedAssemblyAfterOptimization files -> files |> List.map fst @@ -2705,13 +2711,13 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC use _unwind = decrement match builderOpt with | None -> - return FSharpCheckProjectResults (options.ProjectFileName, keepAssemblyContents, Array.ofList creationErrors, None, reactorOps) + return FSharpCheckProjectResults (options.ProjectFileName, None, keepAssemblyContents, Array.ofList creationErrors, None, reactorOps) | Some builder -> let! (tcProj, ilAssemRef, tcAssemblyDataOpt, tcAssemblyExprOpt) = builder.GetCheckResultsAndImplementationsForProject(ctok) let errorOptions = tcProj.TcConfig.errorSeverityOptions let fileName = TcGlobals.DummyFileNameForRangesWithoutASpecificLocation let errors = [| yield! creationErrors; yield! ErrorHelpers.CreateErrorInfos (errorOptions, true, fileName, tcProj.Errors) |] - return FSharpCheckProjectResults (options.ProjectFileName, keepAssemblyContents, errors, Some(tcProj.TcGlobals, tcProj.TcImports, tcProj.TcState.Ccu, tcProj.TcState.PartialAssemblySignature, tcProj.TcSymbolUses, tcProj.TopAttribs, tcAssemblyDataOpt, ilAssemRef, tcProj.TcEnvAtEnd.AccessRights, tcAssemblyExprOpt, Array.ofList tcProj.TcDependencyFiles), reactorOps) + return FSharpCheckProjectResults (options.ProjectFileName, Some tcProj.TcConfig, keepAssemblyContents, errors, Some(tcProj.TcGlobals, tcProj.TcImports, tcProj.TcState.Ccu, tcProj.TcState.PartialAssemblySignature, tcProj.TcSymbolUses, tcProj.TopAttribs, tcAssemblyDataOpt, ilAssemRef, tcProj.TcEnvAtEnd.AccessRights, tcAssemblyExprOpt, Array.ofList tcProj.TcDependencyFiles), reactorOps) } /// Get the timestamp that would be on the output if fully built immediately @@ -3229,7 +3235,7 @@ type FsiInteractiveChecker(legacyReferenceResolver, reactorOps: IReactorOperatio | Parser.TypeCheckAborted.No scope -> let errors = [| yield! parseErrors; yield! tcErrors |] let typeCheckResults = FSharpCheckFileResults (filename, errors, Some scope, dependencyFiles, None, reactorOps, false) - let projectResults = FSharpCheckProjectResults (filename, keepAssemblyContents, errors, Some(tcGlobals, tcImports, scope.ThisCcu, scope.CcuSig, [scope.ScopeSymbolUses], None, None, mkSimpleAssRef "stdin", tcState.TcEnvFromImpls.AccessRights, None, dependencyFiles), reactorOps) + let projectResults = FSharpCheckProjectResults (filename, Some tcConfig, keepAssemblyContents, errors, Some(tcGlobals, tcImports, scope.ThisCcu, scope.CcuSig, [scope.ScopeSymbolUses], None, None, mkSimpleAssRef "stdin", tcState.TcEnvFromImpls.AccessRights, None, dependencyFiles), reactorOps) parseResults, typeCheckResults, projectResults | _ -> failwith "unexpected aborted" diff --git a/src/fsharp/service/service.fsi b/src/fsharp/service/service.fsi index 61ac7e1fb2d..71c1e991c87 100755 --- a/src/fsharp/service/service.fsi +++ b/src/fsharp/service/service.fsi @@ -269,6 +269,9 @@ type public FSharpCheckProjectResults = /// Get a view of the overall contents of the assembly. Only valid to use if HasCriticalErrors is false. member AssemblyContents: FSharpAssemblyContents + /// Get an optimized view of the overall contents of the assembly. Only valid to use if HasCriticalErrors is false. + member OptimizedAssemblyContents: FSharpAssemblyContents + /// Get the resolution of the ProjectOptions member ProjectContext: FSharpProjectContext From 112bc919f0422d6995dc53bc09b636075d30b69d Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Fri, 20 Oct 2017 16:26:07 +0200 Subject: [PATCH 03/21] Cleanup --- src/fsharp/service/service.fs | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/fsharp/service/service.fs b/src/fsharp/service/service.fs index 4a0030bb90b..7aa003b87f9 100644 --- a/src/fsharp/service/service.fs +++ b/src/fsharp/service/service.fs @@ -1809,31 +1809,29 @@ type FSharpCheckProjectResults(projectFileName:string, tcConfigOption, keepAssem member info.AssemblySignature = let (tcGlobals, tcImports, thisCcu, ccuSig, _tcSymbolUses, topAttribs, _tcAssemblyData, _ilAssemRef, _ad, _tcAssemblyExpr, _dependencyFiles) = getDetails() FSharpAssemblySignature(tcGlobals, thisCcu, tcImports, topAttribs, ccuSig) - - member info.AssemblyContents = + + member info.TypedImplementionFiles = if not keepAssemblyContents then invalidOp "The 'keepAssemblyContents' flag must be set to true on the FSharpChecker in order to access the checked contents of assemblies" let (tcGlobals, tcImports, thisCcu, _ccuSig, _tcSymbolUses, _topAttribs, _tcAssemblyData, _ilAssemRef, _ad, tcAssemblyExpr, _dependencyFiles) = getDetails() let mimpls = match tcAssemblyExpr with | None -> [] | Some mimpls -> mimpls - FSharpAssemblyContents(tcGlobals, thisCcu, tcImports, mimpls) + tcGlobals, thisCcu, tcImports, mimpls + + member info.AssemblyContents = FSharpAssemblyContents(info.TypedImplementionFiles) member info.OptimizedAssemblyContents = - if not keepAssemblyContents then invalidOp "The 'keepAssemblyContents' flag must be set to true on the FSharpChecker in order to access the checked contents of assemblies" - let (tcGlobals, tcImports, thisCcu, _ccuSig, _tcSymbolUses, _topAttribs, _tcAssemblyData, _ilAssemRef, _ad, tcAssemblyExpr, _dependencyFiles) = getDetails() - let mimpls = - match tcAssemblyExpr with - | None -> [] - | Some mimpls -> - let outfile = null - let importMap = tcImports.GetImportMap() - let optEnv0 = GetInitialOptimizationEnv (tcImports, tcGlobals) - let optimizedImpls, _optimizationData, _ = ApplyAllOptimizations (tcConfig(), tcGlobals, (LightweightTcValForUsingInBuildMethodCall tcGlobals), outfile, importMap, false, optEnv0, thisCcu, mimpls) - match optimizedImpls with - | TypedAssemblyAfterOptimization files -> - files |> List.map fst + let tcGlobals, thisCcu, tcImports, mimpls = info.TypedImplementionFiles + let outfile = null + let importMap = tcImports.GetImportMap() + let optEnv0 = GetInitialOptimizationEnv (tcImports, tcGlobals) + let optimizedImpls, _optimizationData, _ = ApplyAllOptimizations (tcConfig(), tcGlobals, (LightweightTcValForUsingInBuildMethodCall tcGlobals), outfile, importMap, false, optEnv0, thisCcu, mimpls) + let mimpls = + match optimizedImpls with + | TypedAssemblyAfterOptimization files -> + files |> List.map fst FSharpAssemblyContents(tcGlobals, thisCcu, tcImports, mimpls) From 183e9213b769cc2f75d7d73e81dfa43fc0da9e53 Mon Sep 17 00:00:00 2001 From: ncave Date: Sun, 26 Nov 2017 10:52:58 -0800 Subject: [PATCH 04/21] Replace more ILAsm in Exprs --- src/fsharp/TastOps.fs | 46 +++++++++++-- src/fsharp/TastOps.fsi | 43 +++++++++++- src/fsharp/TcGlobals.fs | 120 +++++++++++++++++++++++++++------- src/fsharp/service/service.fs | 8 +-- src/fsharp/symbols/Exprs.fs | 113 ++++++++++++++++++++++++++++---- 5 files changed, 286 insertions(+), 44 deletions(-) diff --git a/src/fsharp/TastOps.fs b/src/fsharp/TastOps.fs index d2d378508de..226e994c8d6 100644 --- a/src/fsharp/TastOps.fs +++ b/src/fsharp/TastOps.fs @@ -6114,18 +6114,56 @@ let mkCallNewQuerySource (g:TcGlobals) m ty1 ty2 e1 = m let mkCallCreateEvent (g:TcGlobals) m ty1 ty2 e1 e2 e3 = mkApps g (typedExprForIntrinsic g m g.create_event_info, [[ty1;ty2]], [ e1;e2;e3 ], m) let mkCallGenericComparisonWithComparerOuter (g:TcGlobals) m ty comp e1 e2 = mkApps g (typedExprForIntrinsic g m g.generic_comparison_withc_outer_info, [[ty]], [ comp;e1;e2 ], m) -let mkCallEqualsOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.equals_operator_info, [[ty]], [ e1;e2 ], m) let mkCallGenericEqualityEROuter (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.generic_equality_er_outer_info, [[ty]], [ e1;e2 ], m) let mkCallGenericEqualityWithComparerOuter (g:TcGlobals) m ty comp e1 e2 = mkApps g (typedExprForIntrinsic g m g.generic_equality_withc_outer_info, [[ty]], [comp;e1;e2], m) let mkCallGenericHashWithComparerOuter (g:TcGlobals) m ty comp e1 = mkApps g (typedExprForIntrinsic g m g.generic_hash_withc_outer_info, [[ty]], [comp;e1], m) -let mkCallSubtractionOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.unchecked_subtraction_info, [[ty; ty; ty]], [e1;e2], m) +let mkCallEqualsOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.equals_operator_info, [[ty]], [ e1;e2 ], m) +let mkCallNotEqualsOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.not_equals_operator, [[ty]], [ e1;e2 ], m) +let mkCallLessThanOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.less_than_operator, [[ty]], [ e1;e2 ], m) +let mkCallLessThanOrEqualsOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.less_than_or_equals_operator, [[ty]], [ e1;e2 ], m) +let mkCallGreaterThanOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.greater_than_operator, [[ty]], [ e1;e2 ], m) +let mkCallGreaterThanOrEqualsOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.greater_than_or_equals_operator, [[ty]], [ e1;e2 ], m) -let mkCallArrayLength (g:TcGlobals) m ty el = mkApps g (typedExprForIntrinsic g m g.array_length_info, [[ty]], [el], m) -let mkCallArrayGet (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.array_get_info, [[ty]], [ e1 ; e2 ], m) +let mkCallAdditionOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.unchecked_addition_info, [[ty; ty; ty]], [e1;e2], m) +let mkCallSubtractionOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.unchecked_subtraction_info, [[ty; ty; ty]], [e1;e2], m) +let mkCallMultiplyOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.unchecked_multiply_info, [[ty; ty; ty]], [e1;e2], m) +let mkCallDivisionOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.unchecked_division_info, [[ty; ty; ty]], [e1;e2], m) +let mkCallModulusOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.unchecked_modulus_info, [[ty; ty; ty]], [e1;e2], m) +let mkCallBitwiseAndOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.bitwise_and_info, [[ty]], [e1;e2], m) +let mkCallBitwiseOrOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.bitwise_or_info, [[ty]], [e1;e2], m) +let mkCallBitwiseXorOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.bitwise_xor_info, [[ty]], [e1;e2], m) +let mkCallShiftLeftOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.bitwise_shift_left_info, [[ty]], [e1;e2], m) +let mkCallShiftRightOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.bitwise_shift_right_info, [[ty]], [e1;e2], m) + +let mkCallUnaryNegOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.unchecked_unary_minus_info, [[ty]], [e1], m) +let mkCallUnaryNotOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.bitwise_unary_not_info, [[ty]], [e1], m) + +let mkCallToByteOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.byte_operator_info, [[ty]], [e1], m) +let mkCallToSByteOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.sbyte_operator_info, [[ty]], [e1], m) +let mkCallToInt16Operator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.int16_operator_info, [[ty]], [e1], m) +let mkCallToUInt16Operator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.uint16_operator_info, [[ty]], [e1], m) +let mkCallToIntOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.int_operator_info, [[ty]], [e1], m) +let mkCallToEnumOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.enum_operator_info, [[ty]], [e1], m) +let mkCallToInt32Operator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.int32_operator_info, [[ty]], [e1], m) +let mkCallToUInt32Operator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.uint32_operator_info, [[ty]], [e1], m) +let mkCallToInt64Operator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.int64_operator_info, [[ty]], [e1], m) +let mkCallToUInt64Operator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.uint64_operator_info, [[ty]], [e1], m) +let mkCallToSingleOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.float32_operator_info, [[ty]], [e1], m) +let mkCallToDoubleOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.float_operator_info, [[ty]], [e1], m) +let mkCallToIntPtrOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.nativeint_operator_info, [[ty]], [e1], m) +let mkCallToUIntPtrOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.unativeint_operator_info, [[ty]], [e1], m) + +let mkCallArrayLength (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.array_length_info, [[ty]], [e1], m) +let mkCallArrayGet (g:TcGlobals) m ty e1 idx1 = mkApps g (typedExprForIntrinsic g m g.array_get_info, [[ty]], [ e1 ; idx1 ], m) let mkCallArray2DGet (g:TcGlobals) m ty e1 idx1 idx2 = mkApps g (typedExprForIntrinsic g m g.array2D_get_info, [[ty]], [ e1 ; idx1; idx2 ], m) let mkCallArray3DGet (g:TcGlobals) m ty e1 idx1 idx2 idx3 = mkApps g (typedExprForIntrinsic g m g.array3D_get_info, [[ty]], [ e1 ; idx1; idx2; idx3 ], m) let mkCallArray4DGet (g:TcGlobals) m ty e1 idx1 idx2 idx3 idx4 = mkApps g (typedExprForIntrinsic g m g.array4D_get_info, [[ty]], [ e1 ; idx1; idx2; idx3; idx4 ], m) +let mkCallArraySet (g:TcGlobals) m ty e1 idx1 v = mkApps g (typedExprForIntrinsic g m g.array_set_info, [[ty]], [ e1 ; idx1; v ], m) +let mkCallArray2DSet (g:TcGlobals) m ty e1 idx1 idx2 v = mkApps g (typedExprForIntrinsic g m g.array2D_set_info, [[ty]], [ e1 ; idx1; idx2; v ], m) +let mkCallArray3DSet (g:TcGlobals) m ty e1 idx1 idx2 idx3 v = mkApps g (typedExprForIntrinsic g m g.array3D_set_info, [[ty]], [ e1 ; idx1; idx2; idx3; v ], m) +let mkCallArray4DSet (g:TcGlobals) m ty e1 idx1 idx2 idx3 idx4 v = mkApps g (typedExprForIntrinsic g m g.array4D_set_info, [[ty]], [ e1 ; idx1; idx2; idx3; idx4; v ], m) + let mkCallNewDecimal (g:TcGlobals) m (e1, e2, e3, e4, e5) = mkApps g (typedExprForIntrinsic g m g.new_decimal_info, [], [ e1;e2;e3;e4;e5 ], m) let mkCallNewFormat (g:TcGlobals) m aty bty cty dty ety e1 = mkApps g (typedExprForIntrinsic g m g.new_format_info, [[aty;bty;cty;dty;ety]], [ e1 ], m) diff --git a/src/fsharp/TastOps.fsi b/src/fsharp/TastOps.fsi index 04410eae1c1..0de158c052e 100755 --- a/src/fsharp/TastOps.fsi +++ b/src/fsharp/TastOps.fsi @@ -1201,15 +1201,54 @@ val mkCallArrayGet : TcGlobals -> range -> TType -> Expr -> Expr -> Ex val mkCallArray2DGet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr val mkCallArray3DGet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr val mkCallArray4DGet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr +val mkCallArraySet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr +val mkCallArray2DSet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr +val mkCallArray3DSet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr +val mkCallArray4DSet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr + val mkCallRaise : TcGlobals -> range -> TType -> Expr -> Expr val mkCallGenericComparisonWithComparerOuter : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr val mkCallGenericEqualityEROuter : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -val mkCallEqualsOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -val mkCallSubtractionOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr val mkCallGenericEqualityWithComparerOuter : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr val mkCallGenericHashWithComparerOuter : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallEqualsOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallNotEqualsOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallLessThanOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallLessThanOrEqualsOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallGreaterThanOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallGreaterThanOrEqualsOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + +val mkCallAdditionOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallSubtractionOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallMultiplyOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallDivisionOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallModulusOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallBitwiseAndOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallBitwiseOrOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallBitwiseXorOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallShiftLeftOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallShiftRightOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + +val mkCallUnaryNegOperator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallUnaryNotOperator : TcGlobals -> range -> TType -> Expr -> Expr + +val mkCallToByteOperator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToSByteOperator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToInt16Operator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToUInt16Operator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToIntOperator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToEnumOperator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToInt32Operator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToUInt32Operator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToInt64Operator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToUInt64Operator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToSingleOperator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToDoubleOperator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToIntPtrOperator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToUIntPtrOperator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallDeserializeQuotationFSharp20Plus : TcGlobals -> range -> Expr -> Expr -> Expr -> Expr -> Expr val mkCallDeserializeQuotationFSharp40Plus : TcGlobals -> range -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr val mkCallCastQuotation : TcGlobals -> range -> TType -> Expr -> Expr diff --git a/src/fsharp/TcGlobals.fs b/src/fsharp/TcGlobals.fs index 0e126f3469b..e89a3043acb 100755 --- a/src/fsharp/TcGlobals.fs +++ b/src/fsharp/TcGlobals.fs @@ -290,12 +290,25 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d else "[" + (String.replicate (rank - 1) ",") + "]`1" mk_MFCore_tcref fslibCcu type_sig) + let v_byte_ty = mkNonGenericTy v_byte_tcr + let v_sbyte_ty = mkNonGenericTy v_sbyte_tcr + let v_int16_ty = mkNonGenericTy v_int16_tcr + let v_uint16_ty = mkNonGenericTy v_uint16_tcr + let v_int_ty = mkNonGenericTy v_int_tcr + let v_enum_ty = mkNonGenericTy v_int_tcr + let v_int32_ty = mkNonGenericTy v_int32_tcr + let v_uint32_ty = mkNonGenericTy v_uint32_tcr + let v_int64_ty = mkNonGenericTy v_int64_tcr + let v_uint64_ty = mkNonGenericTy v_uint64_tcr + let v_float32_ty = mkNonGenericTy v_float32_tcr + let v_float_ty = mkNonGenericTy v_float_tcr + let v_nativeint_ty = mkNonGenericTy v_nativeint_tcr + let v_unativeint_ty = mkNonGenericTy v_unativeint_tcr + let v_bool_ty = mkNonGenericTy v_bool_tcr - let v_int_ty = mkNonGenericTy v_int_tcr let v_char_ty = mkNonGenericTy v_char_tcr let v_obj_ty = mkNonGenericTy v_obj_tcr let v_string_ty = mkNonGenericTy v_string_tcr - let v_byte_ty = mkNonGenericTy v_byte_tcr let v_decimal_ty = mkSysNonGenericTy sys "Decimal" let v_unit_ty = mkNonGenericTy v_unit_tcr_nice let v_system_Type_typ = mkSysNonGenericTy sys "Type" @@ -554,10 +567,27 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d let v_unchecked_addition_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "op_Addition" , None , None , [vara;varb;varc], mk_binop_ty3 varaTy varbTy varcTy) let v_unchecked_subtraction_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "op_Subtraction" , None , None , [vara;varb;varc], mk_binop_ty3 varaTy varbTy varcTy) let v_unchecked_multiply_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "op_Multiply" , None , None , [vara;varb;varc], mk_binop_ty3 varaTy varbTy varcTy) + let v_unchecked_division_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "op_Division" , None , None , [vara;varb;varc], mk_binop_ty3 varaTy varbTy varcTy) + let v_unchecked_modulus_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "op_Modulus" , None , None , [vara;varb;varc], mk_binop_ty3 varaTy varbTy varcTy) let v_unchecked_unary_plus_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "op_UnaryPlus" , None , None , [vara], mk_unop_ty varaTy) let v_unchecked_unary_minus_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "op_UnaryNegation" , None , None , [vara], mk_unop_ty varaTy) let v_unchecked_unary_not_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "not" , None , Some "Not" , [], mk_unop_ty v_bool_ty) + let v_byte_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "byte" , None , Some "ToByte", [vara], ([[varaTy]], v_byte_ty)) + let v_sbyte_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "sbyte" , None , Some "ToSByte", [vara], ([[varaTy]], v_sbyte_ty)) + let v_int16_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "int16" , None , Some "ToInt16", [vara], ([[varaTy]], v_int16_ty)) + let v_uint16_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "uint16" , None , Some "ToUInt16", [vara], ([[varaTy]], v_uint16_ty)) + let v_int_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "int" , None , Some "ToInt", [vara], ([[varaTy]], v_int_ty)) + let v_enum_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "enum" , None , Some "ToEnum", [vara], ([[varaTy]], v_enum_ty)) + let v_int32_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "int32" , None , Some "ToInt32", [vara], ([[varaTy]], v_int32_ty)) + let v_uint32_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "uint32" , None , Some "ToUInt32", [vara], ([[varaTy]], v_uint32_ty)) + let v_int64_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "int64" , None , Some "ToInt64", [vara], ([[varaTy]], v_int64_ty)) + let v_uint64_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "uint64" , None , Some "ToUInt64", [vara], ([[varaTy]], v_uint64_ty)) + let v_float32_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "float32" , None , Some "ToSingle", [vara], ([[varaTy]], v_float32_ty)) + let v_float_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "float" , None , Some "ToDouble", [vara], ([[varaTy]], v_float_ty)) + let v_nativeint_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "nativeint" , None , Some "ToIntPtr", [vara], ([[varaTy]], v_nativeint_ty)) + let v_unativeint_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "unativeint" , None , Some "ToUIntPtr", [vara], ([[varaTy]], v_unativeint_ty)) + let v_raise_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "raise" , None , Some "Raise" , [vara], ([[mkSysNonGenericTy sys "Exception"]], varaTy)) let v_failwith_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "failwith" , None , Some "FailWith" , [vara], ([[v_string_ty]], varaTy)) let v_invalid_arg_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "invalidArg" , None , Some "InvalidArg" , [vara], ([[v_string_ty]; [v_string_ty]], varaTy)) @@ -571,13 +601,19 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d let v_sizeof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "sizeof" , None , Some "SizeOf" , [vara], ([], v_int_ty)) let v_unchecked_defaultof_info = makeIntrinsicValRef(fslib_MFOperatorsUnchecked_nleref, "defaultof" , None , Some "DefaultOf", [vara], ([], varaTy)) let v_typedefof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "typedefof" , None , Some "TypeDefOf", [vara], ([], v_system_Type_typ)) - let v_enum_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "enum" , None , Some "ToEnum" , [vara], ([[v_int_ty]], varaTy)) let v_range_op_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "op_Range" , None , None , [vara], ([[varaTy];[varaTy]], mkSeqTy varaTy)) let v_range_step_op_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "op_RangeStep" , None , None , [vara;varb], ([[varaTy];[varbTy];[varaTy]], mkSeqTy varaTy)) let v_range_int32_op_info = makeIntrinsicValRef(fslib_MFOperatorIntrinsics_nleref, "RangeInt32" , None , None , [], ([[v_int_ty];[v_int_ty];[v_int_ty]], mkSeqTy v_int_ty)) + + let v_array_length_info = makeIntrinsicValRef(fslib_MFArrayModule_nleref, "length" , None , Some "Length" , [vara], ([[mkArrayType 1 varaTy]], v_int_ty)) + let v_array_get_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "GetArray" , None , None , [vara], ([[mkArrayType 1 varaTy]; [v_int_ty]], varaTy)) let v_array2D_get_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "GetArray2D" , None , None , [vara], ([[mkArrayType 2 varaTy];[v_int_ty]; [v_int_ty]], varaTy)) let v_array3D_get_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "GetArray3D" , None , None , [vara], ([[mkArrayType 3 varaTy];[v_int_ty]; [v_int_ty]; [v_int_ty]], varaTy)) let v_array4D_get_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "GetArray4D" , None , None , [vara], ([[mkArrayType 4 varaTy];[v_int_ty]; [v_int_ty]; [v_int_ty]; [v_int_ty]], varaTy)) + let v_array_set_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "SetArray" , None , None , [vara], ([[mkArrayType 1 varaTy]; [v_int_ty]; [varaTy]], v_unit_ty)) + let v_array2D_set_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "SetArray2D" , None , None , [vara], ([[mkArrayType 2 varaTy];[v_int_ty]; [v_int_ty]; [varaTy]], v_unit_ty)) + let v_array3D_set_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "SetArray3D" , None , None , [vara], ([[mkArrayType 3 varaTy];[v_int_ty]; [v_int_ty]; [v_int_ty]; [varaTy]], v_unit_ty)) + let v_array4D_set_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "SetArray4D" , None , None , [vara], ([[mkArrayType 4 varaTy];[v_int_ty]; [v_int_ty]; [v_int_ty]; [v_int_ty]; [varaTy]], v_unit_ty)) let v_seq_collect_info = makeIntrinsicValRef(fslib_MFSeqModule_nleref, "collect" , None , Some "Collect", [vara;varb;varc], ([[varaTy --> varbTy]; [mkSeqTy varaTy]], mkSeqTy varcTy)) let v_seq_delay_info = makeIntrinsicValRef(fslib_MFSeqModule_nleref, "delay" , None , Some "Delay" , [varb], ([[v_unit_ty --> mkSeqTy varbTy]], mkSeqTy varbTy)) @@ -604,8 +640,6 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d let v_splice_expr_info = makeIntrinsicValRef(fslib_MFExtraTopLevelOperators_nleref, "op_Splice" , None , None , [vara], ([[mkQuotedExprTy varaTy]], varaTy)) let v_splice_raw_expr_info = makeIntrinsicValRef(fslib_MFExtraTopLevelOperators_nleref, "op_SpliceUntyped" , None , None , [vara], ([[mkRawQuotedExprTy]], varaTy)) let v_new_decimal_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "MakeDecimal" , None , None , [], ([[v_int_ty]; [v_int_ty]; [v_int_ty]; [v_bool_ty]; [v_byte_ty]], v_decimal_ty)) - let v_array_get_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "GetArray" , None , None , [vara], ([[mkArrayType 1 varaTy]; [v_int_ty]], varaTy)) - let v_array_length_info = makeIntrinsicValRef(fslib_MFArrayModule_nleref, "length" , None , Some "Length" , [vara], ([[mkArrayType 1 varaTy]], v_int_ty)) let v_deserialize_quoted_FSharp_20_plus_info = makeIntrinsicValRef(fslib_MFQuotations_nleref, "Deserialize" , Some "Expr" , None , [], ([[v_system_Type_typ ;mkListTy v_system_Type_typ ;mkListTy mkRawQuotedExprTy ; mkArrayType 1 v_byte_ty]], mkRawQuotedExprTy )) let v_deserialize_quoted_FSharp_40_plus_info = makeIntrinsicValRef(fslib_MFQuotations_nleref, "Deserialize40" , Some "Expr" , None , [], ([[v_system_Type_typ ;mkArrayType 1 v_system_Type_typ; mkArrayType 1 v_system_Type_typ; mkArrayType 1 mkRawQuotedExprTy; mkArrayType 1 v_byte_ty]], mkRawQuotedExprTy )) let v_cast_quotation_info = makeIntrinsicValRef(fslib_MFQuotations_nleref, "Cast" , Some "Expr" , None , [vara], ([[mkRawQuotedExprTy]], mkQuotedExprTy varaTy)) @@ -852,15 +886,15 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member __.choice5_tcr = v_choice5_tcr member __.choice6_tcr = v_choice6_tcr member __.choice7_tcr = v_choice7_tcr - member val nativeint_ty = mkNonGenericTy v_nativeint_tcr - member val unativeint_ty = mkNonGenericTy v_unativeint_tcr - member val int32_ty = mkNonGenericTy v_int32_tcr - member val int16_ty = mkNonGenericTy v_int16_tcr - member val int64_ty = mkNonGenericTy v_int64_tcr - member val uint16_ty = mkNonGenericTy v_uint16_tcr - member val uint32_ty = mkNonGenericTy v_uint32_tcr - member val uint64_ty = mkNonGenericTy v_uint64_tcr - member val sbyte_ty = mkNonGenericTy v_sbyte_tcr + member val nativeint_ty = v_nativeint_ty + member val unativeint_ty = v_unativeint_ty + member val int32_ty = v_int32_ty + member val int16_ty = v_int16_ty + member val int64_ty = v_int64_ty + member val uint16_ty = v_uint16_ty + member val uint32_ty = v_uint32_ty + member val uint64_ty = v_uint64_ty + member val sbyte_ty = v_sbyte_ty member __.byte_ty = v_byte_ty member __.bool_ty = v_bool_ty member __.int_ty = v_int_ty @@ -871,8 +905,8 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member __.decimal_ty = v_decimal_ty member val exn_ty = mkNonGenericTy v_exn_tcr - member val float_ty = mkNonGenericTy v_float_tcr - member val float32_ty = mkNonGenericTy v_float32_tcr + member val float_ty = v_float_ty + member val float32_ty = v_float32_ty /// Memoization table to help minimize the number of ILSourceDocument objects we create member __.memoize_file x = v_memoize_file.Apply x @@ -1093,7 +1127,37 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member val unchecked_subtraction_vref = ValRefForIntrinsic v_unchecked_subtraction_info member val unchecked_multiply_vref = ValRefForIntrinsic v_unchecked_multiply_info member val unchecked_defaultof_vref = ValRefForIntrinsic v_unchecked_defaultof_info + + member __.bitwise_or_info = v_bitwise_or_info + member __.bitwise_and_info = v_bitwise_and_info + member __.bitwise_xor_info = v_bitwise_xor_info + member __.bitwise_unary_not_info = v_bitwise_unary_not_info + member __.bitwise_shift_left_info = v_bitwise_shift_left_info + member __.bitwise_shift_right_info = v_bitwise_shift_right_info + member __.unchecked_addition_info = v_unchecked_addition_info member __.unchecked_subtraction_info = v_unchecked_subtraction_info + member __.unchecked_multiply_info = v_unchecked_multiply_info + member __.unchecked_division_info = v_unchecked_division_info + member __.unchecked_modulus_info = v_unchecked_modulus_info + member __.unchecked_unary_plus_info = v_unchecked_unary_plus_info + member __.unchecked_unary_minus_info = v_unchecked_unary_minus_info + member __.unchecked_unary_not_info = v_unchecked_unary_not_info + + member __.byte_operator_info = v_byte_operator_info + member __.sbyte_operator_info = v_sbyte_operator_info + member __.int16_operator_info = v_int16_operator_info + member __.uint16_operator_info = v_uint16_operator_info + member __.int_operator_info = v_int_operator_info + member __.enum_operator_info = v_enum_operator_info + member __.int32_operator_info = v_int32_operator_info + member __.uint32_operator_info = v_uint32_operator_info + member __.int64_operator_info = v_int64_operator_info + member __.uint64_operator_info = v_uint64_operator_info + member __.float32_operator_info = v_float32_operator_info + member __.float_operator_info = v_float_operator_info + member __.nativeint_operator_info = v_nativeint_operator_info + member __.unativeint_operator_info = v_unativeint_operator_info + member val compare_operator_vref = ValRefForIntrinsic v_compare_operator_info member val equals_operator_vref = ValRefForIntrinsic v_equals_operator_info member val equals_nullable_operator_vref = ValRefForIntrinsic v_equals_nullable_operator_info @@ -1112,7 +1176,13 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member val invalid_op_vref = ValRefForIntrinsic v_invalid_op_info member val failwithf_vref = ValRefForIntrinsic v_failwithf_info - member __.equals_operator_info = v_equals_operator_info + member __.equals_operator_info = v_equals_operator_info + member __.not_equals_operator = v_not_equals_operator_info + member __.less_than_operator = v_less_than_operator_info + member __.less_than_or_equals_operator = v_less_than_or_equals_operator_info + member __.greater_than_operator = v_greater_than_operator_info + member __.greater_than_or_equals_operator = v_greater_than_or_equals_operator_info + member __.raise_info = v_raise_info member __.failwith_info = v_failwith_info member __.invalid_arg_info = v_invalid_arg_info @@ -1123,14 +1193,13 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member __.methodhandleof_info = v_methodhandleof_info member __.typeof_info = v_typeof_info member __.typedefof_info = v_typedefof_info - member __.array_length_info = v_array_length_info member val reraise_vref = ValRefForIntrinsic v_reraise_info member val methodhandleof_vref = ValRefForIntrinsic v_methodhandleof_info member val typeof_vref = ValRefForIntrinsic v_typeof_info member val sizeof_vref = ValRefForIntrinsic v_sizeof_info member val typedefof_vref = ValRefForIntrinsic v_typedefof_info - member val enum_vref = ValRefForIntrinsic v_enum_info + member val enum_vref = ValRefForIntrinsic v_enum_operator_info member val enumOfValue_vref = ValRefForIntrinsic v_enumOfValue_info member val range_op_vref = ValRefForIntrinsic v_range_op_info member val range_step_op_vref = ValRefForIntrinsic v_range_step_op_info @@ -1192,10 +1261,17 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member __.create_event_info = v_create_event_info member __.seq_to_list_info = v_seq_to_list_info member __.seq_to_array_info = v_seq_to_array_info + + member __.array_length_info = v_array_length_info member __.array_get_info = v_array_get_info - member __.array2D_get_info = v_array2D_get_info - member __.array3D_get_info = v_array3D_get_info - member __.array4D_get_info = v_array4D_get_info + member __.array2D_get_info = v_array2D_get_info + member __.array3D_get_info = v_array3D_get_info + member __.array4D_get_info = v_array4D_get_info + member __.array_set_info = v_array_set_info + member __.array2D_set_info = v_array2D_set_info + member __.array3D_set_info = v_array3D_set_info + member __.array4D_set_info = v_array4D_set_info + member __.deserialize_quoted_FSharp_20_plus_info = v_deserialize_quoted_FSharp_20_plus_info member __.deserialize_quoted_FSharp_40_plus_info = v_deserialize_quoted_FSharp_40_plus_info member __.cast_quotation_info = v_cast_quotation_info diff --git a/src/fsharp/service/service.fs b/src/fsharp/service/service.fs index 7aa003b87f9..32b2cf030cb 100644 --- a/src/fsharp/service/service.fs +++ b/src/fsharp/service/service.fs @@ -1797,7 +1797,7 @@ type FSharpCheckProjectResults(projectFileName:string, tcConfigOption, keepAssem | None -> invalidOp ("The project has no results due to critical errors in the project options. Check the HasCriticalErrors before accessing the detaild results. Errors: " + String.concat "\n" [ for e in errors -> e.Message ]) | Some d -> d - let tcConfig() = + let getTcConfig() = match tcConfigOption with | None -> invalidOp ("The project has no results due to critical errors in the project options. Check the HasCriticalErrors before accessing the detaild results. Errors: " + String.concat "\n" [ for e in errors -> e.Message ]) | Some d -> d @@ -1809,7 +1809,7 @@ type FSharpCheckProjectResults(projectFileName:string, tcConfigOption, keepAssem member info.AssemblySignature = let (tcGlobals, tcImports, thisCcu, ccuSig, _tcSymbolUses, topAttribs, _tcAssemblyData, _ilAssemRef, _ad, _tcAssemblyExpr, _dependencyFiles) = getDetails() FSharpAssemblySignature(tcGlobals, thisCcu, tcImports, topAttribs, ccuSig) - + member info.TypedImplementionFiles = if not keepAssemblyContents then invalidOp "The 'keepAssemblyContents' flag must be set to true on the FSharpChecker in order to access the checked contents of assemblies" let (tcGlobals, tcImports, thisCcu, _ccuSig, _tcSymbolUses, _topAttribs, _tcAssemblyData, _ilAssemRef, _ad, tcAssemblyExpr, _dependencyFiles) = getDetails() @@ -1821,13 +1821,13 @@ type FSharpCheckProjectResults(projectFileName:string, tcConfigOption, keepAssem member info.AssemblyContents = FSharpAssemblyContents(info.TypedImplementionFiles) - member info.OptimizedAssemblyContents = let tcGlobals, thisCcu, tcImports, mimpls = info.TypedImplementionFiles let outfile = null let importMap = tcImports.GetImportMap() let optEnv0 = GetInitialOptimizationEnv (tcImports, tcGlobals) - let optimizedImpls, _optimizationData, _ = ApplyAllOptimizations (tcConfig(), tcGlobals, (LightweightTcValForUsingInBuildMethodCall tcGlobals), outfile, importMap, false, optEnv0, thisCcu, mimpls) + let tcConfig = getTcConfig() + let optimizedImpls, _optimizationData, _ = ApplyAllOptimizations (tcConfig, tcGlobals, (LightweightTcValForUsingInBuildMethodCall tcGlobals), outfile, importMap, false, optEnv0, thisCcu, mimpls) let mimpls = match optimizedImpls with | TypedAssemblyAfterOptimization files -> diff --git a/src/fsharp/symbols/Exprs.fs b/src/fsharp/symbols/Exprs.fs index 8d15a98ae96..0d1474e0b0f 100644 --- a/src/fsharp/symbols/Exprs.fs +++ b/src/fsharp/symbols/Exprs.fs @@ -197,6 +197,62 @@ module FSharpExprConvert = | Expr.Op(TOp.ValFieldSet rfref, _, _, _) when IsStaticInitializationField rfref -> Some () | _ -> None + let (|ILUnaryOp|_|) e = + match e with + | AI_neg -> Some mkCallUnaryNegOperator + | AI_not -> Some mkCallUnaryNotOperator + | _ -> None + + let (|ILBinaryOp|_|) e = + match e with + | AI_add + | AI_add_ovf + | AI_add_ovf_un -> Some mkCallAdditionOperator + | AI_sub + | AI_sub_ovf + | AI_sub_ovf_un -> Some mkCallSubtractionOperator + | AI_mul + | AI_mul_ovf + | AI_mul_ovf_un -> Some mkCallMultiplyOperator + | AI_div + | AI_div_un -> Some mkCallDivisionOperator + | AI_rem + | AI_rem_un -> Some mkCallModulusOperator + | AI_ceq -> Some mkCallEqualsOperator + | AI_clt + | AI_clt_un -> Some mkCallLessThanOperator + | AI_cgt + | AI_cgt_un -> Some mkCallGreaterThanOperator + | AI_and -> Some mkCallBitwiseAndOperator + | AI_or -> Some mkCallBitwiseOrOperator + | AI_xor -> Some mkCallBitwiseXorOperator + | AI_shl -> Some mkCallShiftLeftOperator + | AI_shr + | AI_shr_un -> Some mkCallShiftRightOperator + | _ -> None + + let (|ILConvertOp|_|) e = + match e with + | AI_conv basicTy + | AI_conv_ovf basicTy + | AI_conv_ovf_un basicTy -> + match basicTy with + | DT_R -> None + | DT_I1 -> Some mkCallToSByteOperator + | DT_U1 -> Some mkCallToByteOperator + | DT_I2 -> Some mkCallToInt16Operator + | DT_U2 -> Some mkCallToUInt16Operator + | DT_I4 -> Some mkCallToInt32Operator + | DT_U4 -> Some mkCallToUInt32Operator + | DT_I8 -> Some mkCallToInt64Operator + | DT_U8 -> Some mkCallToUInt64Operator + | DT_R4 -> Some mkCallToSingleOperator + | DT_R8 -> Some mkCallToDoubleOperator + | DT_I -> Some mkCallToIntPtrOperator + | DT_U -> Some mkCallToUIntPtrOperator + | DT_REF -> None + | _ -> None + let ConvType cenv typ = FSharpType(cenv, typ) let ConvTypes cenv typs = List.map (ConvType cenv) typs let ConvILTypeRefApp (cenv:Impl.cenv) m tref tyargs = @@ -530,11 +586,43 @@ module FSharpExprConvert = let argR = ConvExpr cenv env arg E.ILFieldSet(None, typR, fspec.Name, argR) + | TOp.ILAsm([ AI_ldnull; AI_cgt_un ], _), _, [arg] -> + let elemTy = tyOfExpr cenv.g arg + let nullVal = mkNull m elemTy + let op = mkCallNotEqualsOperator cenv.g m elemTy arg nullVal + ConvExprPrim cenv env op + + | TOp.ILAsm([ I_ldlen; AI_conv DT_I4 ], _), _, [arr] -> + let arrayTy = tyOfExpr cenv.g arr + let elemTy = destArrayTy cenv.g arrayTy + let op = mkCallArrayLength cenv.g m elemTy arr + ConvExprPrim cenv env op + + | TOp.ILAsm([ I_newarr (ILArrayShape [(Some 0, None)], _)], _), [elemTy], xa -> + E.NewArray(ConvType cenv elemTy, ConvExprs cenv env xa) + + | TOp.ILAsm([ I_ldelem_any (ILArrayShape [(Some 0, None)], _)], _), [elemTy], [arr; idx1] -> + let op = mkCallArrayGet cenv.g m elemTy arr idx1 + ConvExprPrim cenv env op - | TOp.ILAsm([ AI_ceq ], _), _, [arg1;arg2] -> + | TOp.ILAsm([ I_stelem_any (ILArrayShape [(Some 0, None)], _)], _), [elemTy], [arr; idx1; v] -> + let op = mkCallArraySet cenv.g m elemTy arr idx1 v + ConvExprPrim cenv env op + + | TOp.ILAsm([ ILUnaryOp unaryOp ], _), _, [arg] -> + let ty = tyOfExpr cenv.g arg + let op = unaryOp cenv.g m ty arg + ConvExprPrim cenv env op + + | TOp.ILAsm([ ILBinaryOp binaryOp ], _), _, [arg1;arg2] -> let ty = tyOfExpr cenv.g arg1 - let eq = mkCallEqualsOperator cenv.g m ty arg1 arg2 - ConvExprPrim cenv env eq + let op = binaryOp cenv.g m ty arg1 arg2 + ConvExprPrim cenv env op + + | TOp.ILAsm([ ILConvertOp convertOp ], _), _, [arg] -> + let ty = tyOfExpr cenv.g arg + let op = convertOp cenv.g m ty arg + ConvExprPrim cenv env op | TOp.ILAsm([ I_throw ], _), _, [arg1] -> let raiseExpr = mkCallRaise cenv.g m (tyOfExpr cenv.g expr) arg1 @@ -603,17 +691,18 @@ module FSharpExprConvert = | TOp.While _, [], [Expr.Lambda(_, _, _, [_], test, _, _);Expr.Lambda(_, _, _, [_], body, _, _)] -> E.WhileLoop(ConvExpr cenv env test, ConvExpr cenv env body) - | TOp.For(_, (FSharpForLoopUp |FSharpForLoopDown as dir) ), [], [Expr.Lambda(_, _, _, [_], lim0, _, _); Expr.Lambda(_, _, _, [_], SimpleArrayLoopUpperBound, lm, _); SimpleArrayLoopBody cenv.g (arr, elemTy, body)] -> + | TOp.For(_, dir), [], [Expr.Lambda(_, _, _, [_], lim0, _, _); Expr.Lambda(_, _, _, [_], SimpleArrayLoopUpperBound, lm, _); SimpleArrayLoopBody cenv.g (arr, elemTy, body)] -> let lim1 = let len = mkCallArrayLength cenv.g lm elemTy arr // Array.length arr - mkCallSubtractionOperator cenv.g lm cenv.g.int32_ty len (Expr.Const(Const.Int32 1, m, cenv.g.int32_ty)) // len - 1 - E.FastIntegerForLoop(ConvExpr cenv env lim0, ConvExpr cenv env lim1, ConvExpr cenv env body, (dir = FSharpForLoopUp)) - - | TOp.For(_, dir), [], [Expr.Lambda(_, _, _, [_], lim0, _, _);Expr.Lambda(_, _, _, [_], lim1, _, _);body] -> - match dir with - | FSharpForLoopUp -> E.FastIntegerForLoop(ConvExpr cenv env lim0, ConvExpr cenv env lim1, ConvExpr cenv env body, true) - | FSharpForLoopDown -> E.FastIntegerForLoop(ConvExpr cenv env lim0, ConvExpr cenv env lim1, ConvExpr cenv env body, false) - | _ -> failwith "unexpected for-loop form" + mkCallSubtractionOperator cenv.g lm cenv.g.int32_ty len (mkOne cenv.g lm) // len - 1 + E.FastIntegerForLoop(ConvExpr cenv env lim0, ConvExpr cenv env lim1, ConvExpr cenv env body, dir <> FSharpForLoopDown) + + | TOp.For(_, dir), [], [Expr.Lambda(_, _, _, [_], lim0, _, _); Expr.Lambda(_, _, _, [_], lim1, lm, _); body] -> + let lim1 = + if dir = CSharpForLoopUp then + mkCallSubtractionOperator cenv.g lm cenv.g.int32_ty lim1 (mkOne cenv.g lm) // len - 1 + else lim1 + E.FastIntegerForLoop(ConvExpr cenv env lim0, ConvExpr cenv env lim1, ConvExpr cenv env body, dir <> FSharpForLoopDown) | TOp.ILCall(_, _, _, isNewObj, valUseFlags, _isProp, _, ilMethRef, enclTypeArgs, methTypeArgs, _tys), [], callArgs -> ConvILCall cenv env (isNewObj, valUseFlags, ilMethRef, enclTypeArgs, methTypeArgs, callArgs, m) From 4bd6d691e2ed29be9d2c65612a3c1f045f23c473 Mon Sep 17 00:00:00 2001 From: ncave Date: Wed, 29 Nov 2017 15:53:39 -0800 Subject: [PATCH 05/21] More ILAsm replacements --- ...FSharp.Compiler.Service.netstandard.fsproj | 1 + src/fsharp/TastOps.fs | 6 ++++- src/fsharp/TastOps.fsi | 3 +++ src/fsharp/TcGlobals.fs | 6 +++++ src/fsharp/service/service.fs | 4 +-- src/fsharp/service/service.fsi | 2 +- src/fsharp/symbols/Exprs.fs | 26 ++++++++++++++++++- 7 files changed, 43 insertions(+), 5 deletions(-) diff --git a/fcs/FSharp.Compiler.Service.netstandard/FSharp.Compiler.Service.netstandard.fsproj b/fcs/FSharp.Compiler.Service.netstandard/FSharp.Compiler.Service.netstandard.fsproj index 5b035b3c9fc..7da5e390d94 100644 --- a/fcs/FSharp.Compiler.Service.netstandard/FSharp.Compiler.Service.netstandard.fsproj +++ b/fcs/FSharp.Compiler.Service.netstandard/FSharp.Compiler.Service.netstandard.fsproj @@ -82,6 +82,7 @@ FSStrings.resx FSStrings.resources + fsstrings.resources --module Microsoft.FSharp.Compiler.AbstractIL.Internal.AsciiParser --open Microsoft.FSharp.Compiler.AbstractIL --internal --lexlib Internal.Utilities.Text.Lexing --parslib Internal.Utilities.Text.Parsing diff --git a/src/fsharp/TastOps.fs b/src/fsharp/TastOps.fs index 226e994c8d6..e34f9ea13ee 100644 --- a/src/fsharp/TastOps.fs +++ b/src/fsharp/TastOps.fs @@ -6164,10 +6164,14 @@ let mkCallArray2DSet (g:TcGlobals) m ty e1 idx1 idx2 v = mkApps g (typed let mkCallArray3DSet (g:TcGlobals) m ty e1 idx1 idx2 idx3 v = mkApps g (typedExprForIntrinsic g m g.array3D_set_info, [[ty]], [ e1 ; idx1; idx2; idx3; v ], m) let mkCallArray4DSet (g:TcGlobals) m ty e1 idx1 idx2 idx3 idx4 v = mkApps g (typedExprForIntrinsic g m g.array4D_set_info, [[ty]], [ e1 ; idx1; idx2; idx3; idx4; v ], m) +let mkCallBox (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.box_info, [[ty]], [ e1 ], m) +let mkCallIsNull (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.isnull_info, [[ty]], [ e1 ], m) +let mkCallIsNotNull (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.isnotnull_info, [[ty]], [ e1 ], m) +let mkCallRaise (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.raise_info, [[ty]], [ e1 ], m) + let mkCallNewDecimal (g:TcGlobals) m (e1, e2, e3, e4, e5) = mkApps g (typedExprForIntrinsic g m g.new_decimal_info, [], [ e1;e2;e3;e4;e5 ], m) let mkCallNewFormat (g:TcGlobals) m aty bty cty dty ety e1 = mkApps g (typedExprForIntrinsic g m g.new_format_info, [[aty;bty;cty;dty;ety]], [ e1 ], m) -let mkCallRaise (g:TcGlobals) m aty e1 = mkApps g (typedExprForIntrinsic g m g.raise_info, [[aty]], [ e1 ], m) let TryEliminateDesugaredConstants g m c = match c with diff --git a/src/fsharp/TastOps.fsi b/src/fsharp/TastOps.fsi index 0de158c052e..1366bcea8ba 100755 --- a/src/fsharp/TastOps.fsi +++ b/src/fsharp/TastOps.fsi @@ -1206,6 +1206,9 @@ val mkCallArray2DSet : TcGlobals -> range -> TType -> Expr -> Expr -> Ex val mkCallArray3DSet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr val mkCallArray4DSet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr +val mkCallBox : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallIsNull : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallIsNotNull : TcGlobals -> range -> TType -> Expr -> Expr val mkCallRaise : TcGlobals -> range -> TType -> Expr -> Expr val mkCallGenericComparisonWithComparerOuter : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr diff --git a/src/fsharp/TcGlobals.fs b/src/fsharp/TcGlobals.fs index e89a3043acb..c9b631b94d2 100755 --- a/src/fsharp/TcGlobals.fs +++ b/src/fsharp/TcGlobals.fs @@ -588,6 +588,9 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d let v_nativeint_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "nativeint" , None , Some "ToIntPtr", [vara], ([[varaTy]], v_nativeint_ty)) let v_unativeint_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "unativeint" , None , Some "ToUIntPtr", [vara], ([[varaTy]], v_unativeint_ty)) + let v_box_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "box" , None , Some "Box" , [vara], ([[varaTy]], v_obj_ty)) + let v_isnull_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "isNull" , None , Some "IsNull" , [vara], ([[varaTy]], v_bool_ty)) + let v_isnotnull_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "isNotNull" , None , Some "IsNotNull" , [vara], ([[varaTy]], v_bool_ty)) let v_raise_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "raise" , None , Some "Raise" , [vara], ([[mkSysNonGenericTy sys "Exception"]], varaTy)) let v_failwith_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "failwith" , None , Some "FailWith" , [vara], ([[v_string_ty]], varaTy)) let v_invalid_arg_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "invalidArg" , None , Some "InvalidArg" , [vara], ([[v_string_ty]; [v_string_ty]], varaTy)) @@ -1183,6 +1186,9 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member __.greater_than_operator = v_greater_than_operator_info member __.greater_than_or_equals_operator = v_greater_than_or_equals_operator_info + member __.box_info = v_box_info + member __.isnull_info = v_isnull_info + member __.isnotnull_info = v_isnotnull_info member __.raise_info = v_raise_info member __.failwith_info = v_failwith_info member __.invalid_arg_info = v_invalid_arg_info diff --git a/src/fsharp/service/service.fs b/src/fsharp/service/service.fs index 32b2cf030cb..63963c07970 100644 --- a/src/fsharp/service/service.fs +++ b/src/fsharp/service/service.fs @@ -1821,9 +1821,9 @@ type FSharpCheckProjectResults(projectFileName:string, tcConfigOption, keepAssem member info.AssemblyContents = FSharpAssemblyContents(info.TypedImplementionFiles) - member info.OptimizedAssemblyContents = + member info.GetOptimizedAssemblyContents() = let tcGlobals, thisCcu, tcImports, mimpls = info.TypedImplementionFiles - let outfile = null + let outfile = "" // only used if tcConfig.writeTermsToFiles is true let importMap = tcImports.GetImportMap() let optEnv0 = GetInitialOptimizationEnv (tcImports, tcGlobals) let tcConfig = getTcConfig() diff --git a/src/fsharp/service/service.fsi b/src/fsharp/service/service.fsi index 71c1e991c87..b1abfc8ed81 100755 --- a/src/fsharp/service/service.fsi +++ b/src/fsharp/service/service.fsi @@ -270,7 +270,7 @@ type public FSharpCheckProjectResults = member AssemblyContents: FSharpAssemblyContents /// Get an optimized view of the overall contents of the assembly. Only valid to use if HasCriticalErrors is false. - member OptimizedAssemblyContents: FSharpAssemblyContents + member GetOptimizedAssemblyContents: unit -> FSharpAssemblyContents /// Get the resolution of the ProjectOptions member ProjectContext: FSharpProjectContext diff --git a/src/fsharp/symbols/Exprs.fs b/src/fsharp/symbols/Exprs.fs index 0d1474e0b0f..db57fbfaa61 100644 --- a/src/fsharp/symbols/Exprs.fs +++ b/src/fsharp/symbols/Exprs.fs @@ -237,7 +237,7 @@ module FSharpExprConvert = | AI_conv_ovf basicTy | AI_conv_ovf_un basicTy -> match basicTy with - | DT_R -> None + | DT_R -> Some mkCallToDoubleOperator | DT_I1 -> Some mkCallToSByteOperator | DT_U1 -> Some mkCallToByteOperator | DT_I2 -> Some mkCallToInt16Operator @@ -586,8 +586,31 @@ module FSharpExprConvert = let argR = ConvExpr cenv env arg E.ILFieldSet(None, typR, fspec.Name, argR) + | TOp.ILAsm([ ], _), _, [arg] -> + ConvExprPrim cenv env arg + + | TOp.ILAsm([ I_box _ ], _), [ty], [arg] -> + let op = mkCallBox cenv.g m ty arg + ConvExprPrim cenv env op + + | TOp.ILAsm([ I_unbox_any _ ], _), [ty], [arg] -> + let op = mkCallUnbox cenv.g m ty arg + ConvExprPrim cenv env op + + | TOp.ILAsm([ I_isinst _ ], _), [ty], [arg] -> + let op = mkCallTypeTest cenv.g m ty arg + ConvExprPrim cenv env op + + | TOp.ILAsm([ I_ldtoken _ ], _), [ty], _ -> + let op = mkCallTypeOf cenv.g m ty + ConvExprPrim cenv env op + + | TOp.ILAsm([ EI_ilzero _ ], _), [ty], _ -> + E.DefaultValue (ConvType cenv ty) + | TOp.ILAsm([ AI_ldnull; AI_cgt_un ], _), _, [arg] -> let elemTy = tyOfExpr cenv.g arg + // let op = mkCallIsNotNull cenv.g m elemTy arg let nullVal = mkNull m elemTy let op = mkCallNotEqualsOperator cenv.g m elemTy arg nullVal ConvExprPrim cenv env op @@ -619,6 +642,7 @@ module FSharpExprConvert = let op = binaryOp cenv.g m ty arg1 arg2 ConvExprPrim cenv env op + | TOp.ILAsm([ ILConvertOp _ ; ILConvertOp convertOp ], _), _, [arg] | TOp.ILAsm([ ILConvertOp convertOp ], _), _, [arg] -> let ty = tyOfExpr cenv.g arg let op = convertOp cenv.g m ty arg From c9ce53f43bd0bd322945447c966cb1c457dd19e8 Mon Sep 17 00:00:00 2001 From: ncave <777696+ncave@users.noreply.github.com> Date: Fri, 22 Dec 2017 08:22:42 -0800 Subject: [PATCH 06/21] update resource name --- .../FSharp.Compiler.Service.netstandard.fsproj | 1 - 1 file changed, 1 deletion(-) diff --git a/fcs/FSharp.Compiler.Service.netstandard/FSharp.Compiler.Service.netstandard.fsproj b/fcs/FSharp.Compiler.Service.netstandard/FSharp.Compiler.Service.netstandard.fsproj index 7da5e390d94..5b035b3c9fc 100644 --- a/fcs/FSharp.Compiler.Service.netstandard/FSharp.Compiler.Service.netstandard.fsproj +++ b/fcs/FSharp.Compiler.Service.netstandard/FSharp.Compiler.Service.netstandard.fsproj @@ -82,7 +82,6 @@ FSStrings.resx FSStrings.resources - fsstrings.resources --module Microsoft.FSharp.Compiler.AbstractIL.Internal.AsciiParser --open Microsoft.FSharp.Compiler.AbstractIL --internal --lexlib Internal.Utilities.Text.Lexing --parslib Internal.Utilities.Text.Parsing From 14b775ca44b339a67b095f43186bf647428a61a6 Mon Sep 17 00:00:00 2001 From: ncave <777696+ncave@users.noreply.github.com> Date: Sat, 20 Jan 2018 10:02:45 -0800 Subject: [PATCH 07/21] Added some tests (#40) * Add option to toggle unused declarations analyzer (#4074) * Add option to toggle unused declarations analyzer * Better name and handle registering code fixes. This will ensure that if someone uses warnon:1182, we won't suggest fixes if they've turned off the feature. * Revert #1650 (and #3366) (#4173) * Fix error logging in brace matching code (#4140) * Remove error logger pushing code * Update service.fs * Fix #4200: Vsix: fix empty "New file" window for web projects (#4202) * LOC CHECKIN | visualfsharp - master | 20180112 (#4194) * Fixed FCS netcore tests (#4180) * Remove ambiguous resolution error FS0332 (#4170) * Add IsInteractive to parsing options for script load closures (#4169) * Add IsInteractive to FSharpParsingOptions * Add test * Set serializable bit for all serializable types (#4211) * Minor fix (#4195) on string 58. * Symbols API: add Index to active pattern case, Name to pattern group (#4222) * Symbols API: add Index to active pattern case, Name to pattern group * Symbols API: add active pattern case use tests * don't rebuild (#4230) * Optimize in FCS * Transport tcConfig * Cleanup * Replace more ILAsm in Exprs * More ILAsm replacements * update resource name * Added some tests --- .gitignore | 2 + TESTGUIDE.md | 4 +- ...harp.Compiler.Service.Tests.netcore.fsproj | 32 ++-- .../FSharp.Compiler.Service.Tests.fsproj | 3 + src/fsharp/ConstraintSolver.fs | 58 +++----- src/fsharp/FSComp.txt | 1 - src/fsharp/FSharp.Build/WriteCodeFragment.fs | 10 +- src/fsharp/IlxGen.fs | 22 ++- src/fsharp/TcGlobals.fs | 1 - src/fsharp/TypeRelations.fs | 3 +- src/fsharp/fsc.fs | 4 +- src/fsharp/service/ServiceUntypedParse.fs | 4 +- src/fsharp/service/ServiceUntypedParse.fsi | 2 +- src/fsharp/service/service.fs | 52 ++++--- src/fsharp/service/service.fsi | 11 +- src/fsharp/symbols/Symbols.fs | 6 +- src/fsharp/symbols/Symbols.fsi | 9 +- src/fsharp/xlf/FSComp.txt.cs.xlf | 5 - src/fsharp/xlf/FSComp.txt.de.xlf | 5 - src/fsharp/xlf/FSComp.txt.en.xlf | 5 - src/fsharp/xlf/FSComp.txt.es.xlf | 5 - src/fsharp/xlf/FSComp.txt.fr.xlf | 5 - src/fsharp/xlf/FSComp.txt.it.xlf | 5 - src/fsharp/xlf/FSComp.txt.ja.xlf | 5 - src/fsharp/xlf/FSComp.txt.ko.xlf | 5 - src/fsharp/xlf/FSComp.txt.pl.xlf | 5 - src/fsharp/xlf/FSComp.txt.pt-BR.xlf | 5 - src/fsharp/xlf/FSComp.txt.ru.xlf | 5 - src/fsharp/xlf/FSComp.txt.tr.xlf | 5 - src/fsharp/xlf/FSComp.txt.zh-Hans.xlf | 5 - src/fsharp/xlf/FSComp.txt.zh-Hant.xlf | 15 +- tests/fsharp/core/subtype/test.fsx | 38 +++++ .../OverloadingMembers/OverloadsAndSRTPs01.fs | 38 +++++ .../OverloadingMembers/RecursiveOverload01.fs | 26 ++++ .../SlowOverloadResolution.fs | 4 +- .../OverloadingMembers/env.lst | 2 + .../E_LexicalScoping01.fs | 5 +- .../E_MemberConstraint01.fs | 3 +- ...reSDK_FSharp_Library_netstandard1.6.fsproj | 8 +- .../Library1.fs | 4 + ...reSDK_FSharp_Library_netstandard2_0.fsproj | 8 + tests/scripts/compiler-perf-results.txt | 1 - tests/service/Common.fs | 7 +- tests/service/EditorTests.fs | 12 +- tests/service/ExprTests.fs | 139 +++++++++++++++++- tests/service/PerfTests.fs | 9 +- tests/service/Program.fs | 10 +- tests/service/ProjectOptionsTests.fs | 43 +++++- tests/service/Symbols.fs | 57 +++++++ .../Template/xlf/Tutorial.fsx.ja.xlf | 2 +- .../Vsix/RegisterFsharpPackage.pkgdef | 3 + .../CodeFix/AddOpenCodeFixProvider.fs | 2 +- .../ImplementInterfaceCodeFixProvider.fs | 2 +- .../CodeFix/RenameUnusedValue.fs | 5 +- .../Diagnostics/UnusedDeclarationsAnalyzer.fs | 2 + .../DocumentHighlightsService.fs | 2 +- .../Formatting/EditorFormattingService.fs | 2 +- .../Formatting/IndentationService.fs | 2 +- .../InlineRename/InlineRenameService.fs | 2 +- .../LanguageService/LanguageService.fs | 4 +- .../LanguageService/SymbolHelpers.fs | 4 +- .../Navigation/FindUsagesService.fs | 2 +- .../Navigation/GoToDefinitionService.fs | 4 +- .../FSharp.Editor/Options/EditorOptions.fs | 6 +- .../QuickInfo/QuickInfoProvider.fs | 6 +- .../ProjectSitesAndFiles.fs | 7 +- .../xlf/VSPackage.zh-Hant.xlf | 2 +- .../xlf/DebugPropPage.zh-Hant.xlf | 2 +- ....VisualStudio.Editors.Designer.zh-Hant.xlf | 4 +- .../CodeFixesOptionControl.xaml | 2 + .../FSharp.UIResources/Strings.Designer.cs | 11 +- .../src/FSharp.UIResources/Strings.resx | 3 + .../src/FSharp.UIResources/xlf/Strings.cs.xlf | 5 + .../src/FSharp.UIResources/xlf/Strings.de.xlf | 5 + .../src/FSharp.UIResources/xlf/Strings.en.xlf | 5 + .../src/FSharp.UIResources/xlf/Strings.es.xlf | 5 + .../src/FSharp.UIResources/xlf/Strings.fr.xlf | 5 + .../src/FSharp.UIResources/xlf/Strings.it.xlf | 5 + .../src/FSharp.UIResources/xlf/Strings.ja.xlf | 5 + .../src/FSharp.UIResources/xlf/Strings.ko.xlf | 5 + .../src/FSharp.UIResources/xlf/Strings.pl.xlf | 5 + .../FSharp.UIResources/xlf/Strings.pt-BR.xlf | 5 + .../src/FSharp.UIResources/xlf/Strings.ru.xlf | 5 + .../src/FSharp.UIResources/xlf/Strings.tr.xlf | 5 + .../xlf/Strings.zh-Hans.xlf | 5 + .../xlf/Strings.zh-Hant.xlf | 5 + .../unittests/VisualFSharp.UnitTests.fsproj | 5 +- 87 files changed, 620 insertions(+), 254 deletions(-) create mode 100644 tests/fsharpqa/Source/Conformance/DeclarationElements/MemberDefinitions/OverloadingMembers/OverloadsAndSRTPs01.fs create mode 100644 tests/fsharpqa/Source/Conformance/DeclarationElements/MemberDefinitions/OverloadingMembers/RecursiveOverload01.fs create mode 100644 tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard2_0/Library1.fs create mode 100644 tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard2_0/Sample_NETCoreSDK_FSharp_Library_netstandard2_0.fsproj create mode 100644 tests/service/Symbols.fs diff --git a/.gitignore b/.gitignore index 7450e14a294..236ddf853f2 100644 --- a/.gitignore +++ b/.gitignore @@ -125,3 +125,5 @@ tests/fsharpqa/testenv/bin/System.ValueTuple.dll /tests/fcs/ /fcs/.paket/Paket.Restore.targets msbuild.binlog +/fcs/FSharp.Compiler.Service.netstandard/*.fs +/fcs/FSharp.Compiler.Service.netstandard/*.fsi diff --git a/TESTGUIDE.md b/TESTGUIDE.md index 1945d3edd61..408e49d9873 100644 --- a/TESTGUIDE.md +++ b/TESTGUIDE.md @@ -55,7 +55,7 @@ For the FSharpQA suite, the list of test areas and their associated "tags" is st tests\fsharpqa\source\test.lst // FSharpQA suite -Tags are in the left column, paths to to corresponding test folders are in the right column. If no tags are specifie, all tests will be run. +Tags are in the left column, paths to to corresponding test folders are in the right column. If no tags are specified, all tests will be run. If you want to re-run a particular test area, the easiest way to do so is to set a temporary tag for that area in test.lst (e.g. "RERUN") and then pass that as an argument to `build.cmd`: `build.cmd test-net40-fsharpqa include RERUN`. @@ -65,7 +65,7 @@ These are all NUnit tests. You can execute these tests individually via the Visu extension or the command line via `nunit3-console.exe`. Note that for compatibility reasons, the IDE unit tests should be run in a 32-bit process, -using the '--x86' flag to `nunit3-console.exe` +using the `--x86` flag to `nunit3-console.exe` diff --git a/fcs/FSharp.Compiler.Service.Tests.netcore/FSharp.Compiler.Service.Tests.netcore.fsproj b/fcs/FSharp.Compiler.Service.Tests.netcore/FSharp.Compiler.Service.Tests.netcore.fsproj index 71f5341bb71..b9d44ad919f 100644 --- a/fcs/FSharp.Compiler.Service.Tests.netcore/FSharp.Compiler.Service.Tests.netcore.fsproj +++ b/fcs/FSharp.Compiler.Service.Tests.netcore/FSharp.Compiler.Service.Tests.netcore.fsproj @@ -1,7 +1,13 @@  - netcoreapp1.0 - $(DefineConstants);DOTNETCORE;FX_ATLEAST_45;FX_ATLEAST_PORTABLE;FX_NO_RUNTIMEENVIRONMENT;FX_RESHAPED_REFLECTION;TODO_REWORK_ASSEMBLY_LOAD; + netcoreapp2.0 + $(DefineConstants);DOTNETCORE + $(DefineConstants);FX_ATLEAST_45 + $(DefineConstants);FX_ATLEAST_PORTABLE + $(DefineConstants);FX_NO_RUNTIMEENVIRONMENT + $(DefineConstants);FX_RESHAPED_REFLECTION + $(DefineConstants);NO_EXTENSIONTYPING + $(DefineConstants);TODO_REWORK_ASSEMBLY_LOAD $(NoWarn);44; true true @@ -36,25 +42,21 @@ + + Program.fs + - - - - - - - - - - - + + + + - - + + \ No newline at end of file diff --git a/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj b/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj index e83bc805c00..4593e56815f 100644 --- a/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj +++ b/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj @@ -46,6 +46,9 @@ EditorTests.fs + + Symbols.fs + FileSystemTests.fs diff --git a/src/fsharp/ConstraintSolver.fs b/src/fsharp/ConstraintSolver.fs index ff3cf43c2f1..d247366288e 100644 --- a/src/fsharp/ConstraintSolver.fs +++ b/src/fsharp/ConstraintSolver.fs @@ -370,7 +370,6 @@ let ShowAccessDomain ad = // Solve exception NonRigidTypar of DisplayEnv * string option * range * TType * TType * range -exception LocallyAbortOperationThatFailsToResolveOverload exception LocallyAbortOperationThatLosesAbbrevs let localAbortD = ErrorD LocallyAbortOperationThatLosesAbbrevs @@ -739,19 +738,19 @@ and solveTypMeetsTyparConstraints (csenv:ConstraintSolverEnv) ndeep m2 trace ty | Some destTypar -> AddConstraint csenv ndeep m2 trace destTypar (TyparConstraint.DefaultsTo(priority, dty, m)) - | TyparConstraint.SupportsNull m2 -> SolveTypSupportsNull csenv ndeep m2 trace ty - | TyparConstraint.IsEnum(underlying, m2) -> SolveTypIsEnum csenv ndeep m2 trace ty underlying - | TyparConstraint.SupportsComparison(m2) -> SolveTypeSupportsComparison csenv ndeep m2 trace ty - | TyparConstraint.SupportsEquality(m2) -> SolveTypSupportsEquality csenv ndeep m2 trace ty + | TyparConstraint.SupportsNull m2 -> SolveTypSupportsNull csenv ndeep m2 trace ty + | TyparConstraint.IsEnum(underlying, m2) -> SolveTypIsEnum csenv ndeep m2 trace ty underlying + | TyparConstraint.SupportsComparison(m2) -> SolveTypeSupportsComparison csenv ndeep m2 trace ty + | TyparConstraint.SupportsEquality(m2) -> SolveTypSupportsEquality csenv ndeep m2 trace ty | TyparConstraint.IsDelegate(aty, bty, m2) -> SolveTypIsDelegate csenv ndeep m2 trace ty aty bty - | TyparConstraint.IsNonNullableStruct m2 -> SolveTypIsNonNullableValueType csenv ndeep m2 trace ty - | TyparConstraint.IsUnmanaged m2 -> SolveTypIsUnmanaged csenv ndeep m2 trace ty - | TyparConstraint.IsReferenceType m2 -> SolveTypIsReferenceType csenv ndeep m2 trace ty - | TyparConstraint.RequiresDefaultConstructor m2 -> SolveTypRequiresDefaultConstructor csenv ndeep m2 trace ty + | TyparConstraint.IsNonNullableStruct m2 -> SolveTypIsNonNullableValueType csenv ndeep m2 trace ty + | TyparConstraint.IsUnmanaged m2 -> SolveTypIsUnmanaged csenv ndeep m2 trace ty + | TyparConstraint.IsReferenceType m2 -> SolveTypIsReferenceType csenv ndeep m2 trace ty + | TyparConstraint.RequiresDefaultConstructor m2 -> SolveTypRequiresDefaultConstructor csenv ndeep m2 trace ty | TyparConstraint.SimpleChoice(tys, m2) -> SolveTypChoice csenv ndeep m2 trace ty tys | TyparConstraint.CoercesTo(ty2, m2) -> SolveTypSubsumesTypKeepAbbrevs csenv ndeep m2 trace None ty2 ty - | TyparConstraint.MayResolveMember(traitInfo, m2) -> - SolveMemberConstraint csenv false false ndeep m2 trace traitInfo ++ (fun _ -> CompleteD) + | TyparConstraint.MayResolveMember(traitInfo, m2) -> + SolveMemberConstraint csenv false ndeep m2 trace traitInfo ++ (fun _ -> CompleteD) ))) @@ -761,6 +760,7 @@ and SolveTypEqualsTyp (csenv:ConstraintSolverEnv) ndeep m2 (trace: OptionalTrace let ndeep = ndeep + 1 let aenv = csenv.EquivEnv let g = csenv.g + if ty1 === ty2 then CompleteD else match cxsln with | Some (traitInfo, traitSln) when traitInfo.Solution.IsNone -> @@ -768,8 +768,6 @@ and SolveTypEqualsTyp (csenv:ConstraintSolverEnv) ndeep m2 (trace: OptionalTrace TransactMemberConstraintSolution traitInfo trace traitSln | _ -> () - if ty1 === ty2 then CompleteD else - let canShortcut = not trace.HasTrace let sty1 = stripTyEqnsA csenv.g canShortcut ty1 let sty2 = stripTyEqnsA csenv.g canShortcut ty2 @@ -943,7 +941,7 @@ and SolveDimensionlessNumericType (csenv:ConstraintSolverEnv) ndeep m2 trace ty /// We pretend int and other types support a number of operators. In the actual IL for mscorlib they /// don't, however the type-directed static optimization rules in the library code that makes use of this /// will deal with the problem. -and SolveMemberConstraint (csenv:ConstraintSolverEnv) ignoreUnresolvedOverload permitWeakResolution ndeep m2 trace (TTrait(tys, nm, memFlags, argtys, rty, sln)): OperationResult = +and SolveMemberConstraint (csenv:ConstraintSolverEnv) permitWeakResolution ndeep m2 trace (TTrait(tys,nm,memFlags,argtys,rty,sln)) : OperationResult = // Do not re-solve if already solved if sln.Value.IsSome then ResultD true else let g = csenv.g @@ -1300,12 +1298,9 @@ and SolveMemberConstraint (csenv:ConstraintSolverEnv) ignoreUnresolvedOverload p let frees = GetFreeTyparsOfMemberConstraint csenv traitInfo // If there's nothing left to learn then raise the errors - (if (permitWeakResolution && isNil support) || isNil frees then errors - // Otherwise re-record the trait waiting for canonicalization - else AddMemberConstraint csenv ndeep m2 trace traitInfo support frees) ++ (fun () -> - match errors with - | ErrorResult (_, UnresolvedOverloading _) when not ignoreUnresolvedOverload && (not (nm = "op_Explicit" || nm = "op_Implicit")) -> ErrorD LocallyAbortOperationThatFailsToResolveOverload - | _ -> ResultD TTraitUnsolved) + (if (permitWeakResolution && isNil support) || isNil frees then errors + // Otherwise re-record the trait waiting for canonicalization + else AddMemberConstraint csenv ndeep m2 trace traitInfo support frees) ++ (fun () -> ResultD TTraitUnsolved) ) ++ (fun res -> RecordMemberConstraintSolution csenv.SolverState m trace traitInfo res)) @@ -1447,7 +1442,7 @@ and SolveRelevantMemberConstraintsForTypar (csenv:ConstraintSolverEnv) ndeep per cxs |> AtLeastOneD (fun (traitInfo, m2) -> let csenv = { csenv with m = m2 } - SolveMemberConstraint csenv true permitWeakResolution (ndeep+1) m2 trace traitInfo) + SolveMemberConstraint csenv permitWeakResolution (ndeep+1) m2 trace traitInfo) and CanonicalizeRelevantMemberConstraints (csenv:ConstraintSolverEnv) ndeep trace tps = SolveRelevantMemberConstraints csenv ndeep true trace tps @@ -1962,12 +1957,10 @@ and CanMemberSigsMatchUpToCheck // to allow us to report the outer types involved in the constraint and private SolveTypSubsumesTypWithReport (csenv:ConstraintSolverEnv) ndeep m trace cxsln ty1 ty2 = TryD (fun () -> SolveTypSubsumesTypKeepAbbrevs csenv ndeep m trace cxsln ty1 ty2) - (function - | LocallyAbortOperationThatFailsToResolveOverload -> CompleteD - | res -> - match csenv.eContextInfo with - | ContextInfo.RuntimeTypeTest isOperator -> - // test if we can cast other way around + (fun res -> + match csenv.eContextInfo with + | ContextInfo.RuntimeTypeTest isOperator -> + // test if we can cast other way around match CollectThenUndo (fun newTrace -> SolveTypSubsumesTypKeepAbbrevs csenv ndeep m (OptionalTrace.WithTrace newTrace) cxsln ty2 ty1) with | OkResult _ -> ErrorD (ErrorsFromAddingSubsumptionConstraint(csenv.g, csenv.DisplayEnv, ty1, ty2, res, ContextInfo.DowncastUsedInsteadOfUpcast isOperator, m)) | _ -> ErrorD (ErrorsFromAddingSubsumptionConstraint(csenv.g, csenv.DisplayEnv, ty1, ty2, res, ContextInfo.NoContext, m)) @@ -1975,9 +1968,7 @@ and private SolveTypSubsumesTypWithReport (csenv:ConstraintSolverEnv) ndeep m tr and private SolveTypEqualsTypWithReport (csenv:ConstraintSolverEnv) ndeep m trace cxsln ty1 ty2 = TryD (fun () -> SolveTypEqualsTypKeepAbbrevsWithCxsln csenv ndeep m trace cxsln ty1 ty2) - (function - | LocallyAbortOperationThatFailsToResolveOverload -> CompleteD - | res -> ErrorD (ErrorFromAddingTypeEquation(csenv.g, csenv.DisplayEnv, ty1, ty2, res, m))) + (fun res -> ErrorD (ErrorFromAddingTypeEquation(csenv.g, csenv.DisplayEnv, ty1, ty2, res, m))) and ArgsMustSubsumeOrConvert (csenv:ConstraintSolverEnv) @@ -2543,7 +2534,7 @@ let AddCxTypeMustSubsumeType contextInfo denv css m trace ty1 ty2 = |> RaiseOperationResult let AddCxMethodConstraint denv css m trace traitInfo = - TryD (fun () -> SolveMemberConstraint (MakeConstraintSolverEnv ContextInfo.NoContext css m denv) true false 0 m trace traitInfo ++ (fun _ -> CompleteD)) + TryD (fun () -> SolveMemberConstraint (MakeConstraintSolverEnv ContextInfo.NoContext css m denv) false 0 m trace traitInfo ++ (fun _ -> CompleteD)) (fun res -> ErrorD (ErrorFromAddingConstraint(denv, res, m))) |> RaiseOperationResult @@ -2601,7 +2592,7 @@ let CodegenWitnessThatTypSupportsTraitConstraint tcVal g amap m (traitInfo:Trait InfoReader = new InfoReader(g, amap) } let csenv = MakeConstraintSolverEnv ContextInfo.NoContext css m (DisplayEnv.Empty g) - SolveMemberConstraint csenv true true 0 m NoTrace traitInfo ++ (fun _res -> + SolveMemberConstraint csenv true 0 m NoTrace traitInfo ++ (fun _res -> let sln = match traitInfo.Solution with | None -> Choice4Of4() @@ -2725,5 +2716,4 @@ let IsApplicableMethApprox g amap m (minfo:MethInfo) availObjTy = |> CommitOperationResult | _ -> true else - true - + true \ No newline at end of file diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index deeb8d5daf0..5778f3dd92a 100644 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -161,7 +161,6 @@ FieldNotContainedMutablesDiffer,"The module contains the field\n %s \nbut FieldNotContainedLiteralsDiffer,"The module contains the field\n %s \nbut its signature specifies\n %s \nThe 'literal' modifiers differ" FieldNotContainedTypesDiffer,"The module contains the field\n %s \nbut its signature specifies\n %s \nThe types differ" 331,typrelCannotResolveImplicitGenericInstantiation,"The implicit instantiation of a generic construct at or near this point could not be resolved because it could resolve to multiple unrelated types, e.g. '%s' and '%s'. Consider using type annotations to resolve the ambiguity" -332,typrelCannotResolveAmbiguityInOverloadedOperator,"Could not resolve the ambiguity inherent in the use of the operator '%s' at or near this program point. Consider using type annotations to resolve the ambiguity." 333,typrelCannotResolveAmbiguityInPrintf,"Could not resolve the ambiguity inherent in the use of a 'printf'-style format string" 334,typrelCannotResolveAmbiguityInEnum,"Could not resolve the ambiguity in the use of a generic construct with an 'enum' constraint at or near this position" 335,typrelCannotResolveAmbiguityInDelegate,"Could not resolve the ambiguity in the use of a generic construct with a 'delegate' constraint at or near this position" diff --git a/src/fsharp/FSharp.Build/WriteCodeFragment.fs b/src/fsharp/FSharp.Build/WriteCodeFragment.fs index ee8eaab2830..1002a489b10 100644 --- a/src/fsharp/FSharp.Build/WriteCodeFragment.fs +++ b/src/fsharp/FSharp.Build/WriteCodeFragment.fs @@ -113,15 +113,19 @@ open System.Reflection" let sb = StringBuilder().AppendLine(boilerplate).AppendLine() let code = Array.fold (fun (sb:StringBuilder) (item:ITaskItem) -> sb.AppendLine(WriteCodeFragment.GenerateAttribute item)) sb _assemblyAttributes code.AppendLine().AppendLine("do()") |> ignore + let fileName = _outputFile.ItemSpec let outputFileItem = - if not (isNull _outputFile) && not (isNull _outputDirectory) && not (Path.IsPathRooted(_outputFile.ItemSpec)) then - TaskItem(Path.Combine(_outputDirectory.ItemSpec, _outputFile.ItemSpec)) :> ITaskItem + if not (isNull _outputFile) && not (isNull _outputDirectory) && not (Path.IsPathRooted(fileName)) then + TaskItem(Path.Combine(_outputDirectory.ItemSpec, fileName)) :> ITaskItem elif isNull _outputFile then let tempFile = Path.Combine(Path.GetTempPath(), sprintf "tmp%s.fs" (Guid.NewGuid().ToString("N"))) TaskItem(tempFile) :> ITaskItem else _outputFile - File.WriteAllText(_outputFile.ItemSpec, code.ToString()) + let codeText = code.ToString() + let alreadyExists = (try File.Exists fileName && File.ReadAllText(fileName) = codeText with _ -> false) + if not alreadyExists then + File.WriteAllText(fileName, codeText) _outputFile <- outputFileItem true with e -> diff --git a/src/fsharp/IlxGen.fs b/src/fsharp/IlxGen.fs index e0311b39529..13e1f5bd67f 100644 --- a/src/fsharp/IlxGen.fs +++ b/src/fsharp/IlxGen.fs @@ -3747,8 +3747,8 @@ and GenClosureTypeDefs cenv (tref:ILTypeRef, ilGenParams, attrs, ilCloFreeVars, Properties = emptyILProperties Methods= mkILMethods mdefs MethodImpls= mkILMethodImpls mimpls - IsSerializable= cenv.g.attrib_SerializableAttribute.IsSome - IsComInterop= false + IsSerializable=true + IsComInterop= false IsSpecialName= true NestedTypes=emptyILTypeDefs Encoding= ILDefaultPInvokeEncoding.Auto @@ -3803,8 +3803,8 @@ and GenLambdaClosure cenv (cgbuf:CodeGenBuffer) eenv isLocalTypeFunc selfv expr Properties = emptyILProperties Methods= mkILMethods ilContractMeths MethodImpls= emptyILMethodImpls - IsSerializable= cenv.g.attrib_SerializableAttribute.IsSome - IsComInterop=false + IsSerializable=true + IsComInterop=false IsSpecialName= true NestedTypes=emptyILTypeDefs Encoding= ILDefaultPInvokeEncoding.Auto @@ -6563,9 +6563,8 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon:Tycon) = let ilFields = mkILFields ilFieldDefs let tdef, tdefDiscards = - let isSerializable = (TryFindFSharpBoolAttribute cenv.g cenv.g.attrib_AutoSerializableAttribute tycon.Attribs <> Some(false)) - && cenv.g.attrib_SerializableAttribute.IsSome - + let isSerializable = (TryFindFSharpBoolAttribute cenv.g cenv.g.attrib_AutoSerializableAttribute tycon.Attribs <> Some(false)) + match tycon.TypeReprInfo with | TILObjectRepr _ -> let td = tycon.ILTyconRawMetadata @@ -6817,11 +6816,10 @@ and GenExnDef cenv mgbuf eenv m (exnc:Tycon) = else [] - let serializationRelatedMembers = - // do not emit serialization related members if target framework lacks SerializableAttribute or SerializationInfo - match cenv.g.attrib_SerializableAttribute, cenv.g.iltyp_SerializationInfo, cenv.g.iltyp_StreamingContext with - | Some _, Some serializationInfoType, Some streamingContextType -> + // do not emit serialization related members if target framework lacks SerializationInfo or StreamingContext + match cenv.g.iltyp_SerializationInfo, cenv.g.iltyp_StreamingContext with + | Some serializationInfoType, Some streamingContextType -> let ilCtorDefForSerialziation = mkILCtor(ILMemberAccess.Family, [mkILParamNamed("info", serializationInfoType);mkILParamNamed("context",streamingContextType)], @@ -6880,7 +6878,7 @@ and GenExnDef cenv mgbuf eenv m (exnc:Tycon) = emptyILEvents, mkILCustomAttrs [mkCompilationMappingAttr cenv.g (int SourceConstructFlags.Exception)], ILTypeInit.BeforeField) - let tdef = { tdef with IsSerializable = cenv.g.attrib_SerializableAttribute.IsSome } + let tdef = { tdef with IsSerializable = true } mgbuf.AddTypeDef(tref, tdef, false, false, None) diff --git a/src/fsharp/TcGlobals.fs b/src/fsharp/TcGlobals.fs index c9b631b94d2..1f6cecc6b05 100755 --- a/src/fsharp/TcGlobals.fs +++ b/src/fsharp/TcGlobals.fs @@ -1042,7 +1042,6 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member val attrib_ProjectionParameterAttribute = mk_MFCore_attrib "ProjectionParameterAttribute" member val attrib_CustomOperationAttribute = mk_MFCore_attrib "CustomOperationAttribute" member val attrib_NonSerializedAttribute = tryFindSysAttrib "System.NonSerializedAttribute" - member val attrib_SerializableAttribute = tryFindSysAttrib "System.SerializableAttribute" member val attrib_AutoSerializableAttribute = mk_MFCore_attrib "AutoSerializableAttribute" member val attrib_RequireQualifiedAccessAttribute = mk_MFCore_attrib "RequireQualifiedAccessAttribute" diff --git a/src/fsharp/TypeRelations.fs b/src/fsharp/TypeRelations.fs index f72071b900a..4011bda25d8 100755 --- a/src/fsharp/TypeRelations.fs +++ b/src/fsharp/TypeRelations.fs @@ -141,8 +141,7 @@ let ChooseTyparSolutionAndRange (g: TcGlobals) amap (tp:Typar) = match tpc with | TyparConstraint.CoercesTo(x,m) -> join m x,m - | TyparConstraint.MayResolveMember(TTrait(_,nm,_,_,_,_),m) -> - errorR(Error(FSComp.SR.typrelCannotResolveAmbiguityInOverloadedOperator(DemangleOperatorName nm),m)) + | TyparConstraint.MayResolveMember(TTrait(_,_,_,_,_,_),m) -> maxSoFar,m | TyparConstraint.SimpleChoice(_,m) -> errorR(Error(FSComp.SR.typrelCannotResolveAmbiguityInPrintf(),m)) diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index 5517d284405..b1ec3cfca0c 100644 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -1968,12 +1968,10 @@ let main2b (tcImportsCapture,dynamicAssemblyCreator) (Args (ctok, tcConfig: TcCo use unwindBuildPhase = PushThreadBuildPhaseUntilUnwind BuildPhase.IlxGen let ilxGenerator = CreateIlxAssemblyGenerator (tcConfig, tcImports, tcGlobals, (LightweightTcValForUsingInBuildMethodCall tcGlobals), generatedCcu) - // Check if System.SerializableAttribute exists in mscorlib.dll, - // so that make sure the compiler only emits "serializable" bit into IL metadata when it is available. - // Note that SerializableAttribute may be relocated in the future but now resides in mscorlib. let codegenResults = GenerateIlxCode ((if Option.isSome dynamicAssemblyCreator then IlReflectBackend else IlWriteBackend), Option.isSome dynamicAssemblyCreator, false, tcConfig, topAttrs, optimizedImpls, generatedCcu.AssemblyName, ilxGenerator) let casApplied = new Dictionary() let securityAttrs, topAssemblyAttrs = topAttrs.assemblyAttrs |> List.partition (fun a -> TypeChecker.IsSecurityAttribute tcGlobals (tcImports.GetImportMap()) casApplied a rangeStartup) + // remove any security attributes from the top-level assembly attribute list let topAttrs = {topAttrs with assemblyAttrs=topAssemblyAttrs} let permissionSets = ilxGenerator.CreatePermissionSets securityAttrs diff --git a/src/fsharp/service/ServiceUntypedParse.fs b/src/fsharp/service/ServiceUntypedParse.fs index 2b79da350af..1405443c42a 100755 --- a/src/fsharp/service/ServiceUntypedParse.fs +++ b/src/fsharp/service/ServiceUntypedParse.fs @@ -41,8 +41,8 @@ module SourceFileImpl = 0 = String.Compare(".fsi",ext,StringComparison.OrdinalIgnoreCase) /// Additional #defines that should be in place when editing a file in a file editor such as VS. - let AdditionalDefinesForUseInEditor(filename) = - if CompileOps.IsScript(filename) then ["INTERACTIVE";"EDITING"] // This is still used by the foreground parse + let AdditionalDefinesForUseInEditor(isInteractive: bool) = + if isInteractive then ["INTERACTIVE";"EDITING"] // This is still used by the foreground parse else ["COMPILED";"EDITING"] type CompletionPath = string list * string option // plid * residue diff --git a/src/fsharp/service/ServiceUntypedParse.fsi b/src/fsharp/service/ServiceUntypedParse.fsi index 2caf81f6fb0..40339e85f96 100755 --- a/src/fsharp/service/ServiceUntypedParse.fsi +++ b/src/fsharp/service/ServiceUntypedParse.fsi @@ -112,5 +112,5 @@ module public UntypedParseImpl = // implementation details used by other code in the compiler module internal SourceFileImpl = val IsInterfaceFile : string -> bool - val AdditionalDefinesForUseInEditor : string -> string list + val AdditionalDefinesForUseInEditor: isInteractive: bool -> string list diff --git a/src/fsharp/service/service.fs b/src/fsharp/service/service.fs index 63963c07970..29c1f088ae2 100644 --- a/src/fsharp/service/service.fs +++ b/src/fsharp/service/service.fs @@ -1394,14 +1394,13 @@ type TypeCheckInfo override __.ToString() = "TypeCheckInfo(" + mainInputFileName + ")" type FSharpParsingOptions = - { - SourceFiles: string [] + { SourceFiles: string [] ConditionalCompilationDefines: string list ErrorSeverityOptions: FSharpErrorSeverityOptions + IsInteractive: bool LightSyntax: bool option CompilingFsLib: bool - IsExe: bool - } + IsExe: bool } member x.LastFileName = Debug.Assert(not (Array.isEmpty x.SourceFiles), "Parsing options don't contain any file") @@ -1411,26 +1410,26 @@ type FSharpParsingOptions = { SourceFiles = Array.empty ConditionalCompilationDefines = [] ErrorSeverityOptions = FSharpErrorSeverityOptions.Default + IsInteractive = false LightSyntax = None CompilingFsLib = false - IsExe = false - } + IsExe = false } - static member FromTcConfig(tcConfig: TcConfig, sourceFiles) = - { - SourceFiles = sourceFiles + static member FromTcConfig(tcConfig: TcConfig, sourceFiles, isInteractive: bool) = + { SourceFiles = sourceFiles ConditionalCompilationDefines = tcConfig.conditionalCompilationDefines ErrorSeverityOptions = tcConfig.errorSeverityOptions + IsInteractive = isInteractive LightSyntax = tcConfig.light CompilingFsLib = tcConfig.compilingFslib - IsExe = tcConfig.target.IsExe - } + IsExe = tcConfig.target.IsExe } - static member FromTcConfigBuidler(tcConfigB: TcConfigBuilder, sourceFiles) = + static member FromTcConfigBuidler(tcConfigB: TcConfigBuilder, sourceFiles, isInteractive: bool) = { SourceFiles = sourceFiles ConditionalCompilationDefines = tcConfigB.conditionalCompilationDefines ErrorSeverityOptions = tcConfigB.errorSeverityOptions + IsInteractive = isInteractive LightSyntax = tcConfigB.light CompilingFsLib = tcConfigB.compilingFslib IsExe = tcConfigB.target.IsExe @@ -1502,7 +1501,7 @@ module internal Parser = // If we're editing a script then we define INTERACTIVE otherwise COMPILED. // Since this parsing for intellisense we always define EDITING. - let defines = SourceFileImpl.AdditionalDefinesForUseInEditor(fileName) @ options.ConditionalCompilationDefines + let defines = (SourceFileImpl.AdditionalDefinesForUseInEditor options.IsInteractive) @ options.ConditionalCompilationDefines // Note: we don't really attempt to intern strings across a large scope. let lexResourceManager = new Lexhelp.LexResourceManager() @@ -1521,6 +1520,12 @@ module internal Parser = let matchBraces(source, fileName, options: FSharpParsingOptions, userOpName: string) = Trace.TraceInformation("FCS: {0}.{1} ({2})", userOpName, "matchBraces", fileName) + + // Make sure there is an ErrorLogger installed whenever we do stuff that might record errors, even if we ultimately ignore the errors + let delayedLogger = CapturingErrorLogger("matchBraces") + use _unwindEL = PushErrorLoggerPhaseUntilUnwind (fun _ -> delayedLogger) + use _unwindBP = PushThreadBuildPhaseUntilUnwind BuildPhase.Parse + let matchingBraces = new ResizeArray<_>() Lexhelp.usingLexbufForParsing(UnicodeLexing.StringAsLexbuf(addNewLine source), fileName) (fun lexbuf -> let errHandler = ErrorHandler(false, fileName, options.ErrorSeverityOptions, source) @@ -2535,7 +2540,7 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC let! tcErrors, tcFileResult = Parser.CheckOneFile(parseResults, source, fileName, options.ProjectFileName, tcPrior.TcConfig, tcPrior.TcGlobals, tcPrior.TcImports, tcPrior.TcState, loadClosure, tcPrior.Errors, reactorOps, (fun () -> builder.IsAlive), textSnapshotInfo, userOpName) - let parsingOptions = FSharpParsingOptions.FromTcConfig(tcPrior.TcConfig, Array.ofList builder.SourceFiles) + let parsingOptions = FSharpParsingOptions.FromTcConfig(tcPrior.TcConfig, Array.ofList builder.SourceFiles, options.UseScriptResolutionRules) let checkAnswer = MakeCheckFileAnswer(fileName, tcFileResult, options, builder, Array.ofList tcPrior.TcDependencyFiles, creationErrors, parseResults.Errors, tcErrors) bc.RecordTypeCheckFileInProjectResults(fileName, options, parsingOptions, parseResults, fileVersion, tcPrior.TimeStamp, Some checkAnswer, source) return checkAnswer @@ -2649,7 +2654,7 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC let! tcPrior = execWithReactorAsync <| fun ctok -> builder.GetCheckResultsBeforeFileInProject (ctok, filename) // Do the parsing. - let parsingOptions = FSharpParsingOptions.FromTcConfig(builder.TcConfig, Array.ofList (builder.SourceFiles)) + let parsingOptions = FSharpParsingOptions.FromTcConfig(builder.TcConfig, Array.ofList (builder.SourceFiles), options.UseScriptResolutionRules) let parseErrors, parseTreeOpt, anyErrors = Parser.parseFile (source, filename, parsingOptions, userOpName) let parseTreeOpt = parseTreeOpt |> Option.map builder.DeduplicateParsedInputModuleNameInProject let parseResults = FSharpParseFileResults(parseErrors, parseTreeOpt, anyErrors, builder.AllDependenciesDeprecated) @@ -2929,7 +2934,7 @@ type FSharpChecker(legacyReferenceResolver, projectCacheSize, keepAssemblyConten member ic.GetParsingOptionsFromProjectOptions(options): FSharpParsingOptions * _ = let sourceFiles = List.ofArray options.SourceFiles let argv = List.ofArray options.OtherOptions - ic.GetParsingOptionsFromCommandLineArgs(sourceFiles, argv) + ic.GetParsingOptionsFromCommandLineArgs(sourceFiles, argv, options.UseScriptResolutionRules) member ic.MatchBraces(filename, source, options: FSharpProjectOptions, ?userOpName: string) = let userOpName = defaultArg userOpName "Unknown" @@ -3132,16 +3137,17 @@ type FSharpChecker(legacyReferenceResolver, projectCacheSize, keepAssemblyConten ExtraProjectInfo=extraProjectInfo Stamp = None } - member ic.GetParsingOptionsFromCommandLineArgs(initialSourceFiles, argv) = + member ic.GetParsingOptionsFromCommandLineArgs(initialSourceFiles, argv, ?isInteractive) = + let isInteractive = defaultArg isInteractive false use errorScope = new ErrorScope() let tcConfigBuilder = TcConfigBuilder.Initial // Apply command-line arguments and collect more source files if they are in the arguments let sourceFilesNew = ApplyCommandLineArgs(tcConfigBuilder, initialSourceFiles, argv) - FSharpParsingOptions.FromTcConfigBuidler(tcConfigBuilder, Array.ofList sourceFilesNew), errorScope.Diagnostics + FSharpParsingOptions.FromTcConfigBuidler(tcConfigBuilder, Array.ofList sourceFilesNew, isInteractive), errorScope.Diagnostics - member ic.GetParsingOptionsFromCommandLineArgs(argv) = - ic.GetParsingOptionsFromCommandLineArgs([], argv) + member ic.GetParsingOptionsFromCommandLineArgs(argv, ?isInteractive: bool) = + ic.GetParsingOptionsFromCommandLineArgs([], argv, ?isInteractive=isInteractive) /// Begin background parsing the given project. member ic.StartBackgroundCompile(options, ?userOpName) = @@ -3212,7 +3218,7 @@ type FsiInteractiveChecker(legacyReferenceResolver, reactorOps: IReactorOperatio let userOpName = defaultArg userOpName "Unknown" let filename = Path.Combine(tcConfig.implicitIncludeDir, "stdin.fsx") // Note: projectSourceFiles is only used to compute isLastCompiland, and is ignored if Build.IsScript(mainInputFileName) is true (which it is in this case). - let parsingOptions = FSharpParsingOptions.FromTcConfig(tcConfig, [| filename |]) + let parsingOptions = FSharpParsingOptions.FromTcConfig(tcConfig, [| filename |], true) let parseErrors, parseTreeOpt, anyErrors = Parser.parseFile (source, filename, parsingOptions, userOpName) let dependencyFiles = [| |] // interactions have no dependencies let parseResults = FSharpParseFileResults(parseErrors, parseTreeOpt, parseHadErrors = anyErrors, dependencyFiles = dependencyFiles) @@ -3255,8 +3261,8 @@ module CompilerEnvironment = let DefaultReferencesForOrphanSources(assumeDotNetFramework) = DefaultReferencesForScriptsAndOutOfProjectSources(assumeDotNetFramework) /// Publish compiler-flags parsing logic. Must be fast because its used by the colorizer. - let GetCompilationDefinesForEditing(filename:string, parsingOptions: FSharpParsingOptions) = - SourceFileImpl.AdditionalDefinesForUseInEditor(filename) @ + let GetCompilationDefinesForEditing (parsingOptions: FSharpParsingOptions) = + SourceFileImpl.AdditionalDefinesForUseInEditor(parsingOptions.IsInteractive) @ parsingOptions.ConditionalCompilationDefines /// Return true if this is a subcategory of error or warning message that the language service can emit diff --git a/src/fsharp/service/service.fsi b/src/fsharp/service/service.fsi index b1abfc8ed81..423b74e21bf 100755 --- a/src/fsharp/service/service.fsi +++ b/src/fsharp/service/service.fsi @@ -298,6 +298,7 @@ type public FSharpParsingOptions = SourceFiles: string[] ConditionalCompilationDefines: string list ErrorSeverityOptions: FSharpErrorSeverityOptions + IsInteractive: bool LightSyntax: bool option CompilingFsLib: bool IsExe: bool @@ -536,14 +537,14 @@ type public FSharpChecker = /// /// Initial source files list. Additional files may be added during argv evaluation. /// The command line arguments for the project build. - member GetParsingOptionsFromCommandLineArgs: sourceFiles: string list * argv: string list -> FSharpParsingOptions * FSharpErrorInfo list + member GetParsingOptionsFromCommandLineArgs: sourceFiles: string list * argv: string list * ?isInteractive: bool -> FSharpParsingOptions * FSharpErrorInfo list /// /// Get the FSharpParsingOptions implied by a set of command line arguments. /// /// /// The command line arguments for the project build. - member GetParsingOptionsFromCommandLineArgs: argv: string list -> FSharpParsingOptions * FSharpErrorInfo list + member GetParsingOptionsFromCommandLineArgs: argv: string list * ?isInteractive: bool -> FSharpParsingOptions * FSharpErrorInfo list /// /// Get the FSharpParsingOptions implied by a FSharpProjectOptions. @@ -730,11 +731,11 @@ type public CompilerEnvironment = module public CompilerEnvironment = /// These are the names of assemblies that should be referenced for .fs or .fsi files that /// are not associated with a project. - val DefaultReferencesForOrphanSources : assumeDotNetFramework: bool -> string list + val DefaultReferencesForOrphanSources: assumeDotNetFramework: bool -> string list /// Return the compilation defines that should be used when editing the given file. - val GetCompilationDefinesForEditing : filename : string * parsingOptions : FSharpParsingOptions -> string list + val GetCompilationDefinesForEditing: parsingOptions: FSharpParsingOptions -> string list /// Return true if this is a subcategory of error or warning message that the language service can emit - val IsCheckerSupportedSubcategory : string -> bool + val IsCheckerSupportedSubcategory: string -> bool /// Information about the debugging environment module public DebuggerEnvironment = diff --git a/src/fsharp/symbols/Symbols.fs b/src/fsharp/symbols/Symbols.fs index 4860d62fbd6..43ba54e0810 100644 --- a/src/fsharp/symbols/Symbols.fs +++ b/src/fsharp/symbols/Symbols.fs @@ -908,6 +908,8 @@ and FSharpActivePatternCase(cenv, apinfo: PrettyNaming.ActivePatternInfo, typ, n member __.Name = apinfo.ActiveTags.[n] + member __.Index = n + member __.DeclarationLocation = snd apinfo.ActiveTagsWithRanges.[n] member __.Group = FSharpActivePatternGroup(cenv, apinfo, typ, valOpt) @@ -926,7 +928,9 @@ and FSharpActivePatternCase(cenv, apinfo: PrettyNaming.ActivePatternInfo, typ, n | _ -> "" and FSharpActivePatternGroup(cenv, apinfo:PrettyNaming.ActivePatternInfo, typ, valOpt) = - + + member __.Name = valOpt |> Option.map (fun vref -> vref.LogicalName) + member __.Names = makeReadOnlyCollection apinfo.Names member __.IsTotal = apinfo.IsTotal diff --git a/src/fsharp/symbols/Symbols.fsi b/src/fsharp/symbols/Symbols.fsi index 1d69298d88e..5d9c1b9417c 100644 --- a/src/fsharp/symbols/Symbols.fsi +++ b/src/fsharp/symbols/Symbols.fsi @@ -850,7 +850,10 @@ and [] public FSharpActivePatternCase = inherit FSharpSymbol /// The name of the active pattern case - member Name: string + member Name: string + + /// Index of the case in the pattern group + member Index: int /// The location of declaration of the active pattern case member DeclarationLocation : range @@ -866,6 +869,10 @@ and [] public FSharpActivePatternCase = /// Represents all cases within an active pattern and [] public FSharpActivePatternGroup = + + /// The whole group name + member Name: string option + /// The names of the active pattern cases member Names: IList diff --git a/src/fsharp/xlf/FSComp.txt.cs.xlf b/src/fsharp/xlf/FSComp.txt.cs.xlf index de8bf468100..9cdaa6a18fd 100644 --- a/src/fsharp/xlf/FSComp.txt.cs.xlf +++ b/src/fsharp/xlf/FSComp.txt.cs.xlf @@ -802,11 +802,6 @@ Nepovedlo se přeložit implicitní vytvoření instance obecného konstruktoru na této pozici nebo blízko ní, protože by se dala přeložit na víc nesouvisejících typů, třeba {0} a {1}. Tuto nejednoznačnost můžete vyřešit pomocí poznámek typu. - - Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity. - Nepovedlo se vyřešit nejednoznačnost vyplývající z použití operátoru {0} na tomto místě v programu nebo blízko něho. Tuto nejednoznačnost můžete vyřešit pomocí poznámek typu. - - Could not resolve the ambiguity inherent in the use of a 'printf'-style format string Nepovedlo se vyřešit nejednoznačnost vyplývající z použití formátovacího řetězce ve stylu printf. diff --git a/src/fsharp/xlf/FSComp.txt.de.xlf b/src/fsharp/xlf/FSComp.txt.de.xlf index 871682009f7..7c738182885 100644 --- a/src/fsharp/xlf/FSComp.txt.de.xlf +++ b/src/fsharp/xlf/FSComp.txt.de.xlf @@ -802,11 +802,6 @@ Die implizite Instanziierung eines generischen Konstrukts an diesem Punkt oder in dessen Umgebung konnte nicht aufgelöst werden, weil sie zu mehreren unzusammenhängenden Typen aufgelöst werden könnte, z.B. "{0}" und "{1}". Verwenden Sie Typanmerkungen, um die Mehrdeutigkeit aufzulösen. - - Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity. - Die inhärente Mehrdeutigkeit bei der Verwendung des {0}-Operators an diesem Programmpunkt oder in dessen Umgebung konnte nicht aufgelöst werden. Verwenden Sie Typanmerkungen, um die Mehrdeutigkeit aufzulösen. - - Could not resolve the ambiguity inherent in the use of a 'printf'-style format string Die inhärente Mehrdeutigkeit bei der Verwendung einer printf-Formatzeichenfolge konnte nicht aufgelöst werden. diff --git a/src/fsharp/xlf/FSComp.txt.en.xlf b/src/fsharp/xlf/FSComp.txt.en.xlf index f5c18a3b87b..5e6faa804c0 100644 --- a/src/fsharp/xlf/FSComp.txt.en.xlf +++ b/src/fsharp/xlf/FSComp.txt.en.xlf @@ -802,11 +802,6 @@ The implicit instantiation of a generic construct at or near this point could not be resolved because it could resolve to multiple unrelated types, e.g. '{0}' and '{1}'. Consider using type annotations to resolve the ambiguity - - Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity. - Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity. - - Could not resolve the ambiguity inherent in the use of a 'printf'-style format string Could not resolve the ambiguity inherent in the use of a 'printf'-style format string diff --git a/src/fsharp/xlf/FSComp.txt.es.xlf b/src/fsharp/xlf/FSComp.txt.es.xlf index 5cd8334aab5..f9490c4c925 100644 --- a/src/fsharp/xlf/FSComp.txt.es.xlf +++ b/src/fsharp/xlf/FSComp.txt.es.xlf @@ -802,11 +802,6 @@ No se pudo resolver la creación de instancia implícita de una construcción genérica en este punto o cerca de él porque se podía resolver en varios tipos no relacionados; por ejemplo, '{0}' y '{1}'. Considere el uso de anotaciones de tipo para resolver la ambigüedad. - - Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity. - No se pudo resolver la ambigüedad inherente en el uso del operador '{0}' en este punto del programa o cerca de él. Considere el uso de anotaciones de tipo para resolver la ambigüedad. - - Could not resolve the ambiguity inherent in the use of a 'printf'-style format string No se pudo resolver la ambigüedad inherente en el uso de una cadena de formato de tipo 'printf'. diff --git a/src/fsharp/xlf/FSComp.txt.fr.xlf b/src/fsharp/xlf/FSComp.txt.fr.xlf index be6faae997b..1219b7d4275 100644 --- a/src/fsharp/xlf/FSComp.txt.fr.xlf +++ b/src/fsharp/xlf/FSComp.txt.fr.xlf @@ -802,11 +802,6 @@ Impossible de résoudre l'instanciation implicite d'une construction générique à cet emplacement ou à proximité, car elle peut être résolue en plusieurs types non liés, par exemple '{0}' et '{1}'. Utilisez des annotations de type pour résoudre l'ambigüité - - Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity. - Impossible de résoudre l'ambigüité inhérente à l'utilisation de l'opérateur '{0}' à cet emplacement du programme ou à proximité. Utilisez des annotations de type pour résoudre l'ambigüité. - - Could not resolve the ambiguity inherent in the use of a 'printf'-style format string Impossible de résoudre l'ambigüité inhérente à l'utilisation d'une chaîne de format de style 'printf' diff --git a/src/fsharp/xlf/FSComp.txt.it.xlf b/src/fsharp/xlf/FSComp.txt.it.xlf index 2018408d5ba..6090bc62dd8 100644 --- a/src/fsharp/xlf/FSComp.txt.it.xlf +++ b/src/fsharp/xlf/FSComp.txt.it.xlf @@ -802,11 +802,6 @@ Non è stato possibile risolvere la creazione di istanza implicita di un costrutto generico in questo punto o in prossimità di esso perché la risoluzione potrebbe restituire più tipi non correlati, ad esempio '{0}' e '{1}'. Provare a usare annotazioni di tipo per risolvere l'ambiguità - - Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity. - Non è stato possibile risolvere l'ambiguità relativa all'uso dell'operatore '{0}' in questo punto del programma o in prossimità di esso. Provare invece a risolvere l'ambiguità usando annotazioni di tipo. - - Could not resolve the ambiguity inherent in the use of a 'printf'-style format string Non è stato possibile risolvere l'ambiguità relativa all'uso della stringa di formato di stile 'printf' diff --git a/src/fsharp/xlf/FSComp.txt.ja.xlf b/src/fsharp/xlf/FSComp.txt.ja.xlf index ccfa62d2ec5..96e27fe5967 100644 --- a/src/fsharp/xlf/FSComp.txt.ja.xlf +++ b/src/fsharp/xlf/FSComp.txt.ja.xlf @@ -802,11 +802,6 @@ この場所またはその付近にあるジェネリック コンストラクトの暗黙的なインスタンス化を解決できませんでした。これは、関連性のない複数の型に解決される可能性があるためです (たとえば、'{0}' と '{1}')。あいまいさを解決するために、型の注釈を使用してください。 - - Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity. - このプログラム ポイント、またはその付近にある演算子 '{0}' の使用に関して、あいまいな継承を解決できませんでした。あいまいさを解決するために、型の注釈を使用してください。 - - Could not resolve the ambiguity inherent in the use of a 'printf'-style format string 'printf' 形式の書式指定文字列の使用に関して、あいまいな継承を解決できませんでした diff --git a/src/fsharp/xlf/FSComp.txt.ko.xlf b/src/fsharp/xlf/FSComp.txt.ko.xlf index 34f6c74a68e..f1da0d44ac5 100644 --- a/src/fsharp/xlf/FSComp.txt.ko.xlf +++ b/src/fsharp/xlf/FSComp.txt.ko.xlf @@ -802,11 +802,6 @@ 관련되지 않은 여러 형식(예: '{0}'과(와) '{1}')으로 확인될 수 있으므로 이 지점 또는 이 지점 근처에서 제네릭 구문의 암시적 인스턴스를 확인할 수 없습니다. 형식 주석을 사용하여 모호성을 해결하세요. - - Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity. - ’{0}' 연산자 사용과 관련하여 이 프로그램 지점 또는 이 지점 근처에서 본질적으로 발생하는 모호성을 해결할 수 없습니다. 형식 주석을 사용하여 모호성을 해결하세요. - - Could not resolve the ambiguity inherent in the use of a 'printf'-style format string 'printf' 스타일의 서식 문자열 사용과 관련하여 본질적으로 발생하는 모호성을 해결할 수 없습니다. diff --git a/src/fsharp/xlf/FSComp.txt.pl.xlf b/src/fsharp/xlf/FSComp.txt.pl.xlf index bc8bef8eeb6..434d400d473 100644 --- a/src/fsharp/xlf/FSComp.txt.pl.xlf +++ b/src/fsharp/xlf/FSComp.txt.pl.xlf @@ -802,11 +802,6 @@ Nie można rozpoznać niejawnego wystąpienia konstrukcji ogólnej w tym miejscu lub w jego pobliżu, ponieważ może to spowodować powstanie wielu niepowiązanych typów, na przykład „{0}” i „{1}”. Rozważ użycie adnotacji typu w celu rozwiązania niejednoznaczności - - Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity. - Nie można rozwiązać odziedziczonej niejednoznaczności w przypadku użycia operatora „{0}” w tym punkcie programu lub w jego pobliżu. Rozważ użycie adnotacji typu w celu rozwiązania niejednoznaczności. - - Could not resolve the ambiguity inherent in the use of a 'printf'-style format string Nie można usunąć niejednoznaczności spowodowanej użyciem ciągu formatu „printf” diff --git a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf index ecdb4da2f47..683bb23f5ac 100644 --- a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf +++ b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf @@ -802,11 +802,6 @@ A instanciação implícita do constructo genérico neste ponto ou próximo a ele não pode ser resolvida porque ele conseguiu resolver tipos não relacionados múltiplos, por exemplo '{0}' e '{1}'. Considere usar anotações de tipo para resolver a ambiguidade - - Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity. - Não foi possível resolver a ambiguidade no uso de um operador '{0}' neste ponto do programa ou próximo a ele. Considere usar anotações de tipo para resolver a ambiguidade. - - Could not resolve the ambiguity inherent in the use of a 'printf'-style format string Não foi possível resolver a ambiguidade inerente ao uso de uma cadeia de caracteres com formato de estilo 'printf' diff --git a/src/fsharp/xlf/FSComp.txt.ru.xlf b/src/fsharp/xlf/FSComp.txt.ru.xlf index 7ee89b1cf84..0e874b11229 100644 --- a/src/fsharp/xlf/FSComp.txt.ru.xlf +++ b/src/fsharp/xlf/FSComp.txt.ru.xlf @@ -802,11 +802,6 @@ Неявное создание экземпляров базовой конструкции в данной точке или рядом с ней не может быть разрешено, так как тогда возможно разрешение в несколько несвязанных типов, напр. "{0}" и "{1}". Рекомендуется использовать аннотации типа для решения неоднозначности - - Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity. - Не удалось разрешить неоднозначность, унаследованную в использовании оператора "{0}" в данной точке программы или рядом с ней. Рекомендуется использовать аннотации типа для решения неоднозначности. - - Could not resolve the ambiguity inherent in the use of a 'printf'-style format string Не удалось разрешить неоднозначность, унаследованную в использовании строки формата вида "printf" diff --git a/src/fsharp/xlf/FSComp.txt.tr.xlf b/src/fsharp/xlf/FSComp.txt.tr.xlf index 264cf6ee93a..8f5c3e3e6a7 100644 --- a/src/fsharp/xlf/FSComp.txt.tr.xlf +++ b/src/fsharp/xlf/FSComp.txt.tr.xlf @@ -802,11 +802,6 @@ Genel yapının bu konumda veya yakınında örtük olarak örneklenmesi çözümlenemedi, çünkü ilişkisiz birden çok türe çözümlenebiliyordu, örn. '{0}' ve '{1}'. Belirsizliği çözümlemek için tür ek açıklamaları kullanmayı düşünün - - Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity. - '{0}' işlecinin bu program noktasında veya yakınında kullanılmasında bulunan belirsizlik çözümlenemedi. Bu belirsizliği çözmek için tür ek açıklamaları kullanmayı düşünün. - - Could not resolve the ambiguity inherent in the use of a 'printf'-style format string 'printf' stilindeki biçim dizesinin kullanılmasına bulunan belirsizlik çözümlenemedi. diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf index 1704c51829d..25518d7ef96 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf @@ -802,11 +802,6 @@ 未能解析在此点或其附近进行的泛型构造的隐式实例化,因为它可以解析为多个不相关的类型,例如“{0}”和“{1}”。请考虑使用类型批注来解析此多义性 - - Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity. - 未能解析在此程序点或其附近使用运算符“{0}”所产生的固有多义性。请考虑使用类型批注来解析此多义性。 - - Could not resolve the ambiguity inherent in the use of a 'printf'-style format string 未能解析使用“printf”样式的格式字符串所产生的固有多义性 diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf index 3e6b4bcd787..f63b4e2b659 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf @@ -209,7 +209,7 @@ Unrecognized privacy setting '{0}' for managed resource, valid options are 'public' and 'private' - Managed 資源的無法辨識隱私設定 '{0}',有效的選項是 'public' 和 'private' + 受控資源的無法辨識隱私設定 '{0}',有效的選項是 'public' 和 'private' @@ -802,11 +802,6 @@ 無法解決在這個點或附近的泛型建構的隱含具現化,因為它可能解析成多個不相關的類型,例如 '{0}' 和 '{1}'。請考慮使用類型註釋來解決模稜兩可 - - Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity. - 無法解決在這個程式點或附近使用運算子 '{0}' 時固有的模稜兩可。請考慮使用型別註解來解決模稜兩可。 - - Could not resolve the ambiguity inherent in the use of a 'printf'-style format string 無法解決使用 'printf' 樣式的格式字串時固有的模稜兩可 @@ -1609,7 +1604,7 @@ A generic construct requires that the type '{0}' is an unmanaged type - 泛型建構要求類型 '{0}' 必須是 Unmanaged 類型 + 泛型建構要求類型 '{0}' 必須是非受控類型 @@ -4209,7 +4204,7 @@ Embed the specified managed resource - 嵌入指定的 Managed 資源 + 嵌入指定的受控資源 @@ -5469,12 +5464,12 @@ Static linking may not include a mixed managed/unmanaged DLL - 靜態連結不可包含混合的 Managed/Unmanaged DLL + 靜態連結不可包含混合的受控/非受控 DLL Ignoring mixed managed/unmanaged assembly '{0}' during static linking - 在靜態連結期間忽略混合的 Managed/Unmanaged 組件 '{0}' + 在靜態連結期間忽略混合的受控/非受控組件 '{0}' diff --git a/tests/fsharp/core/subtype/test.fsx b/tests/fsharp/core/subtype/test.fsx index 69edfb2ff1b..046a8b6c72e 100644 --- a/tests/fsharp/core/subtype/test.fsx +++ b/tests/fsharp/core/subtype/test.fsx @@ -1791,6 +1791,44 @@ module SRTPFix = printfn "%A" <| replace 'q' (test("HI")) *) + +module SRTPFixAmbiguity = + // Mini Repro from FSharpPlus https://github.com/gusty/FSharpPlus + type Id<'t>(v:'t) = member __.getValue = v + type Interface<'t> = abstract member getValue : 't + + type Monad = + static member inline InvokeReturn (x:'T) : '``Monad<'T>`` = + let inline call (mthd : ^M, output : ^R) = ((^M or ^R) : (static member Return: _ -> _) output) + call (Unchecked.defaultof, Unchecked.defaultof<'``Monad<'T>``>) x + static member Return (_:Interface<'a>) = fun (_:'a) -> Unchecked.defaultof> : Interface<'a> + static member Return (_:seq<'a> ) = fun x -> Seq.singleton x : seq<'a> + static member Return (_:option<'a> ) = fun x -> Some x : option<'a> + static member Return (_:Id<'a> ) = fun x -> Id x : Id<'a> + + static member inline InvokeBind (source : '``Monad<'T>``) (binder : 'T -> '``Monad<'U>``) : '``Monad<'U>`` = + let inline call (mthd : 'M, input : 'I, _output : 'R, f) = ((^M or ^I or ^R) : (static member Bind: _*_ -> _) input, f) + call (Unchecked.defaultof, source, Unchecked.defaultof<'``Monad<'U>``>, binder) + static member Bind (source : Interface<'T>, f : 'T -> Interface<'U>) = f source.getValue : Interface<'U> + static member Bind (source : seq<'T> , f : 'T -> seq<'U> ) = Seq.collect f source : seq<'U> + static member Bind (source : Id<'T> , f : 'T -> Id<'U> ) = f source.getValue : Id<'U> + static member Bind (source :option<'T> , f : 'T -> _ ) = Option.bind f source : option<'U> + + let inline result (x:'T) = Monad.InvokeReturn x :'``Monad<'T>`` + let inline (>>=) (x:'``Monad<'T>``) (f:'T->'``Monad<'U>``) = Monad.InvokeBind x f :'``Monad<'U>`` + + type ReaderT<'R,'``monad<'T>``> = ReaderT of ('R -> '``monad<'T>``) + let runReaderT (ReaderT x) = x : 'R -> '``Monad<'T>`` + type ReaderT<'R,'``monad<'T>``> with + static member inline Return _ = fun (x : 'T) -> ReaderT (fun _ -> result x) : ReaderT<'R, '``Monad<'T>``> + static member inline Bind (ReaderT (m:_->'``Monad<'T>``), f:'T->_) = ReaderT (fun r -> m r >>= (fun a -> runReaderT (f a) r)) : ReaderT<'R, '``Monad<'U>``> + + + let test1 : ReaderT> = ReaderT result >>= result + let test2 : ReaderT> = ReaderT result >>= result + let test3 : ReaderT> = ReaderT result >>= result + + // See https://github.com/Microsoft/visualfsharp/issues/4040 module InferenceRegression4040 = type Foo() = diff --git a/tests/fsharpqa/Source/Conformance/DeclarationElements/MemberDefinitions/OverloadingMembers/OverloadsAndSRTPs01.fs b/tests/fsharpqa/Source/Conformance/DeclarationElements/MemberDefinitions/OverloadingMembers/OverloadsAndSRTPs01.fs new file mode 100644 index 00000000000..842d049dc9f --- /dev/null +++ b/tests/fsharpqa/Source/Conformance/DeclarationElements/MemberDefinitions/OverloadingMembers/OverloadsAndSRTPs01.fs @@ -0,0 +1,38 @@ +// #Conformance #DeclarationElements #MemberDefinitions #Overloading +// Exotic case from F#+ https://github.com/gusty/FSharpPlus + +module Applicatives = + open System + + type Ap = Ap with + static member inline Invoke (x:'T) : '``Applicative<'T>`` = + let inline call (mthd : ^M, output : ^R) = ((^M or ^R) : (static member Return: _*_ -> _) output, mthd) + call (Ap, Unchecked.defaultof<'``Applicative<'T>``>) x + static member inline InvokeOnInstance (x:'T) = (^``Applicative<'T>`` : (static member Return: ^T -> ^``Applicative<'T>``) x) + static member inline Return (r:'R , _:obj) = Ap.InvokeOnInstance :_ -> 'R + static member Return (_:seq<'a> , Ap ) = fun x -> Seq.singleton x : seq<'a> + static member Return (_:Tuple<'a>, Ap ) = fun x -> Tuple x : Tuple<'a> + static member Return (_:'r -> 'a , Ap ) = fun k _ -> k : 'a -> 'r -> _ + + let inline result (x:'T) = Ap.Invoke x + + let inline (<*>) (f:'``Applicative<'T->'U>``) (x:'``Applicative<'T>``) : '``Applicative<'U>`` = + (( ^``Applicative<'T->'U>`` or ^``Applicative<'T>`` or ^``Applicative<'U>``) : (static member (<*>): _*_ -> _) f, x) + + let inline (+) (a:'Num) (b:'Num) :'Num = a + b + + type ZipList<'s> = ZipList of 's seq with + static member Return (x:'a) = ZipList (Seq.initInfinite (fun _ -> x)) + static member (<*>) (ZipList (f:seq<'a->'b>), ZipList x) = ZipList (Seq.zip f x |> Seq.map (fun (f, x) -> f x)) :ZipList<'b> + + type Ii = Ii + type Idiomatic = Idiomatic with + static member inline ($) (Idiomatic, si) = fun sfi x -> (Idiomatic $ x) (sfi <*> si) + static member ($) (Idiomatic, Ii) = id + let inline idiomatic a b = (Idiomatic $ b) a + let inline iI x = (idiomatic << result) x + + let res1n2n3 = iI (+) (result 0M ) (ZipList [1M;2M;3M]) Ii + let res2n3n4 = iI (+) (result LanguagePrimitives.GenericOne) (ZipList [1 ;2 ;3 ]) Ii + + exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/DeclarationElements/MemberDefinitions/OverloadingMembers/RecursiveOverload01.fs b/tests/fsharpqa/Source/Conformance/DeclarationElements/MemberDefinitions/OverloadingMembers/RecursiveOverload01.fs new file mode 100644 index 00000000000..e8d9355ad44 --- /dev/null +++ b/tests/fsharpqa/Source/Conformance/DeclarationElements/MemberDefinitions/OverloadingMembers/RecursiveOverload01.fs @@ -0,0 +1,26 @@ +// #Conformance #DeclarationElements #MemberDefinitions #Overloading +// Originally from https://gist.github.com/gusty/b6fac370bff36a665d75 +type FoldArgs<'t> = FoldArgs of ('t -> 't -> 't) + +let inline foldArgs f (x:'t) (y:'t) :'rest = (FoldArgs f $ Unchecked.defaultof<'rest>) x y + +type FoldArgs<'t> with + static member inline ($) (FoldArgs f, _:'t-> 'rest) = fun (a:'t) -> f a >> foldArgs f + static member ($) (FoldArgs f, _:'t ) = f + +let test1() = + let x:int = foldArgs (+) 2 3 + let y:int = foldArgs (+) 2 3 4 + let z:int = foldArgs (+) 2 3 4 5 + let d:decimal = foldArgs (+) 2M 3M 4M + let e:string = foldArgs (+) "h" "e" "l" "l" "o" + let f:float = foldArgs (+) 2. 3. 4. + + let mult3Numbers a b c = a * b * c + let res2 = mult3Numbers 3 (foldArgs (+) 3 4) (foldArgs (+) 2 2 3 3) + () + +// Run the test +test1() + +exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/DeclarationElements/MemberDefinitions/OverloadingMembers/SlowOverloadResolution.fs b/tests/fsharpqa/Source/Conformance/DeclarationElements/MemberDefinitions/OverloadingMembers/SlowOverloadResolution.fs index 5737cdebf2c..0f6d5f43532 100644 --- a/tests/fsharpqa/Source/Conformance/DeclarationElements/MemberDefinitions/OverloadingMembers/SlowOverloadResolution.fs +++ b/tests/fsharpqa/Source/Conformance/DeclarationElements/MemberDefinitions/OverloadingMembers/SlowOverloadResolution.fs @@ -1,6 +1,6 @@ // #Conformance #DeclarationElements #MemberDefinitions #Overloading // https://github.com/Microsoft/visualfsharp/issues/351 - slow overlaod resolution -//This value is not a function and cannot be applied +//No overloads match type Switcher = Switcher let inline checker< ^s, ^r when (^s or ^r) : (static member pass : ^r -> unit)> (s : ^s) (r : ^r) = () @@ -22,4 +22,4 @@ let main argv = let res : unit = format () "text" 5 "more text" () printfn "%A" res System.Console.ReadKey() - 0 // return an integer exit code + 0 // return an integer exit code \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/DeclarationElements/MemberDefinitions/OverloadingMembers/env.lst b/tests/fsharpqa/Source/Conformance/DeclarationElements/MemberDefinitions/OverloadingMembers/env.lst index 7a3e95f230e..e123d552e69 100644 --- a/tests/fsharpqa/Source/Conformance/DeclarationElements/MemberDefinitions/OverloadingMembers/env.lst +++ b/tests/fsharpqa/Source/Conformance/DeclarationElements/MemberDefinitions/OverloadingMembers/env.lst @@ -27,6 +27,8 @@ NOMONO,NoMT SOURCE=ConsumeOverloadGenericMethods.fs SCFLAGS="-r:lib.dll" PRECMD= SOURCE=InferenceForLambdaArgs.fs # InferenceForLambdaArgs.fs SOURCE=SlowOverloadResolution.fs # SlowOverloadResolution.fs + SOURCE=RecursiveOverload01.fs # RecursiveOverload01.fs + SOURCE=OverloadsAndSRTPs01.fs # OverloadsAndSRTPs01.fs SOURCE=E_OverloadCurriedFunc.fs # E_OverloadCurriedFunc.fs SOURCE=NoWarningWhenOverloadingInSubClass01.fs SCFLAGS="--warnaserror" # NoWarningWhenOverloadingInSubClass01.fs diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/E_LexicalScoping01.fs b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/E_LexicalScoping01.fs index c6f4b62c999..8105efe3e09 100644 --- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/E_LexicalScoping01.fs +++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/StaticLetDoDeclarations/E_LexicalScoping01.fs @@ -1,9 +1,8 @@ // #Regression #Conformance #ObjectOrientedTypes #Classes #LetBindings // Scoping: // identifier introduced by let is local -//The value, namespace, type or module 'm' is not defined -//The value, namespace, type or module 'n' is not defined -//Could not resolve the ambiguity inherent in the use of the operator '\( \+ \)' at or near this program point\. Consider using type annotations to resolve the ambiguity\.$ +//The value, namespace, type or module 'm' is not defined +//The value, namespace, type or module 'n' is not defined type C() = class static let mutable m = [1;2;3] diff --git a/tests/fsharpqa/Source/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_MemberConstraint01.fs b/tests/fsharpqa/Source/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_MemberConstraint01.fs index 70e8ea65a97..113d7dbe1b7 100644 --- a/tests/fsharpqa/Source/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_MemberConstraint01.fs +++ b/tests/fsharpqa/Source/Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes/E_MemberConstraint01.fs @@ -1,6 +1,5 @@ // #Conformance #TypeConstraints -//Could not resolve the ambiguity inherent in the use of the operator 'someFunc' at or near this program point\. Consider using type annotations to resolve the ambiguity\.$ -//Type constraint mismatch when applying the default type 'obj' for a type inference variable\. The type 'obj' does not support the operator 'someFunc' Consider adding further type constraints$ +//Type constraint mismatch when applying the default type 'obj' for a type inference variable\. The type 'obj' does not support the operator 'someFunc' Consider adding further type constraints$ let testFunc (a : ^x) = (^x : (static member someFunc : unit -> ^x) ()) diff --git a/tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard1.6/Sample_NETCoreSDK_FSharp_Library_netstandard1.6.fsproj b/tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard1.6/Sample_NETCoreSDK_FSharp_Library_netstandard1.6.fsproj index aba132e319d..abac283cf0c 100644 --- a/tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard1.6/Sample_NETCoreSDK_FSharp_Library_netstandard1.6.fsproj +++ b/tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard1.6/Sample_NETCoreSDK_FSharp_Library_netstandard1.6.fsproj @@ -1,13 +1,9 @@ - + netstandard1.6 - portable + - - - - \ No newline at end of file diff --git a/tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard2_0/Library1.fs b/tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard2_0/Library1.fs new file mode 100644 index 00000000000..0eba466d884 --- /dev/null +++ b/tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard2_0/Library1.fs @@ -0,0 +1,4 @@ +namespace Sample_NETCoreSDK_FSharp_Library_netstandard2_0 + +type Class1() = + member this.X = "F#" diff --git a/tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard2_0/Sample_NETCoreSDK_FSharp_Library_netstandard2_0.fsproj b/tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard2_0/Sample_NETCoreSDK_FSharp_Library_netstandard2_0.fsproj new file mode 100644 index 00000000000..926080b65b5 --- /dev/null +++ b/tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard2_0/Sample_NETCoreSDK_FSharp_Library_netstandard2_0.fsproj @@ -0,0 +1,8 @@ + + + netstandard2.0 + + + + + \ No newline at end of file diff --git a/tests/scripts/compiler-perf-results.txt b/tests/scripts/compiler-perf-results.txt index 56be78c3cbb..ee00b0994f9 100644 --- a/tests/scripts/compiler-perf-results.txt +++ b/tests/scripts/compiler-perf-results.txt @@ -131,4 +131,3 @@ https://github.com/manofstick/visualfsharp.git all-your-collections-are-belong-t https://github.com/manofstick/visualfsharp.git all-your-collections-are-belong-to-us 87dafbc17b494c438b6db9e59e064736bd8a44e2 ba63403cb5898596c5e875a14ce22b33ef618c01 221.58 11.19 31.91 48.23 66.05 52.99 https://github.com/manofstick/visualfsharp.git all-your-collections-are-belong-to-us 87dafbc17b494c438b6db9e59e064736bd8a44e2 458e6c29d7e059a5a8a7b4cd7858c7d633fb5906 224.75 11.20 31.09 46.96 63.08 53.08 https://github.com/manofstick/visualfsharp.git all-your-collections-are-belong-to-us 87dafbc17b494c438b6db9e59e064736bd8a44e2 7e1fd6ac330f86597f3167e8067cfd805a89eec9 235.48 10.83 33.47 47.17 65.56 52.50 - diff --git a/tests/service/Common.fs b/tests/service/Common.fs index d038ff178a1..e3378e77b43 100644 --- a/tests/service/Common.fs +++ b/tests/service/Common.fs @@ -29,9 +29,10 @@ let readRefs (folder : string) (projectFile: string) = let exitCode = p.ExitCode exitCode, () + let projFilePath = Path.Combine(folder, projectFile) let runCmd exePath args = runProcess folder exePath (args |> String.concat " ") let msbuildExec = Dotnet.ProjInfo.Inspect.dotnetMsbuild runCmd - let result = Dotnet.ProjInfo.Inspect.getProjectInfo ignore msbuildExec Dotnet.ProjInfo.Inspect.getFscArgs [] projectFile + let result = Dotnet.ProjInfo.Inspect.getProjectInfo ignore msbuildExec Dotnet.ProjInfo.Inspect.getFscArgs [] projFilePath match result with | Ok(Dotnet.ProjInfo.Inspect.GetResult.FscArgs x) -> x @@ -101,8 +102,8 @@ let fsCoreDefaultReference() = let mkStandardProjectReferences () = #if DOTNETCORE - let file = "Sample_NETCoreSDK_FSharp_Library_netstandard1.6.fsproj" - let projDir = Path.Combine(__SOURCE_DIRECTORY__, "../projects/Sample_NETCoreSDK_FSharp_Library_netstandard1.6") + let file = "Sample_NETCoreSDK_FSharp_Library_netstandard2_0.fsproj" + let projDir = Path.Combine(__SOURCE_DIRECTORY__, "../projects/Sample_NETCoreSDK_FSharp_Library_netstandard2_0") readRefs projDir file #else [ yield sysLib "mscorlib" diff --git a/tests/service/EditorTests.fs b/tests/service/EditorTests.fs index d3e7c724509..f0207609b26 100644 --- a/tests/service/EditorTests.fs +++ b/tests/service/EditorTests.fs @@ -36,21 +36,12 @@ open Microsoft.FSharp.Compiler.SourceCodeServices open FSharp.Compiler.Service.Tests.Common let stringMethods = -#if DOTNETCORE - ["Chars"; "CompareTo"; "Contains"; "CopyTo"; "EndsWith"; "Equals"; - "GetHashCode"; "GetType"; "IndexOf"; - "IndexOfAny"; "Insert"; "LastIndexOf"; "LastIndexOfAny"; - "Length"; "PadLeft"; "PadRight"; "Remove"; "Replace"; "Split"; - "StartsWith"; "Substring"; "ToCharArray"; "ToLower"; "ToLowerInvariant"; - "ToString"; "ToUpper"; "ToUpperInvariant"; "Trim"; "TrimEnd"; "TrimStart"] -#else ["Chars"; "Clone"; "CompareTo"; "Contains"; "CopyTo"; "EndsWith"; "Equals"; "GetEnumerator"; "GetHashCode"; "GetType"; "GetTypeCode"; "IndexOf"; "IndexOfAny"; "Insert"; "IsNormalized"; "LastIndexOf"; "LastIndexOfAny"; "Length"; "Normalize"; "PadLeft"; "PadRight"; "Remove"; "Replace"; "Split"; "StartsWith"; "Substring"; "ToCharArray"; "ToLower"; "ToLowerInvariant"; "ToString"; "ToUpper"; "ToUpperInvariant"; "Trim"; "TrimEnd"; "TrimStart"] -#endif let input = """ @@ -582,7 +573,8 @@ let test3 = System.Text.RegularExpressions.RegexOptions.Compiled |> Array.choose(fun s -> match s.Symbol with :? FSharpEntity as e when e.IsEnum -> Some e | _ -> None) |> Array.distinct |> Array.map(fun e -> (e.DisplayName, e.FSharpFields - |> Seq.map(fun f -> f.Name, f.LiteralValue ) + |> Seq.sortBy (fun f -> match f.LiteralValue with None -> -1 | Some x -> unbox x) + |> Seq.map (fun f -> f.Name, f.LiteralValue) |> Seq.toList)) enums |> shouldEqual diff --git a/tests/service/ExprTests.fs b/tests/service/ExprTests.fs index bf955c5aa63..0d08e1ba089 100644 --- a/tests/service/ExprTests.fs +++ b/tests/service/ExprTests.fs @@ -528,7 +528,7 @@ let bool2 = false let options = checker.GetProjectOptionsFromCommandLineArgs (projFileName, args) //<@ let x = Some(3) in x.IsSome @> -#if !NO_EXTENSIONTYPING +//#if !NO_EXTENSIONTYPING [] let ``Test Declarations project1`` () = let wholeProjectResults = exprChecker.ParseAndCheckProject(Project1.options) |> Async.RunSynchronously @@ -648,7 +648,128 @@ let ``Test Declarations project1`` () = |> shouldEqual (filterHack expected) () -#endif + + +[] +let ``Test Optimized Declarations Project1`` () = + let wholeProjectResults = exprChecker.ParseAndCheckProject(Project1.options) |> Async.RunSynchronously + + for e in wholeProjectResults.Errors do + printfn "Project1 error: <<<%s>>>" e.Message + + wholeProjectResults.Errors.Length |> shouldEqual 3 // recursive value warning + wholeProjectResults.Errors.[0].Severity |> shouldEqual FSharpErrorSeverity.Warning + wholeProjectResults.Errors.[1].Severity |> shouldEqual FSharpErrorSeverity.Warning + wholeProjectResults.Errors.[2].Severity |> shouldEqual FSharpErrorSeverity.Warning + + wholeProjectResults.GetOptimizedAssemblyContents().ImplementationFiles.Length |> shouldEqual 2 + let file1 = wholeProjectResults.GetOptimizedAssemblyContents().ImplementationFiles.[0] + let file2 = wholeProjectResults.GetOptimizedAssemblyContents().ImplementationFiles.[1] + + // This behaves slightly differently on Mono versions, 'null' is printed somethimes, 'None' other times + // Presumably this is very small differences in Mono reflection causing F# printing to change behavious + // For now just disabling this test. See https://github.com/fsharp/FSharp.Compiler.Service/pull/766 + let filterHack l = + l |> List.map (fun (s:string) -> + s.Replace("ILArrayShape [(Some 0, None)]", "ILArrayShapeFIX") + .Replace("ILArrayShape [(Some 0, null)]", "ILArrayShapeFIX")) + + let expected = + ["type M"; "type IntAbbrev"; "let boolEx1 = True @ (6,14--6,18)"; + "let intEx1 = 1 @ (7,13--7,14)"; "let int64Ex1 = 1 @ (8,15--8,17)"; + "let tupleEx1 = (1,1) @ (9,16--9,21)"; + "let tupleEx2 = (1,1,1) @ (10,16--10,25)"; + "let tupleEx3 = (1,1,1,1) @ (11,16--11,29)"; + "let localExample = let y: Microsoft.FSharp.Core.int = 1 in let z: Microsoft.FSharp.Core.int = 1 in (y,z) @ (14,7--14,8)"; + "let localGenericFunctionExample(unitVar0) = let y: Microsoft.FSharp.Core.int = 1 in let compiledAsLocalGenericFunction: 'a -> 'a = FUN ... -> fun x -> x in (compiledAsLocalGenericFunction y,compiledAsLocalGenericFunction 1) @ (19,7--19,8)"; + "let funcEx1(x) = x @ (23,23--23,24)"; + "let genericFuncEx1(x) = x @ (24,29--24,30)"; + "let topPair1b = M.patternInput@25 ().Item1 @ (25,4--25,26)"; + "let topPair1a = M.patternInput@25 ().Item0 @ (25,4--25,26)"; + "let tyfuncEx1 = Type.GetTypeFromHandle (Operators.TypeOf<'T> ()) @ (26,20--26,26)"; + "let testILCall1 = new Object() @ (27,18--27,27)"; + "let testILCall2 = Console.WriteLine (\"176\") @ (28,18--28,49)"; + "let recValNeverUsedAtRuntime = recValNeverUsedAtRuntime@31.Force(()) @ (31,8--31,32)"; + "let recFuncIgnoresFirstArg(g) (v) = v @ (32,33--32,34)"; + "let testFun4(unitVar0) = let rec ... in recValNeverUsedAtRuntime @ (36,4--39,28)"; + "type ClassWithImplicitConstructor"; + "member .ctor(compiledAsArg) = (new Object(); (this.compiledAsArg <- compiledAsArg; (this.compiledAsField <- 1; let compiledAsLocal: Microsoft.FSharp.Core.int = 1 in let compiledAsLocal2: Microsoft.FSharp.Core.int = Operators.op_Addition (compiledAsLocal,compiledAsLocal) in ()))) @ (41,5--41,33)"; + "member .cctor(unitVar) = (compiledAsStaticField <- 1; let compiledAsStaticLocal: Microsoft.FSharp.Core.int = 1 in let compiledAsStaticLocal2: Microsoft.FSharp.Core.int = Operators.op_Addition (compiledAsStaticLocal,compiledAsStaticLocal) in ()) @ (49,11--49,40)"; + "member M1(__) (unitVar1) = Operators.op_Addition (Operators.op_Addition (__.compiledAsField,__.compiledAsGenericInstanceMethod(__.compiledAsField)),__.compiledAsArg) @ (55,21--55,102)"; + "member M2(__) (unitVar1) = __.compiledAsInstanceMethod(()) @ (56,21--56,47)"; + "member SM1(unitVar0) = Operators.op_Addition (compiledAsStaticField,ClassWithImplicitConstructor.compiledAsGenericStaticMethod (compiledAsStaticField)) @ (57,26--57,101)"; + "member SM2(unitVar0) = ClassWithImplicitConstructor.compiledAsStaticMethod (()) @ (58,26--58,50)"; + "member ToString(__) (unitVar1) = String.Concat (base.ToString(),let x: Microsoft.FSharp.Core.int = 999 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ...) @ (59,29--59,57)"; + "member TestCallinToString(this) (unitVar1) = this.ToString() @ (60,39--60,54)"; + "type Error"; "let err = {Data0 = 3; Data1 = 4} @ (64,10--64,20)"; + "let matchOnException(err) = match (if err :? M.Error then $0 else $1) targets ... @ (66,33--66,36)"; + "let upwardForLoop(unitVar0) = let mutable a: Microsoft.FSharp.Core.int = 1 in (for-loop; a) @ (69,16--69,17)"; + "let upwardForLoop2(unitVar0) = let mutable a: Microsoft.FSharp.Core.int = 1 in (for-loop; a) @ (74,16--74,17)"; + "let downwardForLoop(unitVar0) = let mutable a: Microsoft.FSharp.Core.int = 1 in (for-loop; a) @ (79,16--79,17)"; + "let quotationTest1(unitVar0) = quote(Operators.op_Addition (1,1)) @ (83,24--83,35)"; + "let quotationTest2(v) = quote(Operators.op_Addition (ExtraTopLevelOperators.SpliceExpression (v),1)) @ (84,24--84,36)"; + "type RecdType"; "type UnionType"; "type ClassWithEventsAndProperties"; + "member .ctor(unitVar0) = (new Object(); (this.ev <- new FSharpEvent`1(()); ())) @ (89,5--89,33)"; + "member .cctor(unitVar) = (sev <- new FSharpEvent`1(()); ()) @ (91,11--91,35)"; + "member get_InstanceProperty(x) (unitVar1) = (x.ev.Trigger(1); 1) @ (92,32--92,48)"; + "member get_StaticProperty(unitVar0) = (sev.Trigger(1); 1) @ (93,35--93,52)"; + "member get_InstanceEvent(x) (unitVar1) = x.ev.get_Publish(()) @ (94,29--94,39)"; + "member get_StaticEvent(x) (unitVar1) = sev.get_Publish(()) @ (95,27--95,38)"; + "let c = new ClassWithEventsAndProperties(()) @ (97,8--97,38)"; + "let v = M.c ().get_InstanceProperty(()) @ (98,8--98,26)"; + "do Console.WriteLine (\"777\")"; + "let functionWithSubmsumption(x) = IntrinsicFunctions.UnboxGeneric (x) @ (102,40--102,52)"; + "let functionWithCoercion(x) = let x: Microsoft.FSharp.Core.string = let x: Microsoft.FSharp.Core.string = IntrinsicFunctions.UnboxGeneric (x :> Microsoft.FSharp.Core.obj) in M.functionWithSubmsumption (x :> Microsoft.FSharp.Core.obj) in M.functionWithSubmsumption (x :> Microsoft.FSharp.Core.obj) @ (103,39--103,116)"; + "type MultiArgMethods"; + "member .ctor(c,d) = (new Object(); ()) @ (105,5--105,20)"; + "member Method(x) (a,b) = 1 @ (106,37--106,38)"; + "member CurriedMethod(x) (a1,b1) (a2,b2) = 1 @ (107,63--107,64)"; + "let testFunctionThatCallsMultiArgMethods(unitVar0) = let m: M.MultiArgMethods = new MultiArgMethods(3,4) in Operators.op_Addition (m.Method(7,8),let arg00: Microsoft.FSharp.Core.int = 9 in let arg01: Microsoft.FSharp.Core.int = 10 in let arg10: Microsoft.FSharp.Core.int = 11 in let arg11: Microsoft.FSharp.Core.int = 12 in m.CurriedMethod(arg00,arg01,arg10,arg11)) @ (110,8--110,9)"; + "let functionThatUsesObjectExpression(unitVar0) = { new Object() with member x.ToString(unitVar1) = let x: Microsoft.FSharp.Core.int = 888 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... } @ (114,3--114,55)"; + "let functionThatUsesObjectExpressionWithInterfaceImpl(unitVar0) = { new Object() with member x.ToString(unitVar1) = let x: Microsoft.FSharp.Core.int = 888 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... interface System.IComparable with member x.CompareTo(y) = 0 } :> System.IComparable @ (117,3--120,38)"; + "let testFunctionThatUsesUnitsOfMeasure(x) (y) = Operators.op_Addition,Microsoft.FSharp.Core.float<'u>,Microsoft.FSharp.Core.float<'u>> (x,y) @ (122,70--122,75)"; + "let testFunctionThatUsesAddressesAndByrefs(x) = let mutable w: Microsoft.FSharp.Core.int = 4 in let y1: Microsoft.FSharp.Core.byref = x in let y2: Microsoft.FSharp.Core.byref = &w in let arr: Microsoft.FSharp.Core.int Microsoft.FSharp.Core.[] = [|3; 4|] in let r: Microsoft.FSharp.Core.int Microsoft.FSharp.Core.ref = Operators.Ref (3) in let y3: Microsoft.FSharp.Core.byref = [I_ldelema (NormalAddress,false,ILArrayShapeFIX,TypeVar 0us)](arr,0) in let y4: Microsoft.FSharp.Core.byref = &r.contents in let z: Microsoft.FSharp.Core.int = Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (x,y1),y2),y3) in (w <- 3; (x <- 4; (y2 <- 4; (y3 <- 5; Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (z,x),y1),y2),y3),y4),IntrinsicFunctions.GetArray (arr,0)),r.contents))))) @ (125,16--125,17)"; + "let testFunctionThatUsesStructs1(dt) = dt.AddDays(3) @ (139,57--139,72)"; + "let testFunctionThatUsesStructs2(unitVar0) = let dt1: System.DateTime = DateTime.get_Now () in let mutable dt2: System.DateTime = DateTime.get_Now () in let dt3: System.TimeSpan = DateTime.op_Subtraction (dt1,dt2) in let dt4: System.DateTime = dt1.AddDays(3) in let dt5: Microsoft.FSharp.Core.int = dt1.get_Millisecond() in let dt6: Microsoft.FSharp.Core.byref = &dt2 in let dt7: System.TimeSpan = DateTime.op_Subtraction (dt6,dt4) in dt7 @ (142,7--142,10)"; + "let testFunctionThatUsesWhileLoop(unitVar0) = let mutable x: Microsoft.FSharp.Core.int = 1 in (while Operators.op_LessThan (x,100) do x <- Operators.op_Addition (x,1) done; x) @ (152,15--152,16)"; + "let testFunctionThatUsesTryWith(unitVar0) = try M.testFunctionThatUsesWhileLoop (()) with matchValue -> match (if matchValue :? System.ArgumentException then $0 else $1) targets ... @ (158,3--160,60)"; + "let testFunctionThatUsesTryFinally(unitVar0) = try M.testFunctionThatUsesWhileLoop (()) finally Console.WriteLine (\"8888\") @ (164,3--167,37)"; + "member Console.WriteTwoLines.Static(unitVar0) = (Console.WriteLine (); Console.WriteLine ()) @ (170,36--170,90)"; + "member DateTime.get_TwoMinute(x) (unitVar1) = Operators.op_Addition (x.get_Minute(),x.get_Minute()) @ (173,25--173,44)"; + "let testFunctionThatUsesExtensionMembers(unitVar0) = (M.Console.WriteTwoLines.Static (()); let v: Microsoft.FSharp.Core.int = DateTime.get_Now ().DateTime.get_TwoMinute(()) in M.Console.WriteTwoLines.Static (())) @ (176,3--178,33)"; + "let testFunctionThatUsesOptionMembers(unitVar0) = let x: Microsoft.FSharp.Core.int Microsoft.FSharp.Core.option = Some(3) in (x.get_IsSome() (),x.get_IsNone() ()) @ (181,7--181,8)"; + "let testFunctionThatUsesOverAppliedFunction(unitVar0) = Operators.Identity Microsoft.FSharp.Core.int> (fun x -> Operators.Identity (x)) 3 @ (185,3--185,10)"; + "let testFunctionThatUsesPatternMatchingOnLists(x) = match (if x.Isop_ColonColon then (if x.Tail.Isop_ColonColon then (if x.Tail.Tail.Isop_Nil then $2 else $3) else $1) else $0) targets ... @ (188,10--188,11)"; + "let testFunctionThatUsesPatternMatchingOnOptions(x) = match (if x.IsSome then $1 else $0) targets ... @ (195,10--195,11)"; + "let testFunctionThatUsesPatternMatchingOnOptions2(x) = match (if x.IsSome then $1 else $0) targets ... @ (200,10--200,11)"; + "let testFunctionThatUsesConditionalOnOptions2(x) = (if x.get_IsSome() () then 1 else 2) @ (205,4--205,29)"; + "let f(x) (y) = Operators.op_Addition (x,y) @ (207,12--207,15)"; + "let g = let x: Microsoft.FSharp.Core.int = 1 in fun y -> M.f (x,y) @ (208,8--208,11)"; + "let h = Operators.op_Addition (M.g () 2,3) @ (209,8--209,17)"; + "type TestFuncProp"; + "member .ctor(unitVar0) = (new Object(); ()) @ (211,5--211,17)"; + "member get_Id(this) (unitVar1) = fun x -> x @ (212,21--212,31)"; + "let wrong = Operators.op_Equality (new TestFuncProp(()).get_Id(()) 0,0) @ (214,12--214,35)"; + "let start(name) = (name,name) @ (217,4--217,14)"; + "let last(name,values) = Operators.Identity ((name,values)) @ (220,4--220,21)"; + "let last2(name) = Operators.Identity (name) @ (223,4--223,11)"; + "let test7(s) = let tupledArg: Microsoft.FSharp.Core.string * Microsoft.FSharp.Core.string = M.start (s) in let name: Microsoft.FSharp.Core.string = tupledArg.Item0 in let values: Microsoft.FSharp.Core.string = tupledArg.Item1 in M.last (name,values) @ (226,4--226,19)"; + "let test8(unitVar0) = fun tupledArg -> let name: Microsoft.FSharp.Core.string = tupledArg.Item0 in let values: Microsoft.FSharp.Core.string = tupledArg.Item1 in M.last (name,values) @ (229,4--229,8)"; + "let test9(s) = M.last (s,s) @ (232,4--232,17)"; + "let test10(unitVar0) = fun name -> M.last2 (name) @ (235,4--235,9)"; + "let test11(s) = M.last2 (s) @ (238,4--238,14)"; + "let badLoop = badLoop@240.Force Microsoft.FSharp.Core.int>(()) @ (240,8--240,15)"; + "type LetLambda"; + "let f = fun a -> fun b -> Operators.op_Addition (a,b) @ (247,8--247,24)"; + "let letLambdaRes = ListModule.Map (fun tupledArg -> let a: Microsoft.FSharp.Core.int = tupledArg.Item0 in let b: Microsoft.FSharp.Core.int = tupledArg.Item1 in (LetLambda.f () a) b,Cons((1,2),Empty())) @ (249,19--249,71)"] + + printDeclarations None (List.ofSeq file1.Declarations) + |> Seq.toList + |> filterHack + |> shouldEqual (filterHack expected) + + () +// #endif //--------------------------------------------------------------------------------------------------------- // This big list expression was causing us trouble @@ -866,6 +987,20 @@ let ``Test expressions of declarations stress big expressions`` () = // This should not stack overflow printDeclarations None (List.ofSeq file1.Declarations) |> Seq.toList |> ignore + +[] +let ``Test expressions of optimized declarations stress big expressions`` () = + let wholeProjectResults = exprChecker.ParseAndCheckProject(ProjectStressBigExpressions.options) |> Async.RunSynchronously + + wholeProjectResults.Errors.Length |> shouldEqual 0 + + wholeProjectResults.GetOptimizedAssemblyContents().ImplementationFiles.Length |> shouldEqual 1 + let file1 = wholeProjectResults.GetOptimizedAssemblyContents().ImplementationFiles.[0] + + // This should not stack overflow + printDeclarations None (List.ofSeq file1.Declarations) |> Seq.toList |> ignore + + #if NOT_YET_ENABLED #if !NO_PROJECTCRACKER && !DOTNETCORE diff --git a/tests/service/PerfTests.fs b/tests/service/PerfTests.fs index 6a162ced54a..dcc8a453557 100644 --- a/tests/service/PerfTests.fs +++ b/tests/service/PerfTests.fs @@ -65,16 +65,15 @@ let ``Test request for parse and check doesn't check whole project`` () = let pE, tE = FSharpChecker.GlobalForegroundParseCountStatistic, FSharpChecker.GlobalForegroundTypeCheckCountStatistic (pE - pD) |> shouldEqual 0 (tE - tD) |> shouldEqual 1 - (backgroundParseCount.Value <= 8) |> shouldEqual true // but note, the project does not get reparsed - (backgroundCheckCount.Value <= 8) |> shouldEqual true // only two extra typechecks of files + (backgroundParseCount.Value <= 9) |> shouldEqual true // but note, the project does not get reparsed + (backgroundCheckCount.Value <= 9) |> shouldEqual true // only two extra typechecks of files // A subsequent ParseAndCheck of identical source code doesn't do any more anything let checkResults2 = checker.ParseAndCheckFileInProject(Project1.fileNames.[7], 0, Project1.fileSources2.[7], Project1.options) |> Async.RunSynchronously let pF, tF = FSharpChecker.GlobalForegroundParseCountStatistic, FSharpChecker.GlobalForegroundTypeCheckCountStatistic (pF - pE) |> shouldEqual 0 // note, no new parse of the file (tF - tE) |> shouldEqual 0 // note, no new typecheck of the file - (backgroundParseCount.Value <= 8) |> shouldEqual true // but note, the project does not get reparsed - (backgroundCheckCount.Value <= 8) |> shouldEqual true // only two extra typechecks of files - + (backgroundParseCount.Value <= 9) |> shouldEqual true // but note, the project does not get reparsed + (backgroundCheckCount.Value <= 9) |> shouldEqual true // only two extra typechecks of files () diff --git a/tests/service/Program.fs b/tests/service/Program.fs index 45d9a343374..c94e2a49931 100644 --- a/tests/service/Program.fs +++ b/tests/service/Program.fs @@ -1,14 +1,6 @@ open System -open System.IO -open System.Reflection -open NUnitLite -open NUnit.Common - -type private TypeInThisAssembly = class end [] let main argv = printfn "Dotnet Core NUnit Tests..." - let writer = new ExtendedTextWrapper(Console.Out) - let runner = new AutoRun(typeof.GetTypeInfo().Assembly) - runner.Execute(argv, writer, Console.In) + 0 \ No newline at end of file diff --git a/tests/service/ProjectOptionsTests.fs b/tests/service/ProjectOptionsTests.fs index 1e995681fdb..d82fca93727 100644 --- a/tests/service/ProjectOptionsTests.fs +++ b/tests/service/ProjectOptionsTests.fs @@ -14,6 +14,7 @@ open System open System.IO open NUnit.Framework open FsUnit +open Microsoft.FSharp.Compiler.Ast open Microsoft.FSharp.Compiler.SourceCodeServices open FSharp.Compiler.Service.Tests.Common @@ -518,6 +519,46 @@ let ``Test SourceFiles order for GetProjectOptionsFromScript`` () = // See #594 test "Main4" [|"BaseLib2"; "Lib5"; "BaseLib1"; "Lib1"; "Lib2"; "Main4"|] test "MainBad" [|"MainBad"|] +[] +let ``Script load closure project`` () = + let fileName1 = Path.GetTempPath() + Path.DirectorySeparatorChar.ToString() + "Impl.fs" + let fileName2 = Path.ChangeExtension(Path.GetTempFileName(), ".fsx") + let fileSource1 = """ +module ImplFile - +#if INTERACTIVE +let x = 42 +#endif +""" + + let fileSource2 = """ +#load "Impl.fs" +ImplFile.x +""" + + File.WriteAllText(fileName1, fileSource1) + File.WriteAllText(fileName2, fileSource2) + + let projectOptions, diagnostics = + checker.GetProjectOptionsFromScript(fileName2, fileSource2) |> Async.RunSynchronously + diagnostics.IsEmpty |> shouldEqual true + + let _, checkResults = + checker.ParseAndCheckFileInProject(fileName2, 0, fileSource2, projectOptions) |> Async.RunSynchronously + + match checkResults with + | FSharpCheckFileAnswer.Succeeded results -> + results.Errors |> shouldEqual [| |] + | _ -> failwith "type check was aborted" + + let parsingOptions, diagnostics = checker.GetParsingOptionsFromProjectOptions(projectOptions) + diagnostics.IsEmpty |> shouldEqual true + + let parseResults = checker.ParseFile(fileName1, fileSource1, parsingOptions) |> Async.RunSynchronously + parseResults.ParseTree.IsSome |> shouldEqual true + match parseResults.ParseTree.Value with + | ParsedInput.ImplFile (ParsedImplFileInput (_, _, _, _, _, modules, _)) -> + let (SynModuleOrNamespace (_, _, _, decls, _, _, _, _)) = modules.Head + decls.Length |> shouldEqual 1 + | _ -> failwith "got sig file" diff --git a/tests/service/Symbols.fs b/tests/service/Symbols.fs new file mode 100644 index 00000000000..03001fe87c9 --- /dev/null +++ b/tests/service/Symbols.fs @@ -0,0 +1,57 @@ +#if INTERACTIVE +#r "../../Debug/fcs/net45/FSharp.Compiler.Service.dll" // note, run 'build fcs debug' to generate this, this DLL has a public API so can be used from F# Interactive +#r "../../packages/NUnit.3.5.0/lib/net45/nunit.framework.dll" +#load "FsUnit.fs" +#load "Common.fs" +#else +module Tests.Service.Symbols +#endif + +open FSharp.Compiler.Service.Tests.Common +open FsUnit +open NUnit.Framework +open Microsoft.FSharp.Compiler.SourceCodeServices + +module ActivePatterns = + + let completePatternInput = """ +let (|True|False|) = function + | true -> True + | false -> False + +match true with +| True | False -> () +""" + + let partialPatternInput = """ +let (|String|_|) = function + | :? String -> Some () + | _ -> None + +match "foo" with +| String +| _ -> () +""" + + let getCaseUsages source line = + let fileName, options = mkTestFileAndOptions source [| |] + let _, checkResults = parseAndCheckFile fileName source options + + checkResults.GetAllUsesOfAllSymbolsInFile() + |> Async.RunSynchronously + |> Array.filter (fun su -> su.RangeAlternate.StartLine = line && su.Symbol :? FSharpActivePatternCase) + |> Array.map (fun su -> su.Symbol :?> FSharpActivePatternCase) + + [] + let ``Active pattern case indices`` () = + let getIndices = Array.map (fun (case: FSharpActivePatternCase) -> case.Index) + + getCaseUsages completePatternInput 7 |> getIndices |> shouldEqual [| 0; 1 |] + getCaseUsages partialPatternInput 7 |> getIndices |> shouldEqual [| 0 |] + + [] + let ``Active pattern group names`` () = + let getGroupName (case: FSharpActivePatternCase) = case.Group.Name.Value + + getCaseUsages completePatternInput 7 |> Array.head |> getGroupName |> shouldEqual "|True|False|" + getCaseUsages partialPatternInput 7 |> Array.head |> getGroupName |> shouldEqual "|String|_|" diff --git a/vsintegration/ProjectTemplates/TutorialProject/Template/xlf/Tutorial.fsx.ja.xlf b/vsintegration/ProjectTemplates/TutorialProject/Template/xlf/Tutorial.fsx.ja.xlf index ea54080a5fa..a384149acde 100644 --- a/vsintegration/ProjectTemplates/TutorialProject/Template/xlf/Tutorial.fsx.ja.xlf +++ b/vsintegration/ProjectTemplates/TutorialProject/Template/xlf/Tutorial.fsx.ja.xlf @@ -164,7 +164,7 @@ in the course of a program's execution unless explicitly marked as mutable. - + diff --git a/vsintegration/Vsix/RegisterFsharpPackage.pkgdef b/vsintegration/Vsix/RegisterFsharpPackage.pkgdef index ec8375a91b5..128360de578 100644 --- a/vsintegration/Vsix/RegisterFsharpPackage.pkgdef +++ b/vsintegration/Vsix/RegisterFsharpPackage.pkgdef @@ -122,6 +122,9 @@ "TemplatesDir"="\.\NullPath" @="#6007" +[$RootKey$\Projects\{349C5851-65DF-11DA-9384-00065B846F21}\LanguageTemplates] +"{F2A71F9B-5D33-465A-A702-920D77279786}"="{76B279E8-36ED-494E-B145-5344F8DEFCB6}" + [$RootKey$\Projects\{4ead5bc6-47f1-4fcb-823d-0cd64302d5b9}\WebApplicationProperties] "CodeBehindCodeGenerator"="{00000000-0000-0000-0000-000000000000}" diff --git a/vsintegration/src/FSharp.Editor/CodeFix/AddOpenCodeFixProvider.fs b/vsintegration/src/FSharp.Editor/CodeFix/AddOpenCodeFixProvider.fs index 76f88464e7a..b90e44f91e9 100644 --- a/vsintegration/src/FSharp.Editor/CodeFix/AddOpenCodeFixProvider.fs +++ b/vsintegration/src/FSharp.Editor/CodeFix/AddOpenCodeFixProvider.fs @@ -101,7 +101,7 @@ type internal FSharpAddOpenCodeFixProvider let! _, parsedInput, checkResults = checker.ParseAndCheckDocument(document, projectOptions, allowStaleResults = true, sourceText = sourceText, userOpName = userOpName) let line = sourceText.Lines.GetLineFromPosition(context.Span.End) let linePos = sourceText.Lines.GetLinePosition(context.Span.End) - let defines = CompilerEnvironment.GetCompilationDefinesForEditing(document.Name, parsingOptions) + let defines = CompilerEnvironment.GetCompilationDefinesForEditing parsingOptions let! symbol = asyncMaybe { diff --git a/vsintegration/src/FSharp.Editor/CodeFix/ImplementInterfaceCodeFixProvider.fs b/vsintegration/src/FSharp.Editor/CodeFix/ImplementInterfaceCodeFixProvider.fs index 5cf5fcba215..da7c4248262 100644 --- a/vsintegration/src/FSharp.Editor/CodeFix/ImplementInterfaceCodeFixProvider.fs +++ b/vsintegration/src/FSharp.Editor/CodeFix/ImplementInterfaceCodeFixProvider.fs @@ -144,7 +144,7 @@ type internal FSharpImplementInterfaceCodeFixProvider let! sourceText = context.Document.GetTextAsync(cancellationToken) let! _, parsedInput, checkFileResults = checker.ParseAndCheckDocument(context.Document, projectOptions, sourceText = sourceText, allowStaleResults = true, userOpName = userOpName) let textLine = sourceText.Lines.GetLineFromPosition context.Span.Start - let defines = CompilerEnvironment.GetCompilationDefinesForEditing(context.Document.FilePath, parsingOptions) + let defines = CompilerEnvironment.GetCompilationDefinesForEditing parsingOptions // Notice that context.Span doesn't return reliable ranges to find tokens at exact positions. // That's why we tokenize the line and try to find the last successive identifier token let tokens = Tokenizer.tokenizeLine(context.Document.Id, sourceText, context.Span.Start, context.Document.FilePath, defines) diff --git a/vsintegration/src/FSharp.Editor/CodeFix/RenameUnusedValue.fs b/vsintegration/src/FSharp.Editor/CodeFix/RenameUnusedValue.fs index 48e547ab713..949b76b6575 100644 --- a/vsintegration/src/FSharp.Editor/CodeFix/RenameUnusedValue.fs +++ b/vsintegration/src/FSharp.Editor/CodeFix/RenameUnusedValue.fs @@ -47,6 +47,9 @@ type internal FSharpRenameUnusedValueCodeFixProvider override __.RegisterCodeFixesAsync context : Task = asyncMaybe { + // Don't show code fixes for unused values, even if they are compiler-generated. + do! Option.guard Settings.CodeFixes.UnusedDeclarations + let document = context.Document let! sourceText = document.GetTextAsync() let ident = sourceText.ToString(context.Span) @@ -57,7 +60,7 @@ type internal FSharpRenameUnusedValueCodeFixProvider let! parsingOptions, projectOptions = projectInfoManager.TryGetOptionsForEditingDocumentOrProject document let! _, _, checkResults = checker.ParseAndCheckDocument(document, projectOptions, allowStaleResults = true, sourceText = sourceText, userOpName=userOpName) let m = RoslynHelpers.TextSpanToFSharpRange(document.FilePath, context.Span, sourceText) - let defines = CompilerEnvironment.GetCompilationDefinesForEditing (document.FilePath, parsingOptions) + let defines = CompilerEnvironment.GetCompilationDefinesForEditing parsingOptions let! lexerSymbol = Tokenizer.getSymbolAtPosition (document.Id, sourceText, context.Span.Start, document.FilePath, defines, SymbolLookupKind.Greedy, false) let lineText = (sourceText.Lines.GetLineFromPosition context.Span.Start).ToString() let! symbolUse = checkResults.GetSymbolUseAtLocation(m.StartLine, m.EndColumn, lineText, lexerSymbol.FullIsland, userOpName=userOpName) diff --git a/vsintegration/src/FSharp.Editor/Diagnostics/UnusedDeclarationsAnalyzer.fs b/vsintegration/src/FSharp.Editor/Diagnostics/UnusedDeclarationsAnalyzer.fs index 071f0aadbe1..8eb4a1e6d10 100644 --- a/vsintegration/src/FSharp.Editor/Diagnostics/UnusedDeclarationsAnalyzer.fs +++ b/vsintegration/src/FSharp.Editor/Diagnostics/UnusedDeclarationsAnalyzer.fs @@ -100,6 +100,8 @@ type internal UnusedDeclarationsAnalyzer() = override __.AnalyzeSemanticsAsync(document, cancellationToken) = asyncMaybe { + do! Option.guard Settings.CodeFixes.UnusedDeclarations + do Trace.TraceInformation("{0:n3} (start) UnusedDeclarationsAnalyzer", DateTime.Now.TimeOfDay.TotalSeconds) do! Async.Sleep DefaultTuning.UnusedDeclarationsAnalyzerInitialDelay |> liftAsync // be less intrusive, give other work priority most of the time match getProjectInfoManager(document).TryGetOptionsForEditingDocumentOrProject(document) with diff --git a/vsintegration/src/FSharp.Editor/DocumentHighlights/DocumentHighlightsService.fs b/vsintegration/src/FSharp.Editor/DocumentHighlights/DocumentHighlightsService.fs index 354c41759dd..5074245f9da 100644 --- a/vsintegration/src/FSharp.Editor/DocumentHighlights/DocumentHighlightsService.fs +++ b/vsintegration/src/FSharp.Editor/DocumentHighlights/DocumentHighlightsService.fs @@ -79,7 +79,7 @@ type internal FSharpDocumentHighlightsService [] (checkerP let! parsingOptions, projectOptions = projectInfoManager.TryGetOptionsForEditingDocumentOrProject(document) let! sourceText = document.GetTextAsync(cancellationToken) let! textVersion = document.GetTextVersionAsync(cancellationToken) - let defines = CompilerEnvironment.GetCompilationDefinesForEditing(document.Name, parsingOptions) + let defines = CompilerEnvironment.GetCompilationDefinesForEditing parsingOptions let! spans = FSharpDocumentHighlightsService.GetDocumentHighlights(checkerProvider.Checker, document.Id, sourceText, document.FilePath, position, defines, projectOptions, textVersion.GetHashCode()) let highlightSpans = diff --git a/vsintegration/src/FSharp.Editor/Formatting/EditorFormattingService.fs b/vsintegration/src/FSharp.Editor/Formatting/EditorFormattingService.fs index d4b1b24ebf6..fd20d89d26d 100644 --- a/vsintegration/src/FSharp.Editor/Formatting/EditorFormattingService.fs +++ b/vsintegration/src/FSharp.Editor/Formatting/EditorFormattingService.fs @@ -38,7 +38,7 @@ type internal FSharpEditorFormattingService let line = sourceText.Lines.[sourceText.Lines.IndexOf position] - let defines = CompilerEnvironment.GetCompilationDefinesForEditing(filePath, parsingOptions) + let defines = CompilerEnvironment.GetCompilationDefinesForEditing parsingOptions let tokens = Tokenizer.tokenizeLine(documentId, sourceText, line.Start, filePath, defines) diff --git a/vsintegration/src/FSharp.Editor/Formatting/IndentationService.fs b/vsintegration/src/FSharp.Editor/Formatting/IndentationService.fs index 23afe5131ce..c0fb75430f3 100644 --- a/vsintegration/src/FSharp.Editor/Formatting/IndentationService.fs +++ b/vsintegration/src/FSharp.Editor/Formatting/IndentationService.fs @@ -37,7 +37,7 @@ type internal FSharpIndentationService let rec tryFindLastNonWhitespaceOrCommentToken (line: TextLine) = maybe { let! parsingOptions, _projectOptions = options - let defines = CompilerEnvironment.GetCompilationDefinesForEditing(filePath, parsingOptions) + let defines = CompilerEnvironment.GetCompilationDefinesForEditing parsingOptions let tokens = Tokenizer.tokenizeLine(documentId, sourceText, line.Start, filePath, defines) return! diff --git a/vsintegration/src/FSharp.Editor/InlineRename/InlineRenameService.fs b/vsintegration/src/FSharp.Editor/InlineRename/InlineRenameService.fs index 89e9d6a8f2d..81d87ed4a5e 100644 --- a/vsintegration/src/FSharp.Editor/InlineRename/InlineRenameService.fs +++ b/vsintegration/src/FSharp.Editor/InlineRename/InlineRenameService.fs @@ -169,7 +169,7 @@ type internal InlineRenameService asyncMaybe { let! parsingOptions, projectOptions = projectInfoManager.TryGetOptionsForEditingDocumentOrProject(document) let! sourceText = document.GetTextAsync(cancellationToken) - let defines = CompilerEnvironment.GetCompilationDefinesForEditing(document.Name, parsingOptions) + let defines = CompilerEnvironment.GetCompilationDefinesForEditing parsingOptions return! InlineRenameService.GetInlineRenameInfo(checkerProvider.Checker, projectInfoManager, document, sourceText, position, defines, projectOptions) } |> Async.map (Option.defaultValue FailureInlineRenameInfo.Instance) diff --git a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs index 1686e96a3d5..96540a83739 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs @@ -162,8 +162,8 @@ type internal FSharpProjectOptionsManager let parsingOptions = match projectOptionsOpt with | Some (parsingOptions, _site, _projectOptions) -> parsingOptions - | _ -> FSharpParsingOptions.Default - CompilerEnvironment.GetCompilationDefinesForEditing(document.Name, parsingOptions) + | _ -> { FSharpParsingOptions.Default with IsInteractive = IsScript document.Name } + CompilerEnvironment.GetCompilationDefinesForEditing parsingOptions /// Try and get the Options for a project member this.TryGetOptionsForProject(projectId:ProjectId) = projectOptionsTable.TryGetOptionsForProject(projectId) diff --git a/vsintegration/src/FSharp.Editor/LanguageService/SymbolHelpers.fs b/vsintegration/src/FSharp.Editor/LanguageService/SymbolHelpers.fs index 34e42ff637a..e44ac3da833 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/SymbolHelpers.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/SymbolHelpers.fs @@ -31,7 +31,7 @@ module internal SymbolHelpers = let textLinePos = sourceText.Lines.GetLinePosition(position) let fcsTextLineNumber = Line.fromZ textLinePos.Line let! parsingOptions, projectOptions = projectInfoManager.TryGetOptionsForEditingDocumentOrProject(document) - let defines = CompilerEnvironment.GetCompilationDefinesForEditing(document.Name, parsingOptions) + let defines = CompilerEnvironment.GetCompilationDefinesForEditing parsingOptions let! symbol = Tokenizer.getSymbolAtPosition(document.Id, sourceText, position, document.FilePath, defines, SymbolLookupKind.Greedy, false) let! _, _, checkFileResults = checker.ParseAndCheckDocument(document.FilePath, textVersionHash, sourceText.ToString(), projectOptions, allowStaleResults = true, userOpName = userOpName) let! symbolUse = checkFileResults.GetSymbolUseAtLocation(fcsTextLineNumber, symbol.Ident.idRange.EndColumn, textLine.ToString(), symbol.FullIsland, userOpName=userOpName) @@ -96,7 +96,7 @@ module internal SymbolHelpers = let originalText = sourceText.ToString(symbolSpan) do! Option.guard (originalText.Length > 0) let! parsingOptions, projectOptions = projectInfoManager.TryGetOptionsForEditingDocumentOrProject document - let defines = CompilerEnvironment.GetCompilationDefinesForEditing(document.Name, parsingOptions) + let defines = CompilerEnvironment.GetCompilationDefinesForEditing parsingOptions let! symbol = Tokenizer.getSymbolAtPosition(document.Id, sourceText, symbolSpan.Start, document.FilePath, defines, SymbolLookupKind.Greedy, false) let! _, _, checkFileResults = checker.ParseAndCheckDocument(document, projectOptions, allowStaleResults = true, userOpName = userOpName) let textLine = sourceText.Lines.GetLineFromPosition(symbolSpan.Start) diff --git a/vsintegration/src/FSharp.Editor/Navigation/FindUsagesService.fs b/vsintegration/src/FSharp.Editor/Navigation/FindUsagesService.fs index 0f7fde12e79..bd18d1ca918 100644 --- a/vsintegration/src/FSharp.Editor/Navigation/FindUsagesService.fs +++ b/vsintegration/src/FSharp.Editor/Navigation/FindUsagesService.fs @@ -55,7 +55,7 @@ type internal FSharpFindUsagesService let! _, _, checkFileResults = checker.ParseAndCheckDocument(document, projectOptions, sourceText = sourceText, allowStaleResults = true, userOpName = userOpName) let textLine = sourceText.Lines.GetLineFromPosition(position).ToString() let lineNumber = sourceText.Lines.GetLinePosition(position).Line + 1 - let defines = CompilerEnvironment.GetCompilationDefinesForEditing(document.FilePath, parsingOptions) + let defines = CompilerEnvironment.GetCompilationDefinesForEditing parsingOptions let! symbol = Tokenizer.getSymbolAtPosition(document.Id, sourceText, position, document.FilePath, defines, SymbolLookupKind.Greedy, false) let! symbolUse = checkFileResults.GetSymbolUseAtLocation(lineNumber, symbol.Ident.idRange.EndColumn, textLine, symbol.FullIsland, userOpName=userOpName) diff --git a/vsintegration/src/FSharp.Editor/Navigation/GoToDefinitionService.fs b/vsintegration/src/FSharp.Editor/Navigation/GoToDefinitionService.fs index 7707b8a2554..91bc81690d3 100644 --- a/vsintegration/src/FSharp.Editor/Navigation/GoToDefinitionService.fs +++ b/vsintegration/src/FSharp.Editor/Navigation/GoToDefinitionService.fs @@ -58,7 +58,7 @@ type internal GoToDefinition(checker: FSharpChecker, projectInfoManager: FSharpP let findSymbolHelper (originDocument: Document, originRange: range, sourceText: SourceText, preferSignature: bool) : Async = asyncMaybe { let! parsingOptions, projectOptions = projectInfoManager.TryGetOptionsForEditingDocumentOrProject originDocument - let defines = CompilerEnvironment.GetCompilationDefinesForEditing (originDocument.FilePath, parsingOptions) + let defines = CompilerEnvironment.GetCompilationDefinesForEditing parsingOptions let! originTextSpan = RoslynHelpers.TryFSharpRangeToTextSpan (sourceText, originRange) let position = originTextSpan.Start let! lexerSymbol = Tokenizer.getSymbolAtPosition (originDocument.Id, sourceText, position, originDocument.FilePath, defines, SymbolLookupKind.Greedy, false) @@ -297,7 +297,7 @@ type internal FSharpGoToDefinitionService asyncMaybe { let! parsingOptions, projectOptions = projectInfoManager.TryGetOptionsForEditingDocumentOrProject originDocument let! sourceText = originDocument.GetTextAsync () |> liftTaskAsync - let defines = CompilerEnvironment.GetCompilationDefinesForEditing (originDocument.FilePath, parsingOptions) + let defines = CompilerEnvironment.GetCompilationDefinesForEditing parsingOptions let textLine = sourceText.Lines.GetLineFromPosition position let textLinePos = sourceText.Lines.GetLinePosition position let fcsTextLineNumber = Line.fromZ textLinePos.Line diff --git a/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs b/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs index 0f4409a99d1..387b808b717 100644 --- a/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs +++ b/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs @@ -34,7 +34,8 @@ type QuickInfoOptions = type CodeFixesOptions = { SimplifyName: bool AlwaysPlaceOpensAtTopLevel: bool - UnusedOpens: bool } + UnusedOpens: bool + UnusedDeclarations: bool } [] type LanguageServicePerformanceOptions = @@ -59,7 +60,8 @@ type internal Settings [](store: SettingsStore) = // See https://github.com/Microsoft/visualfsharp/pull/3238#issue-237699595 SimplifyName = false AlwaysPlaceOpensAtTopLevel = false - UnusedOpens = true } + UnusedOpens = true + UnusedDeclarations = true } store.RegisterDefault { EnableInMemoryCrossProjectReferences = true diff --git a/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs b/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs index 802d8948ca5..5a3fb13d8c8 100644 --- a/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs +++ b/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs @@ -56,7 +56,7 @@ module private FSharpQuickInfo = // project options need to be retrieved because the signature file could be in another project let! extParsingOptions, _extSite, extProjectOptions = projectInfoManager.TryGetOptionsForProject extDocId.ProjectId - let extDefines = CompilerEnvironment.GetCompilationDefinesForEditing (extDocument.FilePath, extParsingOptions) + let extDefines = CompilerEnvironment.GetCompilationDefinesForEditing extParsingOptions let! extLexerSymbol = Tokenizer.getSymbolAtPosition(extDocId, extSourceText, extSpan.Start, declRange.FileName, extDefines, SymbolLookupKind.Greedy, true) let! _, _, extCheckFileResults = checker.ParseAndCheckDocument(extDocument, extProjectOptions, allowStaleResults=true, sourceText=extSourceText, userOpName = userOpName) @@ -92,7 +92,7 @@ module private FSharpQuickInfo = asyncMaybe { let! sourceText = document.GetTextAsync cancellationToken let! parsingOptions, projectOptions = projectInfoManager.TryGetOptionsForEditingDocumentOrProject document - let defines = CompilerEnvironment.GetCompilationDefinesForEditing(document.FilePath, parsingOptions) + let defines = CompilerEnvironment.GetCompilationDefinesForEditing parsingOptions let! lexerSymbol = Tokenizer.getSymbolAtPosition(document.Id, sourceText, position, document.FilePath, defines, SymbolLookupKind.Greedy, true) let idRange = lexerSymbol.Ident.idRange let! _, _, checkFileResults = checker.ParseAndCheckDocument(document, projectOptions, allowStaleResults = true, sourceText=sourceText, userOpName = userOpName) @@ -175,7 +175,7 @@ type internal FSharpQuickInfoProvider let! _, _, checkFileResults = checker.ParseAndCheckDocument (filePath, textVersionHash, sourceText.ToString(), options, allowStaleResults = true, userOpName = FSharpQuickInfo.userOpName) let textLine = sourceText.Lines.GetLineFromPosition position let textLineNumber = textLine.LineNumber + 1 // Roslyn line numbers are zero-based - let defines = CompilerEnvironment.GetCompilationDefinesForEditing (filePath, parsingOptions) + let defines = CompilerEnvironment.GetCompilationDefinesForEditing parsingOptions let! symbol = Tokenizer.getSymbolAtPosition (documentId, sourceText, position, filePath, defines, SymbolLookupKind.Precise, true) let! res = checkFileResults.GetStructuredToolTipText (textLineNumber, symbol.Ident.idRange.EndColumn, textLine.ToString(), symbol.FullIsland, FSharpTokenTag.IDENT, userOpName=FSharpQuickInfo.userOpName) |> liftAsync match res with diff --git a/vsintegration/src/FSharp.LanguageService/ProjectSitesAndFiles.fs b/vsintegration/src/FSharp.LanguageService/ProjectSitesAndFiles.fs index cc6e220d661..89539b6180e 100644 --- a/vsintegration/src/FSharp.LanguageService/ProjectSitesAndFiles.fs +++ b/vsintegration/src/FSharp.LanguageService/ProjectSitesAndFiles.fs @@ -385,8 +385,9 @@ type internal ProjectSitesAndFiles() = member art.GetDefinesForFile_DEPRECATED(rdt:IVsRunningDocumentTable, filename : string, checker:FSharpChecker) = // The only caller of this function calls it each time it needs to colorize a line, so this call must execute very fast. - if SourceFile.MustBeSingleFileProject(filename) then - CompilerEnvironment.GetCompilationDefinesForEditing(filename,FSharpParsingOptions.Default) + if SourceFile.MustBeSingleFileProject(filename) then + let parsingOptions = { FSharpParsingOptions.Default with IsInteractive = true} + CompilerEnvironment.GetCompilationDefinesForEditing parsingOptions else let siteOpt = match VsRunningDocumentTable.FindDocumentWithoutLocking(rdt,filename) with @@ -399,7 +400,7 @@ type internal ProjectSitesAndFiles() = | None -> ProjectSitesAndFiles.ProjectSiteOfSingleFile(filename) let parsingOptions,_ = checker.GetParsingOptionsFromCommandLineArgs(site.CompilationOptions |> Array.toList) - CompilerEnvironment.GetCompilationDefinesForEditing(filename,parsingOptions) + CompilerEnvironment.GetCompilationDefinesForEditing parsingOptions member art.TryFindOwningProject_DEPRECATED(rdt:IVsRunningDocumentTable, filename) = if SourceFile.MustBeSingleFileProject(filename) then None diff --git a/vsintegration/src/FSharp.ProjectSystem.FSharp/xlf/VSPackage.zh-Hant.xlf b/vsintegration/src/FSharp.ProjectSystem.FSharp/xlf/VSPackage.zh-Hant.xlf index 5b1c22417fd..cfb5564ff18 100644 --- a/vsintegration/src/FSharp.ProjectSystem.FSharp/xlf/VSPackage.zh-Hant.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.FSharp/xlf/VSPackage.zh-Hant.xlf @@ -329,7 +329,7 @@ A project item for consuming a .NET Managed Resources File (Resx) using ResxFile type provider. - 此專案項目用於利用 ResxFile 型別提供者來使用 .NET Managed 資源檔案 (Resx)。 + 此專案項目用於利用 ResxFile 型別提供者來使用 .NET 受控資源檔案 (Resx)。 diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/PropertyPages/xlf/DebugPropPage.zh-Hant.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/PropertyPages/xlf/DebugPropPage.zh-Hant.xlf index c9ef4cc2515..8363b99591c 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/PropertyPages/xlf/DebugPropPage.zh-Hant.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/PropertyPages/xlf/DebugPropPage.zh-Hant.xlf @@ -84,7 +84,7 @@ Enable &unmanaged code debugging - 啟用 Unmanaged 程式碼偵錯(&U) + 啟用非受控程式碼偵錯(&U) diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hant.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hant.xlf index 47c2fa025b0..272f1b2e49f 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hant.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hant.xlf @@ -1642,7 +1642,7 @@ Error: The current object is auto-generated and only supports renaming through the Managed Resources Editor. - 目前的物件是自動產生的,而且僅支援透過 Managed 資源編輯器重新命名。 + 目前的物件是自動產生的,而且僅支援透過受控資源編輯器重新命名。 @@ -2123,7 +2123,7 @@ CONSIDER: get this from CodeDom Managed Resources Editor - Managed 資源編輯器 + 受控資源編輯器 diff --git a/vsintegration/src/FSharp.UIResources/CodeFixesOptionControl.xaml b/vsintegration/src/FSharp.UIResources/CodeFixesOptionControl.xaml index d6ba236a1c1..b9e9f428146 100644 --- a/vsintegration/src/FSharp.UIResources/CodeFixesOptionControl.xaml +++ b/vsintegration/src/FSharp.UIResources/CodeFixesOptionControl.xaml @@ -26,6 +26,8 @@ + diff --git a/vsintegration/src/FSharp.UIResources/Strings.Designer.cs b/vsintegration/src/FSharp.UIResources/Strings.Designer.cs index ff02acbe6e1..930363c3ddb 100644 --- a/vsintegration/src/FSharp.UIResources/Strings.Designer.cs +++ b/vsintegration/src/FSharp.UIResources/Strings.Designer.cs @@ -19,7 +19,7 @@ namespace Microsoft.VisualStudio.FSharp.UIResources { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class Strings { @@ -195,6 +195,15 @@ public static string Solid_underline { } } + /// + /// Looks up a localized string similar to Analyze and suggest fixes for unused values. + /// + public static string Unused_declaration_code_fix { + get { + return ResourceManager.GetString("Unused_declaration_code_fix", resourceCulture); + } + } + /// /// Looks up a localized string similar to Remove unused open statements. /// diff --git a/vsintegration/src/FSharp.UIResources/Strings.resx b/vsintegration/src/FSharp.UIResources/Strings.resx index 4500bfcc71f..1e485e1734f 100644 --- a/vsintegration/src/FSharp.UIResources/Strings.resx +++ b/vsintegration/src/FSharp.UIResources/Strings.resx @@ -165,4 +165,7 @@ Remove unused open statements + + Analyze and suggest fixes for unused values + \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf index 98842eff9b3..b5661fcf99c 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf @@ -82,6 +82,11 @@ Odebrat nepoužívané otevřené výkazy + + Analyze and suggest fixes for unused values + Analyzovat a navrhovat opravy pro nepoužité hodnoty + + \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf index d5bde673d62..61b8644e763 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf @@ -82,6 +82,11 @@ Nicht verwendete "open"-Anweisungen entfernen + + Analyze and suggest fixes for unused values + Korrekturen für nicht verwendete Werte analysieren und vorschlagen + + \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.en.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.en.xlf index 29e020c9441..8f182327ec7 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.en.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.en.xlf @@ -82,6 +82,11 @@ Remove unused open statements + + Analyze and suggest fixes for unused values + Analyze and suggest fixes for unused values + + \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf index 362a0e43273..bbd423295ee 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf @@ -82,6 +82,11 @@ Quitar instrucciones open no usadas + + Analyze and suggest fixes for unused values + Analizar y sugerir correcciones para valores no utilizados + + \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.fr.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.fr.xlf index bcf05ee03d9..4a357f591cb 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.fr.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.fr.xlf @@ -82,6 +82,11 @@ Supprimer les instructions open inutilisées + + Analyze and suggest fixes for unused values + Analyser et proposer des solutions pour les valeurs inutilisées + + \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.it.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.it.xlf index 507714c2bd3..45dab1e9e73 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.it.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.it.xlf @@ -82,6 +82,11 @@ Rimuovi istruzioni OPEN inutilizzate + + Analyze and suggest fixes for unused values + Analizza e suggerisci correzioni per valori inutilizzati + + \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.ja.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.ja.xlf index 450504b6049..4259f31f548 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.ja.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.ja.xlf @@ -82,6 +82,11 @@ 未使用の Open ステートメントを削除する + + Analyze and suggest fixes for unused values + 未使用の値を分析して修正を提案する + + \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.ko.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.ko.xlf index 55e8ffe0191..09880b80383 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.ko.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.ko.xlf @@ -82,6 +82,11 @@ 사용되지 않는 open 문 제거 + + Analyze and suggest fixes for unused values + 사용되지 않는 값에 대해 수정 사항 분석 및 제안 + + \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.pl.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.pl.xlf index fd038b27301..9789f982e96 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.pl.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.pl.xlf @@ -82,6 +82,11 @@ Usuń nieużywane otwarte instrukcje + + Analyze and suggest fixes for unused values + Analizuj nieużywane wartości i sugeruj dla nich poprawki + + \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.pt-BR.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.pt-BR.xlf index c0315f9326a..17c89633135 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.pt-BR.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.pt-BR.xlf @@ -82,6 +82,11 @@ Remover instruções abertas não usadas + + Analyze and suggest fixes for unused values + Analisar e sugerir correções de valores não usados + + \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.ru.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.ru.xlf index ef0567208f7..af942d657da 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.ru.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.ru.xlf @@ -82,6 +82,11 @@ Удалить неиспользуемые открытые операторы + + Analyze and suggest fixes for unused values + Проанализировать и предложить исправления для неиспользуемых значений + + \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.tr.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.tr.xlf index e9964bee3c6..3edba18c3a8 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.tr.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.tr.xlf @@ -82,6 +82,11 @@ Kullanılmayan açık deyimleri kaldır + + Analyze and suggest fixes for unused values + Kullanılmayan değerlere yönelik düzeltmeleri çözümle + + \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hans.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hans.xlf index c5cf82ce60e..29b9ae3f5ff 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hans.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hans.xlf @@ -82,6 +82,11 @@ 删除未使用的 open 语句 + + Analyze and suggest fixes for unused values + 分析未使用的值并建议相应的修补程序 + + \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hant.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hant.xlf index 8701a74ac44..39042ef0d7f 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hant.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hant.xlf @@ -82,6 +82,11 @@ 移除未使用的 open 陳述式 + + Analyze and suggest fixes for unused values + 分析未使用的值並建議修正 + + \ No newline at end of file diff --git a/vsintegration/tests/unittests/VisualFSharp.UnitTests.fsproj b/vsintegration/tests/unittests/VisualFSharp.UnitTests.fsproj index 99bfe362cfb..0eb67c32862 100644 --- a/vsintegration/tests/unittests/VisualFSharp.UnitTests.fsproj +++ b/vsintegration/tests/unittests/VisualFSharp.UnitTests.fsproj @@ -64,6 +64,9 @@ Common.fs + + ServiceAnalysis\Symbols.fs + EditorTests.fs @@ -376,7 +379,7 @@ $(FSharpSourcesRoot)\..\packages\System.ValueTuple.4.3.1\lib\netstandard1.0\System.ValueTuple.dll true - + VisualFSharp.Salsa {fbd4b354-dc6e-4032-8ec7-c81d8dfb1af7} True From 183dc8d369f5540f7b1d77e1e48f3e36a0fd9a4d Mon Sep 17 00:00:00 2001 From: ncave <777696+ncave@users.noreply.github.com> Date: Sat, 20 Jan 2018 11:10:13 -0800 Subject: [PATCH 08/21] test conditions update --- tests/service/ExprTests.fs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/service/ExprTests.fs b/tests/service/ExprTests.fs index 0d08e1ba089..e3361756178 100644 --- a/tests/service/ExprTests.fs +++ b/tests/service/ExprTests.fs @@ -528,7 +528,7 @@ let bool2 = false let options = checker.GetProjectOptionsFromCommandLineArgs (projFileName, args) //<@ let x = Some(3) in x.IsSome @> -//#if !NO_EXTENSIONTYPING +#if !NO_EXTENSIONTYPING || DOTNETCORE [] let ``Test Declarations project1`` () = let wholeProjectResults = exprChecker.ParseAndCheckProject(Project1.options) |> Async.RunSynchronously @@ -769,7 +769,7 @@ let ``Test Optimized Declarations Project1`` () = |> shouldEqual (filterHack expected) () -// #endif +#endif //--------------------------------------------------------------------------------------------------------- // This big list expression was causing us trouble From f7ecba3c91a94d13726e881f130859a01b7ca7a5 Mon Sep 17 00:00:00 2001 From: ncave <777696+ncave@users.noreply.github.com> Date: Wed, 24 Jan 2018 07:42:10 -0800 Subject: [PATCH 09/21] test update --- tests/service/ExprTests.fs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/service/ExprTests.fs b/tests/service/ExprTests.fs index e3361756178..5ba37718b0e 100644 --- a/tests/service/ExprTests.fs +++ b/tests/service/ExprTests.fs @@ -699,7 +699,7 @@ let ``Test Optimized Declarations Project1`` () = "member M2(__) (unitVar1) = __.compiledAsInstanceMethod(()) @ (56,21--56,47)"; "member SM1(unitVar0) = Operators.op_Addition (compiledAsStaticField,ClassWithImplicitConstructor.compiledAsGenericStaticMethod (compiledAsStaticField)) @ (57,26--57,101)"; "member SM2(unitVar0) = ClassWithImplicitConstructor.compiledAsStaticMethod (()) @ (58,26--58,50)"; - "member ToString(__) (unitVar1) = String.Concat (base.ToString(),let x: Microsoft.FSharp.Core.int = 999 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ...) @ (59,29--59,57)"; + "member ToString(__) (unitVar1) = String.Concat (base.ToString(),let value: Microsoft.FSharp.Core.int = 999 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (value) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ...) @ (59,29--59,57)"; "member TestCallinToString(this) (unitVar1) = this.ToString() @ (60,39--60,54)"; "type Error"; "let err = {Data0 = 3; Data1 = 4} @ (64,10--64,20)"; "let matchOnException(err) = match (if err :? M.Error then $0 else $1) targets ... @ (66,33--66,36)"; @@ -719,14 +719,14 @@ let ``Test Optimized Declarations Project1`` () = "let v = M.c ().get_InstanceProperty(()) @ (98,8--98,26)"; "do Console.WriteLine (\"777\")"; "let functionWithSubmsumption(x) = IntrinsicFunctions.UnboxGeneric (x) @ (102,40--102,52)"; - "let functionWithCoercion(x) = let x: Microsoft.FSharp.Core.string = let x: Microsoft.FSharp.Core.string = IntrinsicFunctions.UnboxGeneric (x :> Microsoft.FSharp.Core.obj) in M.functionWithSubmsumption (x :> Microsoft.FSharp.Core.obj) in M.functionWithSubmsumption (x :> Microsoft.FSharp.Core.obj) @ (103,39--103,116)"; + "let functionWithCoercion(x) = let arg: Microsoft.FSharp.Core.string = let arg: Microsoft.FSharp.Core.string = IntrinsicFunctions.UnboxGeneric (x :> Microsoft.FSharp.Core.obj) in M.functionWithSubmsumption (arg :> Microsoft.FSharp.Core.obj) in M.functionWithSubmsumption (arg :> Microsoft.FSharp.Core.obj) @ (103,39--103,116)"; "type MultiArgMethods"; "member .ctor(c,d) = (new Object(); ()) @ (105,5--105,20)"; "member Method(x) (a,b) = 1 @ (106,37--106,38)"; "member CurriedMethod(x) (a1,b1) (a2,b2) = 1 @ (107,63--107,64)"; "let testFunctionThatCallsMultiArgMethods(unitVar0) = let m: M.MultiArgMethods = new MultiArgMethods(3,4) in Operators.op_Addition (m.Method(7,8),let arg00: Microsoft.FSharp.Core.int = 9 in let arg01: Microsoft.FSharp.Core.int = 10 in let arg10: Microsoft.FSharp.Core.int = 11 in let arg11: Microsoft.FSharp.Core.int = 12 in m.CurriedMethod(arg00,arg01,arg10,arg11)) @ (110,8--110,9)"; - "let functionThatUsesObjectExpression(unitVar0) = { new Object() with member x.ToString(unitVar1) = let x: Microsoft.FSharp.Core.int = 888 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... } @ (114,3--114,55)"; - "let functionThatUsesObjectExpressionWithInterfaceImpl(unitVar0) = { new Object() with member x.ToString(unitVar1) = let x: Microsoft.FSharp.Core.int = 888 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... interface System.IComparable with member x.CompareTo(y) = 0 } :> System.IComparable @ (117,3--120,38)"; + "let functionThatUsesObjectExpression(unitVar0) = { new Object() with member x.ToString(unitVar1) = let value: Microsoft.FSharp.Core.int = 888 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (value) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... } @ (114,3--114,55)"; + "let functionThatUsesObjectExpressionWithInterfaceImpl(unitVar0) = { new Object() with member x.ToString(unitVar1) = let value: Microsoft.FSharp.Core.int = 888 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (value) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... interface System.IComparable with member x.CompareTo(y) = 0 } :> System.IComparable @ (117,3--120,38)"; "let testFunctionThatUsesUnitsOfMeasure(x) (y) = Operators.op_Addition,Microsoft.FSharp.Core.float<'u>,Microsoft.FSharp.Core.float<'u>> (x,y) @ (122,70--122,75)"; "let testFunctionThatUsesAddressesAndByrefs(x) = let mutable w: Microsoft.FSharp.Core.int = 4 in let y1: Microsoft.FSharp.Core.byref = x in let y2: Microsoft.FSharp.Core.byref = &w in let arr: Microsoft.FSharp.Core.int Microsoft.FSharp.Core.[] = [|3; 4|] in let r: Microsoft.FSharp.Core.int Microsoft.FSharp.Core.ref = Operators.Ref (3) in let y3: Microsoft.FSharp.Core.byref = [I_ldelema (NormalAddress,false,ILArrayShapeFIX,TypeVar 0us)](arr,0) in let y4: Microsoft.FSharp.Core.byref = &r.contents in let z: Microsoft.FSharp.Core.int = Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (x,y1),y2),y3) in (w <- 3; (x <- 4; (y2 <- 4; (y3 <- 5; Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (z,x),y1),y2),y3),y4),IntrinsicFunctions.GetArray (arr,0)),r.contents))))) @ (125,16--125,17)"; "let testFunctionThatUsesStructs1(dt) = dt.AddDays(3) @ (139,57--139,72)"; From f05169eedf2d462655802a55d186ed4ef23d9626 Mon Sep 17 00:00:00 2001 From: ncave <777696+ncave@users.noreply.github.com> Date: Wed, 24 Jan 2018 11:01:51 -0800 Subject: [PATCH 10/21] test condition update --- tests/service/ExprTests.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/service/ExprTests.fs b/tests/service/ExprTests.fs index 5ba37718b0e..a8d01801ebe 100644 --- a/tests/service/ExprTests.fs +++ b/tests/service/ExprTests.fs @@ -528,7 +528,7 @@ let bool2 = false let options = checker.GetProjectOptionsFromCommandLineArgs (projFileName, args) //<@ let x = Some(3) in x.IsSome @> -#if !NO_EXTENSIONTYPING || DOTNETCORE +#if !NO_EXTENSIONTYPING [] let ``Test Declarations project1`` () = let wholeProjectResults = exprChecker.ParseAndCheckProject(Project1.options) |> Async.RunSynchronously From 7eea76646ad113cf3032089e511937f7e6123986 Mon Sep 17 00:00:00 2001 From: ncave <777696+ncave@users.noreply.github.com> Date: Fri, 26 Jan 2018 09:35:07 -0800 Subject: [PATCH 11/21] test update --- tests/service/ExprTests.fs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/service/ExprTests.fs b/tests/service/ExprTests.fs index a8d01801ebe..879d9d71ee8 100644 --- a/tests/service/ExprTests.fs +++ b/tests/service/ExprTests.fs @@ -528,7 +528,7 @@ let bool2 = false let options = checker.GetProjectOptionsFromCommandLineArgs (projFileName, args) //<@ let x = Some(3) in x.IsSome @> -#if !NO_EXTENSIONTYPING +// #if !NO_EXTENSIONTYPING [] let ``Test Declarations project1`` () = let wholeProjectResults = exprChecker.ParseAndCheckProject(Project1.options) |> Async.RunSynchronously @@ -699,7 +699,11 @@ let ``Test Optimized Declarations Project1`` () = "member M2(__) (unitVar1) = __.compiledAsInstanceMethod(()) @ (56,21--56,47)"; "member SM1(unitVar0) = Operators.op_Addition (compiledAsStaticField,ClassWithImplicitConstructor.compiledAsGenericStaticMethod (compiledAsStaticField)) @ (57,26--57,101)"; "member SM2(unitVar0) = ClassWithImplicitConstructor.compiledAsStaticMethod (()) @ (58,26--58,50)"; +#if NO_PROJECTCRACKER // proxy for COMPILER "member ToString(__) (unitVar1) = String.Concat (base.ToString(),let value: Microsoft.FSharp.Core.int = 999 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (value) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ...) @ (59,29--59,57)"; +#else + "member ToString(__) (unitVar1) = String.Concat (base.ToString(),let x: Microsoft.FSharp.Core.int = 999 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ...) @ (59,29--59,57)"; +#endif "member TestCallinToString(this) (unitVar1) = this.ToString() @ (60,39--60,54)"; "type Error"; "let err = {Data0 = 3; Data1 = 4} @ (64,10--64,20)"; "let matchOnException(err) = match (if err :? M.Error then $0 else $1) targets ... @ (66,33--66,36)"; @@ -719,14 +723,23 @@ let ``Test Optimized Declarations Project1`` () = "let v = M.c ().get_InstanceProperty(()) @ (98,8--98,26)"; "do Console.WriteLine (\"777\")"; "let functionWithSubmsumption(x) = IntrinsicFunctions.UnboxGeneric (x) @ (102,40--102,52)"; +#if NO_PROJECTCRACKER // proxy for COMPILER "let functionWithCoercion(x) = let arg: Microsoft.FSharp.Core.string = let arg: Microsoft.FSharp.Core.string = IntrinsicFunctions.UnboxGeneric (x :> Microsoft.FSharp.Core.obj) in M.functionWithSubmsumption (arg :> Microsoft.FSharp.Core.obj) in M.functionWithSubmsumption (arg :> Microsoft.FSharp.Core.obj) @ (103,39--103,116)"; +#else + "let functionWithCoercion(x) = let x: Microsoft.FSharp.Core.string = let x: Microsoft.FSharp.Core.string = IntrinsicFunctions.UnboxGeneric (x :> Microsoft.FSharp.Core.obj) in M.functionWithSubmsumption (x :> Microsoft.FSharp.Core.obj) in M.functionWithSubmsumption (x :> Microsoft.FSharp.Core.obj) @ (103,39--103,116)"; +#endif "type MultiArgMethods"; "member .ctor(c,d) = (new Object(); ()) @ (105,5--105,20)"; "member Method(x) (a,b) = 1 @ (106,37--106,38)"; "member CurriedMethod(x) (a1,b1) (a2,b2) = 1 @ (107,63--107,64)"; "let testFunctionThatCallsMultiArgMethods(unitVar0) = let m: M.MultiArgMethods = new MultiArgMethods(3,4) in Operators.op_Addition (m.Method(7,8),let arg00: Microsoft.FSharp.Core.int = 9 in let arg01: Microsoft.FSharp.Core.int = 10 in let arg10: Microsoft.FSharp.Core.int = 11 in let arg11: Microsoft.FSharp.Core.int = 12 in m.CurriedMethod(arg00,arg01,arg10,arg11)) @ (110,8--110,9)"; +#if NO_PROJECTCRACKER // proxy for COMPILER "let functionThatUsesObjectExpression(unitVar0) = { new Object() with member x.ToString(unitVar1) = let value: Microsoft.FSharp.Core.int = 888 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (value) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... } @ (114,3--114,55)"; "let functionThatUsesObjectExpressionWithInterfaceImpl(unitVar0) = { new Object() with member x.ToString(unitVar1) = let value: Microsoft.FSharp.Core.int = 888 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (value) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... interface System.IComparable with member x.CompareTo(y) = 0 } :> System.IComparable @ (117,3--120,38)"; +#else + "let functionThatUsesObjectExpression(unitVar0) = { new Object() with member x.ToString(unitVar1) = let x: Microsoft.FSharp.Core.int = 888 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... } @ (114,3--114,55)"; + "let functionThatUsesObjectExpressionWithInterfaceImpl(unitVar0) = { new Object() with member x.ToString(unitVar1) = let x: Microsoft.FSharp.Core.int = 888 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... interface System.IComparable with member x.CompareTo(y) = 0 } :> System.IComparable @ (117,3--120,38)"; +#endif "let testFunctionThatUsesUnitsOfMeasure(x) (y) = Operators.op_Addition,Microsoft.FSharp.Core.float<'u>,Microsoft.FSharp.Core.float<'u>> (x,y) @ (122,70--122,75)"; "let testFunctionThatUsesAddressesAndByrefs(x) = let mutable w: Microsoft.FSharp.Core.int = 4 in let y1: Microsoft.FSharp.Core.byref = x in let y2: Microsoft.FSharp.Core.byref = &w in let arr: Microsoft.FSharp.Core.int Microsoft.FSharp.Core.[] = [|3; 4|] in let r: Microsoft.FSharp.Core.int Microsoft.FSharp.Core.ref = Operators.Ref (3) in let y3: Microsoft.FSharp.Core.byref = [I_ldelema (NormalAddress,false,ILArrayShapeFIX,TypeVar 0us)](arr,0) in let y4: Microsoft.FSharp.Core.byref = &r.contents in let z: Microsoft.FSharp.Core.int = Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (x,y1),y2),y3) in (w <- 3; (x <- 4; (y2 <- 4; (y3 <- 5; Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (z,x),y1),y2),y3),y4),IntrinsicFunctions.GetArray (arr,0)),r.contents))))) @ (125,16--125,17)"; "let testFunctionThatUsesStructs1(dt) = dt.AddDays(3) @ (139,57--139,72)"; @@ -769,7 +782,7 @@ let ``Test Optimized Declarations Project1`` () = |> shouldEqual (filterHack expected) () -#endif +// #endif //--------------------------------------------------------------------------------------------------------- // This big list expression was causing us trouble From c6cb6fe281be990f6ea0253a059aca8d3b233732 Mon Sep 17 00:00:00 2001 From: ncave <777696+ncave@users.noreply.github.com> Date: Sat, 27 Jan 2018 23:24:40 -0800 Subject: [PATCH 12/21] review update --- src/fsharp/service/service.fs | 4 ++-- tests/service/ExprTests.fs | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/fsharp/service/service.fs b/src/fsharp/service/service.fs index 29c1f088ae2..1eff5163429 100644 --- a/src/fsharp/service/service.fs +++ b/src/fsharp/service/service.fs @@ -1799,12 +1799,12 @@ type FSharpCheckProjectResults(projectFileName:string, tcConfigOption, keepAssem let getDetails() = match details with - | None -> invalidOp ("The project has no results due to critical errors in the project options. Check the HasCriticalErrors before accessing the detaild results. Errors: " + String.concat "\n" [ for e in errors -> e.Message ]) + | None -> invalidOp ("The project has no results due to critical errors in the project options. Check the HasCriticalErrors before accessing the detailed results. Errors: " + String.concat "\n" [ for e in errors -> e.Message ]) | Some d -> d let getTcConfig() = match tcConfigOption with - | None -> invalidOp ("The project has no results due to critical errors in the project options. Check the HasCriticalErrors before accessing the detaild results. Errors: " + String.concat "\n" [ for e in errors -> e.Message ]) + | None -> invalidOp ("The project has no results due to critical errors in the project options. Check the HasCriticalErrors before accessing the detailed results. Errors: " + String.concat "\n" [ for e in errors -> e.Message ]) | Some d -> d member info.Errors = errors diff --git a/tests/service/ExprTests.fs b/tests/service/ExprTests.fs index 879d9d71ee8..23c6dfc2fec 100644 --- a/tests/service/ExprTests.fs +++ b/tests/service/ExprTests.fs @@ -528,7 +528,6 @@ let bool2 = false let options = checker.GetProjectOptionsFromCommandLineArgs (projFileName, args) //<@ let x = Some(3) in x.IsSome @> -// #if !NO_EXTENSIONTYPING [] let ``Test Declarations project1`` () = let wholeProjectResults = exprChecker.ParseAndCheckProject(Project1.options) |> Async.RunSynchronously @@ -782,7 +781,7 @@ let ``Test Optimized Declarations Project1`` () = |> shouldEqual (filterHack expected) () -// #endif + //--------------------------------------------------------------------------------------------------------- // This big list expression was causing us trouble From 6845981fb1b123c8f1c335162de2fc3086ccf6bd Mon Sep 17 00:00:00 2001 From: ncave <777696+ncave@users.noreply.github.com> Date: Wed, 31 Jan 2018 07:11:32 -0800 Subject: [PATCH 13/21] added checked operators --- src/fsharp/TastOps.fs | 17 ++++ src/fsharp/TastOps.fsi | 17 ++++ src/fsharp/TcGlobals.fs | 34 ++++++++ src/fsharp/symbols/Exprs.fs | 35 +++++--- tests/service/ExprTests.fs | 162 +++++++++++++++++++++++++++++++++++- 5 files changed, 254 insertions(+), 11 deletions(-) diff --git a/src/fsharp/TastOps.fs b/src/fsharp/TastOps.fs index e34f9ea13ee..6f92367f0f2 100644 --- a/src/fsharp/TastOps.fs +++ b/src/fsharp/TastOps.fs @@ -6139,6 +6139,23 @@ let mkCallShiftRightOperator (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIn let mkCallUnaryNegOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.unchecked_unary_minus_info, [[ty]], [e1], m) let mkCallUnaryNotOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.bitwise_unary_not_info, [[ty]], [e1], m) +let mkCallAdditionChecked (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.checked_addition_info, [[ty; ty; ty]], [e1;e2], m) +let mkCallSubtractionChecked (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.checked_subtraction_info, [[ty; ty; ty]], [e1;e2], m) +let mkCallMultiplyChecked (g:TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.checked_multiply_info, [[ty; ty; ty]], [e1;e2], m) +let mkCallUnaryNegChecked (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.checked_unary_minus_info, [[ty]], [e1], m) + +let mkCallToByteChecked (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.byte_checked_info, [[ty]], [e1], m) +let mkCallToSByteChecked (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.sbyte_checked_info, [[ty]], [e1], m) +let mkCallToInt16Checked (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.int16_checked_info, [[ty]], [e1], m) +let mkCallToUInt16Checked (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.uint16_checked_info, [[ty]], [e1], m) +let mkCallToIntChecked (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.int_checked_info, [[ty]], [e1], m) +let mkCallToInt32Checked (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.int32_checked_info, [[ty]], [e1], m) +let mkCallToUInt32Checked (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.uint32_checked_info, [[ty]], [e1], m) +let mkCallToInt64Checked (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.int64_checked_info, [[ty]], [e1], m) +let mkCallToUInt64Checked (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.uint64_checked_info, [[ty]], [e1], m) +let mkCallToIntPtrChecked (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.nativeint_checked_info, [[ty]], [e1], m) +let mkCallToUIntPtrChecked (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.unativeint_checked_info, [[ty]], [e1], m) + let mkCallToByteOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.byte_operator_info, [[ty]], [e1], m) let mkCallToSByteOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.sbyte_operator_info, [[ty]], [e1], m) let mkCallToInt16Operator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.int16_operator_info, [[ty]], [e1], m) diff --git a/src/fsharp/TastOps.fsi b/src/fsharp/TastOps.fsi index 1366bcea8ba..94624a804f5 100755 --- a/src/fsharp/TastOps.fsi +++ b/src/fsharp/TastOps.fsi @@ -1237,6 +1237,23 @@ val mkCallShiftRightOperator : TcGlobals -> range -> TType -> Ex val mkCallUnaryNegOperator : TcGlobals -> range -> TType -> Expr -> Expr val mkCallUnaryNotOperator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallAdditionChecked : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallSubtractionChecked : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallMultiplyChecked : TcGlobals -> range -> TType -> Expr -> Expr -> Expr +val mkCallUnaryNegChecked : TcGlobals -> range -> TType -> Expr -> Expr + +val mkCallToByteChecked : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToSByteChecked : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToInt16Checked : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToUInt16Checked : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToIntChecked : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToInt32Checked : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToUInt32Checked : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToInt64Checked : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToUInt64Checked : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToIntPtrChecked : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToUIntPtrChecked : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToByteOperator : TcGlobals -> range -> TType -> Expr -> Expr val mkCallToSByteOperator : TcGlobals -> range -> TType -> Expr -> Expr val mkCallToInt16Operator : TcGlobals -> range -> TType -> Expr -> Expr diff --git a/src/fsharp/TcGlobals.fs b/src/fsharp/TcGlobals.fs index 1f6cecc6b05..032f4b5311e 100755 --- a/src/fsharp/TcGlobals.fs +++ b/src/fsharp/TcGlobals.fs @@ -573,6 +573,23 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d let v_unchecked_unary_minus_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "op_UnaryNegation" , None , None , [vara], mk_unop_ty varaTy) let v_unchecked_unary_not_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "not" , None , Some "Not" , [], mk_unop_ty v_bool_ty) + let v_checked_addition_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "op_Addition" , None , None , [vara;varb;varc], mk_binop_ty3 varaTy varbTy varcTy) + let v_checked_subtraction_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "op_Subtraction" , None , None , [vara;varb;varc], mk_binop_ty3 varaTy varbTy varcTy) + let v_checked_multiply_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "op_Multiply" , None , None , [vara;varb;varc], mk_binop_ty3 varaTy varbTy varcTy) + let v_checked_unary_minus_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "op_UnaryNegation" , None , None , [vara], mk_unop_ty varaTy) + + let v_byte_checked_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "byte" , None , Some "ToByte", [vara], ([[varaTy]], v_byte_ty)) + let v_sbyte_checked_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "sbyte" , None , Some "ToSByte", [vara], ([[varaTy]], v_sbyte_ty)) + let v_int16_checked_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "int16" , None , Some "ToInt16", [vara], ([[varaTy]], v_int16_ty)) + let v_uint16_checked_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "uint16" , None , Some "ToUInt16", [vara], ([[varaTy]], v_uint16_ty)) + let v_int_checked_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "int" , None , Some "ToInt", [vara], ([[varaTy]], v_int_ty)) + let v_int32_checked_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "int32" , None , Some "ToInt32", [vara], ([[varaTy]], v_int32_ty)) + let v_uint32_checked_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "uint32" , None , Some "ToUInt32", [vara], ([[varaTy]], v_uint32_ty)) + let v_int64_checked_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "int64" , None , Some "ToInt64", [vara], ([[varaTy]], v_int64_ty)) + let v_uint64_checked_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "uint64" , None , Some "ToUInt64", [vara], ([[varaTy]], v_uint64_ty)) + let v_nativeint_checked_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "nativeint" , None , Some "ToIntPtr", [vara], ([[varaTy]], v_nativeint_ty)) + let v_unativeint_checked_info = makeIntrinsicValRef(fslib_MFOperatorsChecked_nleref, "unativeint" , None , Some "ToUIntPtr", [vara], ([[varaTy]], v_unativeint_ty)) + let v_byte_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "byte" , None , Some "ToByte", [vara], ([[varaTy]], v_byte_ty)) let v_sbyte_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "sbyte" , None , Some "ToSByte", [vara], ([[varaTy]], v_sbyte_ty)) let v_int16_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "int16" , None , Some "ToInt16", [vara], ([[varaTy]], v_int16_ty)) @@ -1145,6 +1162,23 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member __.unchecked_unary_minus_info = v_unchecked_unary_minus_info member __.unchecked_unary_not_info = v_unchecked_unary_not_info + member __.checked_addition_info = v_checked_addition_info + member __.checked_subtraction_info = v_checked_subtraction_info + member __.checked_multiply_info = v_checked_multiply_info + member __.checked_unary_minus_info = v_checked_unary_minus_info + + member __.byte_checked_info = v_byte_checked_info + member __.sbyte_checked_info = v_sbyte_checked_info + member __.int16_checked_info = v_int16_checked_info + member __.uint16_checked_info = v_uint16_checked_info + member __.int_checked_info = v_int_checked_info + member __.int32_checked_info = v_int32_checked_info + member __.uint32_checked_info = v_uint32_checked_info + member __.int64_checked_info = v_int64_checked_info + member __.uint64_checked_info = v_uint64_checked_info + member __.nativeint_checked_info = v_nativeint_checked_info + member __.unativeint_checked_info = v_unativeint_checked_info + member __.byte_operator_info = v_byte_operator_info member __.sbyte_operator_info = v_sbyte_operator_info member __.int16_operator_info = v_int16_operator_info diff --git a/src/fsharp/symbols/Exprs.fs b/src/fsharp/symbols/Exprs.fs index db57fbfaa61..1e5de9e5f47 100644 --- a/src/fsharp/symbols/Exprs.fs +++ b/src/fsharp/symbols/Exprs.fs @@ -205,15 +205,15 @@ module FSharpExprConvert = let (|ILBinaryOp|_|) e = match e with - | AI_add + | AI_add -> Some mkCallAdditionOperator | AI_add_ovf - | AI_add_ovf_un -> Some mkCallAdditionOperator - | AI_sub + | AI_add_ovf_un -> Some mkCallAdditionChecked + | AI_sub -> Some mkCallSubtractionOperator | AI_sub_ovf - | AI_sub_ovf_un -> Some mkCallSubtractionOperator - | AI_mul + | AI_sub_ovf_un -> Some mkCallSubtractionChecked + | AI_mul -> Some mkCallMultiplyOperator | AI_mul_ovf - | AI_mul_ovf_un -> Some mkCallMultiplyOperator + | AI_mul_ovf_un -> Some mkCallMultiplyChecked | AI_div | AI_div_un -> Some mkCallDivisionOperator | AI_rem @@ -233,9 +233,7 @@ module FSharpExprConvert = let (|ILConvertOp|_|) e = match e with - | AI_conv basicTy - | AI_conv_ovf basicTy - | AI_conv_ovf_un basicTy -> + | AI_conv basicTy -> match basicTy with | DT_R -> Some mkCallToDoubleOperator | DT_I1 -> Some mkCallToSByteOperator @@ -243,7 +241,7 @@ module FSharpExprConvert = | DT_I2 -> Some mkCallToInt16Operator | DT_U2 -> Some mkCallToUInt16Operator | DT_I4 -> Some mkCallToInt32Operator - | DT_U4 -> Some mkCallToUInt32Operator + | DT_U4 -> Some mkCallToUInt32Operator | DT_I8 -> Some mkCallToInt64Operator | DT_U8 -> Some mkCallToUInt64Operator | DT_R4 -> Some mkCallToSingleOperator @@ -251,6 +249,23 @@ module FSharpExprConvert = | DT_I -> Some mkCallToIntPtrOperator | DT_U -> Some mkCallToUIntPtrOperator | DT_REF -> None + | AI_conv_ovf basicTy + | AI_conv_ovf_un basicTy -> + match basicTy with + | DT_R -> Some mkCallToDoubleOperator + | DT_I1 -> Some mkCallToSByteChecked + | DT_U1 -> Some mkCallToByteChecked + | DT_I2 -> Some mkCallToInt16Checked + | DT_U2 -> Some mkCallToUInt16Checked + | DT_I4 -> Some mkCallToInt32Checked + | DT_U4 -> Some mkCallToUInt32Checked + | DT_I8 -> Some mkCallToInt64Checked + | DT_U8 -> Some mkCallToUInt64Checked + | DT_R4 -> Some mkCallToSingleOperator + | DT_R8 -> Some mkCallToDoubleOperator + | DT_I -> Some mkCallToIntPtrChecked + | DT_U -> Some mkCallToUIntPtrChecked + | DT_REF -> None | _ -> None let ConvType cenv typ = FSharpType(cenv, typ) diff --git a/tests/service/ExprTests.fs b/tests/service/ExprTests.fs index 23c6dfc2fec..9d211221601 100644 --- a/tests/service/ExprTests.fs +++ b/tests/service/ExprTests.fs @@ -517,9 +517,61 @@ module N type IntAbbrev = int - let bool2 = false +let testEqualsOperator e1 e2 = (=) e1 e2 +let testNotEqualsOperator e1 e2 = (<>) e1 e2 +let testLessThanOperator e1 e2 = (<) e1 e2 +let testLessThanOrEqualsOperator e1 e2 = (<=) e1 e2 +let testGreaterThanOperator e1 e2 = (>) e1 e2 +let testGreaterThanOrEqualsOperator e1 e2 = (>=) e1 e2 + +let testAdditionOperator e1 e2 = (+) e1 e2 +let testSubtractionOperator e1 e2 = (-) e1 e2 +let testMultiplyOperator e1 e2 = (*) e1 e2 +let testDivisionOperator e1 e2 = (/) e1 e2 +let testModulusOperator e1 e2 = (%) e1 e2 +let testBitwiseAndOperator e1 e2 = (&&&) e1 e2 +let testBitwiseOrOperator e1 e2 = (|||) e1 e2 +let testBitwiseXorOperator e1 e2 = (^^^) e1 e2 +let testShiftLeftOperator e1 e2 = (<<<) e1 e2 +let testShiftRightOperator e1 e2 = (>>>) e1 e2 + +let testUnaryNegOperator e1 = (~-) e1 +let testUnaryNotOperator e1 = not e1 + +let testAdditionChecked e1 e2 = Checked.(+) e1 e2 +let testSubtractionChecked e1 e2 = Checked.(-) e1 e2 +let testMultiplyChecked e1 e2 = Checked.(*) e1 e2 +let testUnaryNegChecked e1 = Checked.(~-) e1 + +let testToByteChecked e1 = Checked.byte e1 +let testToSByteChecked e1 = Checked.sbyte e1 +let testToInt16Checked e1 = Checked.int16 e1 +let testToUInt16Checked e1 = Checked.uint16 e1 +let testToIntChecked e1 = Checked.int e1 +let testToInt32Checked e1 = Checked.int32 e1 +let testToUInt32Checked e1 = Checked.uint32 e1 +let testToInt64Checked e1 = Checked.int64 e1 +let testToUInt64Checked e1 = Checked.uint64 e1 +let testToIntPtrChecked e1 = Checked.nativeint e1 +let testToUIntPtrChecked e1 = Checked.unativeint e1 + +let testToByteOperator e1 = byte e1 +let testToSByteOperator e1 = sbyte e1 +let testToInt16Operator e1 = int16 e1 +let testToUInt16Operator e1 = uint16 e1 +let testToIntOperator e1 = int e1 +// let testToEnumOperator e1 = enum e1 +let testToInt32Operator e1 = int32 e1 +let testToUInt32Operator e1 = uint32 e1 +let testToInt64Operator e1 = int64 e1 +let testToUInt64Operator e1 = uint64 e1 +let testToSingleOperator e1 = float32 e1 +let testToDoubleOperator e1 = float e1 +let testToIntPtrOperator e1 = nativeint e1 +let testToUIntPtrOperator e1 = unativeint e1 + """ File.WriteAllText(fileName2, fileSource2) @@ -641,11 +693,65 @@ let ``Test Declarations project1`` () = "let f = ((); fun a -> fun b -> Operators.op_Addition (a,b)) @ (246,8--247,24)"; "let letLambdaRes = Operators.op_PipeRight<(Microsoft.FSharp.Core.int * Microsoft.FSharp.Core.int) Microsoft.FSharp.Collections.list,Microsoft.FSharp.Core.int Microsoft.FSharp.Collections.list> (Cons((1,2),Empty()),let mapping: Microsoft.FSharp.Core.int * Microsoft.FSharp.Core.int -> Microsoft.FSharp.Core.int = fun tupledArg -> let a: Microsoft.FSharp.Core.int = tupledArg.Item0 in let b: Microsoft.FSharp.Core.int = tupledArg.Item1 in (LetLambda.f () a) b in fun list -> ListModule.Map (mapping,list)) @ (249,19--249,71)"] + let expected2 = + [ "type N"; "type IntAbbrev"; "let bool2 = False @ (6,12--6,17)"; + "let testEqualsOperator(e1) (e2) = Operators.op_Equality<'a> (e1,e2) @ (8,46--8,54)"; + "let testNotEqualsOperator(e1) (e2) = Operators.op_Inequality<'a> (e1,e2) @ (9,46--9,55)"; + "let testLessThanOperator(e1) (e2) = Operators.op_LessThan<'a> (e1,e2) @ (10,46--10,54)"; + "let testLessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual<'a> (e1,e2) @ (11,46--11,55)"; + "let testGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan<'a> (e1,e2) @ (12,46--12,54)"; + "let testGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual<'a> (e1,e2) @ (13,46--13,55)"; + "let testAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (15,38--15,46)"; + "let testSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (16,38--16,46)"; + "let testMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (17,37--17,46)"; + "let testDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (18,38--18,46)"; + "let testModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (19,38--19,46)"; + "let testBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (20,38--20,48)"; + "let testBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (21,38--21,48)"; + "let testBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (22,38--22,48)"; + "let testShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (23,38--23,48)"; + "let testShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (24,38--24,48)"; + "let testUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (26,33--26,39)"; + "let testUnaryNotOperator(e1) = Operators.Not (e1) @ (27,32--27,38)"; + "let testAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (29,35--29,52)"; + "let testSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (30,35--30,52)"; + "let testMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (31,35--31,52)"; + "let testUnaryNegChecked(e1) = Checked.op_UnaryNegation (e1) @ (32,32--32,47)"; + "let testToByteChecked(e1) = Checked.ToByte (e1) @ (34,31--34,46)"; + "let testToSByteChecked(e1) = Checked.ToSByte (e1) @ (35,31--35,47)"; + "let testToInt16Checked(e1) = Checked.ToInt16 (e1) @ (36,31--36,47)"; + "let testToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (37,31--37,48)"; + "let testToIntChecked(e1) = Checked.ToInt (e1) @ (38,31--38,45)"; + "let testToInt32Checked(e1) = Checked.ToInt32 (e1) @ (39,31--39,47)"; + "let testToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (40,31--40,48)"; + "let testToInt64Checked(e1) = Checked.ToInt64 (e1) @ (41,31--41,47)"; + "let testToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (42,31--42,48)"; + "let testToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (43,31--43,51)"; + "let testToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (44,31--44,52)"; + "let testToByteOperator(e1) = Operators.ToByte (e1) @ (46,31--46,38)"; + "let testToSByteOperator(e1) = Operators.ToSByte (e1) @ (47,31--47,39)"; + "let testToInt16Operator(e1) = Operators.ToInt16 (e1) @ (48,31--48,39)"; + "let testToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (49,31--49,40)"; + "let testToIntOperator(e1) = Operators.ToInt (e1) @ (50,31--50,37)"; + "let testToInt32Operator(e1) = Operators.ToInt32 (e1) @ (52,31--52,39)"; + "let testToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (53,31--53,40)"; + "let testToInt64Operator(e1) = Operators.ToInt64 (e1) @ (54,31--54,39)"; + "let testToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (55,31--55,40)"; + "let testToSingleOperator(e1) = Operators.ToSingle (e1) @ (56,31--56,41)"; + "let testToDoubleOperator(e1) = Operators.ToDouble (e1) @ (57,31--57,39)"; + "let testToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (58,31--58,43)"; + "let testToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (59,31--59,44)" ] + printDeclarations None (List.ofSeq file1.Declarations) |> Seq.toList |> filterHack |> shouldEqual (filterHack expected) + printDeclarations None (List.ofSeq file2.Declarations) + |> Seq.toList + |> filterHack + |> shouldEqual (filterHack expected2) + () @@ -775,11 +881,65 @@ let ``Test Optimized Declarations Project1`` () = "let f = fun a -> fun b -> Operators.op_Addition (a,b) @ (247,8--247,24)"; "let letLambdaRes = ListModule.Map (fun tupledArg -> let a: Microsoft.FSharp.Core.int = tupledArg.Item0 in let b: Microsoft.FSharp.Core.int = tupledArg.Item1 in (LetLambda.f () a) b,Cons((1,2),Empty())) @ (249,19--249,71)"] + let expected2 = + [ "type N"; "type IntAbbrev"; "let bool2 = False @ (6,12--6,17)"; + "let testEqualsOperator(e1) (e2) = HashCompare.GenericEqualityIntrinsic<'a> (e1,e2) @ (8,46--8,54)"; + "let testNotEqualsOperator(e1) (e2) = Operators.op_Equality (HashCompare.GenericEqualityIntrinsic<'a> (e1,e2),False) @ (9,46--9,55)"; + "let testLessThanOperator(e1) (e2) = HashCompare.GenericLessThanIntrinsic<'a> (e1,e2) @ (10,46--10,54)"; + "let testLessThanOrEqualsOperator(e1) (e2) = HashCompare.GenericLessOrEqualIntrinsic<'a> (e1,e2) @ (11,46--11,55)"; + "let testGreaterThanOperator(e1) (e2) = HashCompare.GenericGreaterThanIntrinsic<'a> (e1,e2) @ (12,46--12,54)"; + "let testGreaterThanOrEqualsOperator(e1) (e2) = HashCompare.GenericGreaterOrEqualIntrinsic<'a> (e1,e2) @ (13,46--13,55)"; + "let testAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (15,38--15,46)"; + "let testSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (16,38--16,46)"; + "let testMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (17,37--17,46)"; + "let testDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (18,38--18,46)"; + "let testModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (19,38--19,46)"; + "let testBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (20,38--20,48)"; + "let testBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (21,38--21,48)"; + "let testBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (22,38--22,48)"; + "let testShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,Operators.op_BitwiseAnd (e2,31)) @ (23,38--23,48)"; + "let testShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,Operators.op_BitwiseAnd (e2,31)) @ (24,38--24,48)"; + "let testUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (26,33--26,39)"; + "let testUnaryNotOperator(e1) = Operators.op_Equality (e1,False) @ (27,32--27,35)"; + "let testAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (29,35--29,52)"; + "let testSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (30,35--30,52)"; + "let testMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (31,35--31,52)"; + "let testUnaryNegChecked(e1) = Checked.op_Subtraction (0,e1) @ (32,32--32,47)"; + "let testToByteChecked(e1) = Checked.ToByte (e1) @ (34,31--34,46)"; + "let testToSByteChecked(e1) = Checked.ToSByte (e1) @ (35,31--35,47)"; + "let testToInt16Checked(e1) = Checked.ToInt16 (e1) @ (36,31--36,47)"; + "let testToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (37,31--37,48)"; + "let testToIntChecked(e1) = Checked.ToInt32 (e1) @ (38,31--38,45)"; + "let testToInt32Checked(e1) = Checked.ToInt32 (e1) @ (39,31--39,47)"; + "let testToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (40,31--40,48)"; + "let testToInt64Checked(e1) = Checked.ToInt64 (e1) @ (41,31--41,47)"; + "let testToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (42,31--42,48)"; + "let testToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (43,31--43,51)"; + "let testToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (44,31--44,52)"; + "let testToByteOperator(e1) = Operators.ToByte (e1) @ (46,31--46,38)"; + "let testToSByteOperator(e1) = Operators.ToSByte (e1) @ (47,31--47,39)"; + "let testToInt16Operator(e1) = Operators.ToInt16 (e1) @ (48,31--48,39)"; + "let testToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (49,31--49,40)"; + "let testToIntOperator(e1) = e1 @ (50,35--50,37)"; + "let testToInt32Operator(e1) = e1 @ (52,37--52,39)"; + "let testToUInt32Operator(e1) = e1 @ (53,31--53,40)"; + "let testToInt64Operator(e1) = Operators.ToInt64 (e1) @ (54,31--54,39)"; + "let testToUInt64Operator(e1) = Operators.ToInt64 (e1) @ (55,31--55,40)"; + "let testToSingleOperator(e1) = Operators.ToSingle (e1) @ (56,31--56,41)"; + "let testToDoubleOperator(e1) = Operators.ToDouble (e1) @ (57,31--57,39)"; + "let testToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (58,31--58,43)"; + "let testToUIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (59,31--59,44)" ] + printDeclarations None (List.ofSeq file1.Declarations) |> Seq.toList |> filterHack |> shouldEqual (filterHack expected) + printDeclarations None (List.ofSeq file2.Declarations) + |> Seq.toList + |> filterHack + |> shouldEqual (filterHack expected2) + () From e32bc0a6bdcdb67912a484f1cb9ce4bfe8b785af Mon Sep 17 00:00:00 2001 From: ncave <777696+ncave@users.noreply.github.com> Date: Wed, 31 Jan 2018 09:34:08 -0800 Subject: [PATCH 14/21] fixed dual conversions --- src/fsharp/symbols/Exprs.fs | 8 ++++-- tests/service/ExprTests.fs | 56 ++++++++++++++++++++++++++----------- 2 files changed, 45 insertions(+), 19 deletions(-) diff --git a/src/fsharp/symbols/Exprs.fs b/src/fsharp/symbols/Exprs.fs index 1e5de9e5f47..b15a0603fce 100644 --- a/src/fsharp/symbols/Exprs.fs +++ b/src/fsharp/symbols/Exprs.fs @@ -625,7 +625,6 @@ module FSharpExprConvert = | TOp.ILAsm([ AI_ldnull; AI_cgt_un ], _), _, [arg] -> let elemTy = tyOfExpr cenv.g arg - // let op = mkCallIsNotNull cenv.g m elemTy arg let nullVal = mkNull m elemTy let op = mkCallNotEqualsOperator cenv.g m elemTy arg nullVal ConvExprPrim cenv env op @@ -657,7 +656,12 @@ module FSharpExprConvert = let op = binaryOp cenv.g m ty arg1 arg2 ConvExprPrim cenv env op - | TOp.ILAsm([ ILConvertOp _ ; ILConvertOp convertOp ], _), _, [arg] + | TOp.ILAsm([ ILConvertOp convertOp1; ILConvertOp convertOp2 ], _), [ty2], [arg] -> + let ty1 = tyOfExpr cenv.g arg + let op1 = convertOp1 cenv.g m ty1 arg + let op2 = convertOp2 cenv.g m ty2 op1 + ConvExprPrim cenv env op2 + | TOp.ILAsm([ ILConvertOp convertOp ], _), _, [arg] -> let ty = tyOfExpr cenv.g arg let op = convertOp cenv.g m ty arg diff --git a/tests/service/ExprTests.fs b/tests/service/ExprTests.fs index 9d211221601..86a70e0c671 100644 --- a/tests/service/ExprTests.fs +++ b/tests/service/ExprTests.fs @@ -562,7 +562,6 @@ let testToSByteOperator e1 = sbyte e1 let testToInt16Operator e1 = int16 e1 let testToUInt16Operator e1 = uint16 e1 let testToIntOperator e1 = int e1 -// let testToEnumOperator e1 = enum e1 let testToInt32Operator e1 = int32 e1 let testToUInt32Operator e1 = uint32 e1 let testToInt64Operator e1 = int64 e1 @@ -572,6 +571,15 @@ let testToDoubleOperator e1 = float e1 let testToIntPtrOperator e1 = nativeint e1 let testToUIntPtrOperator e1 = unativeint e1 +let testHashChar (x:char) = hash x +let testHashSByte (x:sbyte) = hash x +let testHashInt16 (x:int16) = hash x +let testHashInt64 (x:int64) = hash x +let testHashUInt64 (x:uint64) = hash x +let testHashIntPtr (x:nativeint) = hash x +let testHashUIntPtr (x:unativeint) = hash x +// let testHashString (x:string) = hash x + """ File.WriteAllText(fileName2, fileSource2) @@ -733,14 +741,21 @@ let ``Test Declarations project1`` () = "let testToInt16Operator(e1) = Operators.ToInt16 (e1) @ (48,31--48,39)"; "let testToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (49,31--49,40)"; "let testToIntOperator(e1) = Operators.ToInt (e1) @ (50,31--50,37)"; - "let testToInt32Operator(e1) = Operators.ToInt32 (e1) @ (52,31--52,39)"; - "let testToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (53,31--53,40)"; - "let testToInt64Operator(e1) = Operators.ToInt64 (e1) @ (54,31--54,39)"; - "let testToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (55,31--55,40)"; - "let testToSingleOperator(e1) = Operators.ToSingle (e1) @ (56,31--56,41)"; - "let testToDoubleOperator(e1) = Operators.ToDouble (e1) @ (57,31--57,39)"; - "let testToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (58,31--58,43)"; - "let testToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (59,31--59,44)" ] + "let testToInt32Operator(e1) = Operators.ToInt32 (e1) @ (51,31--51,39)"; + "let testToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (52,31--52,40)"; + "let testToInt64Operator(e1) = Operators.ToInt64 (e1) @ (53,31--53,39)"; + "let testToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (54,31--54,40)"; + "let testToSingleOperator(e1) = Operators.ToSingle (e1) @ (55,31--55,41)"; + "let testToDoubleOperator(e1) = Operators.ToDouble (e1) @ (56,31--56,39)"; + "let testToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (57,31--57,43)"; + "let testToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (58,31--58,44)"; + "let testHashChar(x) = Operators.Hash (x) @ (60,28--60,34)"; + "let testHashSByte(x) = Operators.Hash (x) @ (61,30--61,36)"; + "let testHashInt16(x) = Operators.Hash (x) @ (62,30--62,36)"; + "let testHashInt64(x) = Operators.Hash (x) @ (63,30--63,36)"; + "let testHashUInt64(x) = Operators.Hash (x) @ (64,32--64,38)"; + "let testHashIntPtr(x) = Operators.Hash (x) @ (65,35--65,41)"; + "let testHashUIntPtr(x) = Operators.Hash (x) @ (66,37--66,43)" ] printDeclarations None (List.ofSeq file1.Declarations) |> Seq.toList @@ -921,14 +936,21 @@ let ``Test Optimized Declarations Project1`` () = "let testToInt16Operator(e1) = Operators.ToInt16 (e1) @ (48,31--48,39)"; "let testToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (49,31--49,40)"; "let testToIntOperator(e1) = e1 @ (50,35--50,37)"; - "let testToInt32Operator(e1) = e1 @ (52,37--52,39)"; - "let testToUInt32Operator(e1) = e1 @ (53,31--53,40)"; - "let testToInt64Operator(e1) = Operators.ToInt64 (e1) @ (54,31--54,39)"; - "let testToUInt64Operator(e1) = Operators.ToInt64 (e1) @ (55,31--55,40)"; - "let testToSingleOperator(e1) = Operators.ToSingle (e1) @ (56,31--56,41)"; - "let testToDoubleOperator(e1) = Operators.ToDouble (e1) @ (57,31--57,39)"; - "let testToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (58,31--58,43)"; - "let testToUIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (59,31--59,44)" ] + "let testToInt32Operator(e1) = e1 @ (51,37--51,39)"; + "let testToUInt32Operator(e1) = e1 @ (52,31--52,40)"; + "let testToInt64Operator(e1) = Operators.ToInt64 (e1) @ (53,31--53,39)"; + "let testToUInt64Operator(e1) = Operators.ToInt64 (e1) @ (54,31--54,40)"; + "let testToSingleOperator(e1) = Operators.ToSingle (e1) @ (55,31--55,41)"; + "let testToDoubleOperator(e1) = Operators.ToDouble (e1) @ (56,31--56,39)"; + "let testToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (57,31--57,43)"; + "let testToUIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (58,31--58,44)"; + "let testHashChar(x) = Operators.op_BitwiseOr (Operators.op_LeftShift (x,16),x) @ (60,28--60,34)"; + "let testHashSByte(x) = Operators.op_ExclusiveOr (Operators.op_LeftShift (x,8),x) @ (61,30--61,36)"; + "let testHashInt16(x) = Operators.op_BitwiseOr (Operators.ToUInt16 (x),Operators.op_LeftShift (x,16)) @ (62,30--62,36)"; + "let testHashInt64(x) = Operators.op_ExclusiveOr (Operators.ToInt32 (x),Operators.ToInt32 (Operators.op_RightShift (x,32))) @ (63,30--63,36)"; + "let testHashUInt64(x) = Operators.op_ExclusiveOr (Operators.ToInt32 (x),Operators.ToInt32 (Operators.op_RightShift (x,32))) @ (64,32--64,38)"; + "let testHashIntPtr(x) = Operators.ToInt32 (Operators.ToUInt64 (x)) @ (65,35--65,41)"; + "let testHashUIntPtr(x) = Operators.op_BitwiseAnd (Operators.ToInt32 (Operators.ToUInt64 (x)),2147483647) @ (66,37--66,43)"] printDeclarations None (List.ofSeq file1.Declarations) |> Seq.toList From de84cfd328aaebd2cfaa4ccc6a66c197fa9f14c6 Mon Sep 17 00:00:00 2001 From: ncave <777696+ncave@users.noreply.github.com> Date: Thu, 1 Feb 2018 19:28:52 -0800 Subject: [PATCH 15/21] review fixes --- src/fsharp/TastOps.fs | 1 + src/fsharp/TastOps.fsi | 1 + src/fsharp/TcGlobals.fs | 6 +- src/fsharp/symbols/Exprs.fs | 15 +++- tests/service/ExprTests.fs | 154 ++++++++++++++++++++++-------------- 5 files changed, 114 insertions(+), 63 deletions(-) diff --git a/src/fsharp/TastOps.fs b/src/fsharp/TastOps.fs index 6f92367f0f2..f8140121c85 100644 --- a/src/fsharp/TastOps.fs +++ b/src/fsharp/TastOps.fs @@ -6181,6 +6181,7 @@ let mkCallArray2DSet (g:TcGlobals) m ty e1 idx1 idx2 v = mkApps g (typed let mkCallArray3DSet (g:TcGlobals) m ty e1 idx1 idx2 idx3 v = mkApps g (typedExprForIntrinsic g m g.array3D_set_info, [[ty]], [ e1 ; idx1; idx2; idx3; v ], m) let mkCallArray4DSet (g:TcGlobals) m ty e1 idx1 idx2 idx3 idx4 v = mkApps g (typedExprForIntrinsic g m g.array4D_set_info, [[ty]], [ e1 ; idx1; idx2; idx3; idx4; v ], m) +let mkCallHash (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.hash_info, [[ty]], [ e1 ], m) let mkCallBox (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.box_info, [[ty]], [ e1 ], m) let mkCallIsNull (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.isnull_info, [[ty]], [ e1 ], m) let mkCallIsNotNull (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.isnotnull_info, [[ty]], [ e1 ], m) diff --git a/src/fsharp/TastOps.fsi b/src/fsharp/TastOps.fsi index 94624a804f5..fb1822f362c 100755 --- a/src/fsharp/TastOps.fsi +++ b/src/fsharp/TastOps.fsi @@ -1206,6 +1206,7 @@ val mkCallArray2DSet : TcGlobals -> range -> TType -> Expr -> Expr -> Ex val mkCallArray3DSet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr val mkCallArray4DSet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr +val mkCallHash : TcGlobals -> range -> TType -> Expr -> Expr val mkCallBox : TcGlobals -> range -> TType -> Expr -> Expr val mkCallIsNull : TcGlobals -> range -> TType -> Expr -> Expr val mkCallIsNotNull : TcGlobals -> range -> TType -> Expr -> Expr diff --git a/src/fsharp/TcGlobals.fs b/src/fsharp/TcGlobals.fs index 032f4b5311e..210dc16f2cd 100755 --- a/src/fsharp/TcGlobals.fs +++ b/src/fsharp/TcGlobals.fs @@ -511,7 +511,7 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d let v_greater_than_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, CompileOpName ">" , None , None , [vara], mk_rel_sig varaTy) let v_greater_than_or_equals_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, CompileOpName ">=" , None , None , [vara], mk_rel_sig varaTy) - let v_enumOfValue_info = makeIntrinsicValRef(fslib_MFLanguagePrimitives_nleref, "EnumOfValue" , None , None , [vara; varb], ([[varaTy]], varbTy)) + let v_enumOfValue_info = makeIntrinsicValRef(fslib_MFLanguagePrimitives_nleref, "EnumOfValue" , None , None , [vara; varb], ([[varaTy]], varbTy)) let v_generic_comparison_withc_outer_info = makeIntrinsicValRef(fslib_MFLanguagePrimitives_nleref, "GenericComparisonWithComparer" , None , None , [vara], mk_compare_withc_sig varaTy) let v_generic_hash_withc_tuple2_info = makeIntrinsicValRef(fslib_MFHashCompare_nleref, "FastHashTuple2" , None , None , [vara;varb], mk_hash_withc_sig (decodeTupleTy tupInfoRef [varaTy; varbTy])) @@ -605,6 +605,7 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d let v_nativeint_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "nativeint" , None , Some "ToIntPtr", [vara], ([[varaTy]], v_nativeint_ty)) let v_unativeint_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "unativeint" , None , Some "ToUIntPtr", [vara], ([[varaTy]], v_unativeint_ty)) + let v_hash_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "hash" , None , Some "Hash" , [vara], ([[varaTy]], v_int_ty)) let v_box_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "box" , None , Some "Box" , [vara], ([[varaTy]], v_obj_ty)) let v_isnull_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "isNull" , None , Some "IsNull" , [vara], ([[varaTy]], v_bool_ty)) let v_isnotnull_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "isNotNull" , None , Some "IsNotNull" , [vara], ([[varaTy]], v_bool_ty)) @@ -665,7 +666,7 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d let v_cast_quotation_info = makeIntrinsicValRef(fslib_MFQuotations_nleref, "Cast" , Some "Expr" , None , [vara], ([[mkRawQuotedExprTy]], mkQuotedExprTy varaTy)) let v_lift_value_info = makeIntrinsicValRef(fslib_MFQuotations_nleref, "Value" , Some "Expr" , None , [vara], ([[varaTy]], mkRawQuotedExprTy)) let v_lift_value_with_name_info = makeIntrinsicValRef(fslib_MFQuotations_nleref, "ValueWithName" , Some "Expr" , None , [vara], ([[varaTy; v_string_ty]], mkRawQuotedExprTy)) - let v_lift_value_with_defn_info = makeIntrinsicValRef(fslib_MFQuotations_nleref, "WithValue" , Some "Expr" , None , [vara], ([[varaTy; mkQuotedExprTy varaTy]], mkQuotedExprTy varaTy)) + let v_lift_value_with_defn_info = makeIntrinsicValRef(fslib_MFQuotations_nleref, "WithValue" , Some "Expr" , None , [vara], ([[varaTy; mkQuotedExprTy varaTy]], mkQuotedExprTy varaTy)) let v_query_value_info = makeIntrinsicValRef(fslib_MFExtraTopLevelOperators_nleref, "query" , None , None , [], ([], mkQueryBuilderTy) ) let v_query_run_value_info = makeIntrinsicValRef(fslib_MFQueryRunExtensionsLowPriority_nleref, "Run" , Some "QueryBuilder" , None , [vara], ([[mkQueryBuilderTy];[mkQuotedExprTy varaTy]], varaTy) ) let v_query_run_enumerable_info = makeIntrinsicValRef(fslib_MFQueryRunExtensionsHighPriority_nleref, "Run" , Some "QueryBuilder" , None , [vara], ([[mkQueryBuilderTy];[mkQuotedExprTy (mkQuerySourceTy varaTy (mkNonGenericTy v_tcref_System_Collections_IEnumerable)) ]], mkSeqTy varaTy) ) @@ -1219,6 +1220,7 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member __.greater_than_operator = v_greater_than_operator_info member __.greater_than_or_equals_operator = v_greater_than_or_equals_operator_info + member __.hash_info = v_hash_info member __.box_info = v_box_info member __.isnull_info = v_isnull_info member __.isnotnull_info = v_isnotnull_info diff --git a/src/fsharp/symbols/Exprs.fs b/src/fsharp/symbols/Exprs.fs index b15a0603fce..9106cc3d792 100644 --- a/src/fsharp/symbols/Exprs.fs +++ b/src/fsharp/symbols/Exprs.fs @@ -616,7 +616,13 @@ module FSharpExprConvert = let op = mkCallTypeTest cenv.g m ty arg ConvExprPrim cenv env op - | TOp.ILAsm([ I_ldtoken _ ], _), [ty], _ -> + | TOp.ILAsm ([ I_call (Normalcall, mspec, None) ], _), _, [arg] + when mspec.Name = "GetHashCode" -> + let ty = tyOfExpr cenv.g arg + let op = mkCallHash cenv.g m ty arg + ConvExprPrim cenv env op + + | TOp.ILAsm([ I_ldtoken (ILToken.ILType _ilty) ], _), [ty], _ -> let op = mkCallTypeOf cenv.g m ty ConvExprPrim cenv env op @@ -656,9 +662,10 @@ module FSharpExprConvert = let op = binaryOp cenv.g m ty arg1 arg2 ConvExprPrim cenv env op - | TOp.ILAsm([ ILConvertOp convertOp1; ILConvertOp convertOp2 ], _), [ty2], [arg] -> + | TOp.ILAsm([ ILConvertOp convertOp1; ILConvertOp convertOp2 ], _), _, [arg] -> let ty1 = tyOfExpr cenv.g arg let op1 = convertOp1 cenv.g m ty1 arg + let ty2 = tyOfExpr cenv.g op1 let op2 = convertOp2 cenv.g m ty2 op1 ConvExprPrim cenv env op2 @@ -747,6 +754,10 @@ module FSharpExprConvert = else lim1 E.FastIntegerForLoop(ConvExpr cenv env lim0, ConvExpr cenv env lim1, ConvExpr cenv env body, dir <> FSharpForLoopDown) + | TOp.ILCall(_, _, _, _isNewObj, _valUseFlags, _isProp, _, ilMethRef, _enclTypeArgs, _methTypeArgs, _tys), [], [arg] + when ilMethRef.EnclosingTypeRef.Name = "System.Type" && ilMethRef.Name = "GetTypeFromHandle" -> + ConvExprPrim cenv env arg + | TOp.ILCall(_, _, _, isNewObj, valUseFlags, _isProp, _, ilMethRef, enclTypeArgs, methTypeArgs, _tys), [], callArgs -> ConvILCall cenv env (isNewObj, valUseFlags, ilMethRef, enclTypeArgs, methTypeArgs, callArgs, m) diff --git a/tests/service/ExprTests.fs b/tests/service/ExprTests.fs index 86a70e0c671..a5e5fc91155 100644 --- a/tests/service/ExprTests.fs +++ b/tests/service/ExprTests.fs @@ -96,6 +96,33 @@ module internal Utils = and printIimpls iis = String.concat ";" (List.map printImlementation iis) and printImlementation (i, ors) = "interface " + printTy i + " with " + printOverrides ors + let rec printFSharpDecls prefix decls = + seq { + let mutable i = 0 + for decl in decls do + i <- i + 1 + match decl with + | FSharpImplementationFileDeclaration.Entity (e, sub) -> + yield sprintf "%s%i) ENTITY: %s %A" prefix i e.CompiledName (attribsOfSymbol e) + if not (Seq.isEmpty e.Attributes) then + yield sprintf "%sattributes: %A" prefix (Seq.toList e.Attributes) + if not (Seq.isEmpty e.DeclaredInterfaces) then + yield sprintf "%sinterfaces: %A" prefix (Seq.toList e.DeclaredInterfaces) + yield "" + yield! printFSharpDecls (prefix + "\t") sub + | FSharpImplementationFileDeclaration.MemberOrFunctionOrValue (meth, args, body) -> + yield sprintf "%s%i) METHOD: %s %A" prefix i meth.CompiledName (attribsOfSymbol meth) + yield sprintf "%stype: %A" prefix meth.FullType + yield sprintf "%sargs: %A" prefix args + // if not meth.IsCompilerGenerated then + yield sprintf "%sbody: %A" prefix body + yield "" + | FSharpImplementationFileDeclaration.InitAction (expr) -> + yield sprintf "%s%i) ACTION" prefix i + yield sprintf "%s%A" prefix expr + yield "" + } + let rec printDeclaration (excludes:HashSet<_> option) (d: FSharpImplementationFileDeclaration) = seq { match d with @@ -283,7 +310,7 @@ let localGenericFunctionExample() = let funcEx1 (x:int) = x let genericFuncEx1 (x:'T) = x let (topPair1a, topPair1b) = (1,2) -let tyfuncEx1<'T> = typeof<'T> + let testILCall1 = new obj() let testILCall2 = System.Console.WriteLine("176") @@ -578,7 +605,10 @@ let testHashInt64 (x:int64) = hash x let testHashUInt64 (x:uint64) = hash x let testHashIntPtr (x:nativeint) = hash x let testHashUIntPtr (x:unativeint) = hash x -// let testHashString (x:string) = hash x + +let testHashString (x:string) = hash x +let testDualConv (x:byte) = float32(x) +let testTypeOf (x:'T) = typeof<'T> """ File.WriteAllText(fileName2, fileSource2) @@ -624,7 +654,6 @@ let ``Test Declarations project1`` () = "let genericFuncEx1(x) = x @ (24,29--24,30)"; "let topPair1b = M.patternInput@25 ().Item1 @ (25,4--25,26)"; "let topPair1a = M.patternInput@25 ().Item0 @ (25,4--25,26)"; - "let tyfuncEx1 = Operators.TypeOf<'T> () @ (26,20--26,26)"; "let testILCall1 = new Object() @ (27,18--27,27)"; "let testILCall2 = Console.WriteLine (\"176\") @ (28,18--28,49)"; "let recValNeverUsedAtRuntime = recValNeverUsedAtRuntime@31.Force(()) @ (31,8--31,32)"; @@ -755,7 +784,10 @@ let ``Test Declarations project1`` () = "let testHashInt64(x) = Operators.Hash (x) @ (63,30--63,36)"; "let testHashUInt64(x) = Operators.Hash (x) @ (64,32--64,38)"; "let testHashIntPtr(x) = Operators.Hash (x) @ (65,35--65,41)"; - "let testHashUIntPtr(x) = Operators.Hash (x) @ (66,37--66,43)" ] + "let testHashUIntPtr(x) = Operators.Hash (x) @ (66,37--66,43)"; + "let testHashString(x) = Operators.Hash (x) @ (68,32--68,38)"; + "let testDualConv(x) = Operators.ToSingle (x) @ (69,28--69,38)"; + "let testTypeOf(x) = Operators.TypeOf<'T> () @ (70,24--70,30)" ] printDeclarations None (List.ofSeq file1.Declarations) |> Seq.toList @@ -806,7 +838,6 @@ let ``Test Optimized Declarations Project1`` () = "let genericFuncEx1(x) = x @ (24,29--24,30)"; "let topPair1b = M.patternInput@25 ().Item1 @ (25,4--25,26)"; "let topPair1a = M.patternInput@25 ().Item0 @ (25,4--25,26)"; - "let tyfuncEx1 = Type.GetTypeFromHandle (Operators.TypeOf<'T> ()) @ (26,20--26,26)"; "let testILCall1 = new Object() @ (27,18--27,27)"; "let testILCall2 = Console.WriteLine (\"176\") @ (28,18--28,49)"; "let recValNeverUsedAtRuntime = recValNeverUsedAtRuntime@31.Force(()) @ (31,8--31,32)"; @@ -897,60 +928,65 @@ let ``Test Optimized Declarations Project1`` () = "let letLambdaRes = ListModule.Map (fun tupledArg -> let a: Microsoft.FSharp.Core.int = tupledArg.Item0 in let b: Microsoft.FSharp.Core.int = tupledArg.Item1 in (LetLambda.f () a) b,Cons((1,2),Empty())) @ (249,19--249,71)"] let expected2 = - [ "type N"; "type IntAbbrev"; "let bool2 = False @ (6,12--6,17)"; - "let testEqualsOperator(e1) (e2) = HashCompare.GenericEqualityIntrinsic<'a> (e1,e2) @ (8,46--8,54)"; - "let testNotEqualsOperator(e1) (e2) = Operators.op_Equality (HashCompare.GenericEqualityIntrinsic<'a> (e1,e2),False) @ (9,46--9,55)"; - "let testLessThanOperator(e1) (e2) = HashCompare.GenericLessThanIntrinsic<'a> (e1,e2) @ (10,46--10,54)"; - "let testLessThanOrEqualsOperator(e1) (e2) = HashCompare.GenericLessOrEqualIntrinsic<'a> (e1,e2) @ (11,46--11,55)"; - "let testGreaterThanOperator(e1) (e2) = HashCompare.GenericGreaterThanIntrinsic<'a> (e1,e2) @ (12,46--12,54)"; - "let testGreaterThanOrEqualsOperator(e1) (e2) = HashCompare.GenericGreaterOrEqualIntrinsic<'a> (e1,e2) @ (13,46--13,55)"; - "let testAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (15,38--15,46)"; - "let testSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (16,38--16,46)"; - "let testMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (17,37--17,46)"; - "let testDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (18,38--18,46)"; - "let testModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (19,38--19,46)"; - "let testBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (20,38--20,48)"; - "let testBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (21,38--21,48)"; - "let testBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (22,38--22,48)"; - "let testShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,Operators.op_BitwiseAnd (e2,31)) @ (23,38--23,48)"; - "let testShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,Operators.op_BitwiseAnd (e2,31)) @ (24,38--24,48)"; - "let testUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (26,33--26,39)"; - "let testUnaryNotOperator(e1) = Operators.op_Equality (e1,False) @ (27,32--27,35)"; - "let testAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (29,35--29,52)"; - "let testSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (30,35--30,52)"; - "let testMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (31,35--31,52)"; - "let testUnaryNegChecked(e1) = Checked.op_Subtraction (0,e1) @ (32,32--32,47)"; - "let testToByteChecked(e1) = Checked.ToByte (e1) @ (34,31--34,46)"; - "let testToSByteChecked(e1) = Checked.ToSByte (e1) @ (35,31--35,47)"; - "let testToInt16Checked(e1) = Checked.ToInt16 (e1) @ (36,31--36,47)"; - "let testToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (37,31--37,48)"; - "let testToIntChecked(e1) = Checked.ToInt32 (e1) @ (38,31--38,45)"; - "let testToInt32Checked(e1) = Checked.ToInt32 (e1) @ (39,31--39,47)"; - "let testToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (40,31--40,48)"; - "let testToInt64Checked(e1) = Checked.ToInt64 (e1) @ (41,31--41,47)"; - "let testToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (42,31--42,48)"; - "let testToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (43,31--43,51)"; - "let testToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (44,31--44,52)"; - "let testToByteOperator(e1) = Operators.ToByte (e1) @ (46,31--46,38)"; - "let testToSByteOperator(e1) = Operators.ToSByte (e1) @ (47,31--47,39)"; - "let testToInt16Operator(e1) = Operators.ToInt16 (e1) @ (48,31--48,39)"; - "let testToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (49,31--49,40)"; - "let testToIntOperator(e1) = e1 @ (50,35--50,37)"; - "let testToInt32Operator(e1) = e1 @ (51,37--51,39)"; - "let testToUInt32Operator(e1) = e1 @ (52,31--52,40)"; - "let testToInt64Operator(e1) = Operators.ToInt64 (e1) @ (53,31--53,39)"; - "let testToUInt64Operator(e1) = Operators.ToInt64 (e1) @ (54,31--54,40)"; - "let testToSingleOperator(e1) = Operators.ToSingle (e1) @ (55,31--55,41)"; - "let testToDoubleOperator(e1) = Operators.ToDouble (e1) @ (56,31--56,39)"; - "let testToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (57,31--57,43)"; - "let testToUIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (58,31--58,44)"; - "let testHashChar(x) = Operators.op_BitwiseOr (Operators.op_LeftShift (x,16),x) @ (60,28--60,34)"; - "let testHashSByte(x) = Operators.op_ExclusiveOr (Operators.op_LeftShift (x,8),x) @ (61,30--61,36)"; - "let testHashInt16(x) = Operators.op_BitwiseOr (Operators.ToUInt16 (x),Operators.op_LeftShift (x,16)) @ (62,30--62,36)"; - "let testHashInt64(x) = Operators.op_ExclusiveOr (Operators.ToInt32 (x),Operators.ToInt32 (Operators.op_RightShift (x,32))) @ (63,30--63,36)"; - "let testHashUInt64(x) = Operators.op_ExclusiveOr (Operators.ToInt32 (x),Operators.ToInt32 (Operators.op_RightShift (x,32))) @ (64,32--64,38)"; - "let testHashIntPtr(x) = Operators.ToInt32 (Operators.ToUInt64 (x)) @ (65,35--65,41)"; - "let testHashUIntPtr(x) = Operators.op_BitwiseAnd (Operators.ToInt32 (Operators.ToUInt64 (x)),2147483647) @ (66,37--66,43)"] + [ "type N"; "type IntAbbrev"; "let bool2 = False @ (6,12--6,17)"; + "let testEqualsOperator(e1) (e2) = HashCompare.GenericEqualityIntrinsic<'a> (e1,e2) @ (8,46--8,54)"; + "let testNotEqualsOperator(e1) (e2) = Operators.op_Equality (HashCompare.GenericEqualityIntrinsic<'a> (e1,e2),False) @ (9,46--9,55)"; + "let testLessThanOperator(e1) (e2) = HashCompare.GenericLessThanIntrinsic<'a> (e1,e2) @ (10,46--10,54)"; + "let testLessThanOrEqualsOperator(e1) (e2) = HashCompare.GenericLessOrEqualIntrinsic<'a> (e1,e2) @ (11,46--11,55)"; + "let testGreaterThanOperator(e1) (e2) = HashCompare.GenericGreaterThanIntrinsic<'a> (e1,e2) @ (12,46--12,54)"; + "let testGreaterThanOrEqualsOperator(e1) (e2) = HashCompare.GenericGreaterOrEqualIntrinsic<'a> (e1,e2) @ (13,46--13,55)"; + "let testAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (15,38--15,46)"; + "let testSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (16,38--16,46)"; + "let testMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (17,37--17,46)"; + "let testDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (18,38--18,46)"; + "let testModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (19,38--19,46)"; + "let testBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (20,38--20,48)"; + "let testBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (21,38--21,48)"; + "let testBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (22,38--22,48)"; + "let testShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,Operators.op_BitwiseAnd (e2,31)) @ (23,38--23,48)"; + "let testShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,Operators.op_BitwiseAnd (e2,31)) @ (24,38--24,48)"; + "let testUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (26,33--26,39)"; + "let testUnaryNotOperator(e1) = Operators.op_Equality (e1,False) @ (27,32--27,35)"; + "let testAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (29,35--29,52)"; + "let testSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (30,35--30,52)"; + "let testMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (31,35--31,52)"; + "let testUnaryNegChecked(e1) = Checked.op_Subtraction (0,e1) @ (32,32--32,47)"; + "let testToByteChecked(e1) = Checked.ToByte (e1) @ (34,31--34,46)"; + "let testToSByteChecked(e1) = Checked.ToSByte (e1) @ (35,31--35,47)"; + "let testToInt16Checked(e1) = Checked.ToInt16 (e1) @ (36,31--36,47)"; + "let testToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (37,31--37,48)"; + "let testToIntChecked(e1) = Checked.ToInt32 (e1) @ (38,31--38,45)"; + "let testToInt32Checked(e1) = Checked.ToInt32 (e1) @ (39,31--39,47)"; + "let testToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (40,31--40,48)"; + "let testToInt64Checked(e1) = Checked.ToInt64 (e1) @ (41,31--41,47)"; + "let testToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (42,31--42,48)"; + "let testToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (43,31--43,51)"; + "let testToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (44,31--44,52)"; + "let testToByteOperator(e1) = Operators.ToByte (e1) @ (46,31--46,38)"; + "let testToSByteOperator(e1) = Operators.ToSByte (e1) @ (47,31--47,39)"; + "let testToInt16Operator(e1) = Operators.ToInt16 (e1) @ (48,31--48,39)"; + "let testToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (49,31--49,40)"; + "let testToIntOperator(e1) = e1 @ (50,35--50,37)"; + "let testToInt32Operator(e1) = e1 @ (51,37--51,39)"; + "let testToUInt32Operator(e1) = e1 @ (52,31--52,40)"; + "let testToInt64Operator(e1) = Operators.ToInt64 (e1) @ (53,31--53,39)"; + "let testToUInt64Operator(e1) = Operators.ToInt64 (e1) @ (54,31--54,40)"; + "let testToSingleOperator(e1) = Operators.ToSingle (e1) @ (55,31--55,41)"; + "let testToDoubleOperator(e1) = Operators.ToDouble (e1) @ (56,31--56,39)"; + "let testToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (57,31--57,43)"; + "let testToUIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (58,31--58,44)"; + "let testHashChar(x) = Operators.op_BitwiseOr (Operators.op_LeftShift (x,16),x) @ (60,28--60,34)"; + "let testHashSByte(x) = Operators.op_ExclusiveOr (Operators.op_LeftShift (x,8),x) @ (61,30--61,36)"; + "let testHashInt16(x) = Operators.op_BitwiseOr (Operators.ToUInt16 (x),Operators.op_LeftShift (x,16)) @ (62,30--62,36)"; + "let testHashInt64(x) = Operators.op_ExclusiveOr (Operators.ToInt32 (x),Operators.ToInt32 (Operators.op_RightShift (x,32))) @ (63,30--63,36)"; + "let testHashUInt64(x) = Operators.op_ExclusiveOr (Operators.ToInt32 (x),Operators.ToInt32 (Operators.op_RightShift (x,32))) @ (64,32--64,38)"; + "let testHashIntPtr(x) = Operators.ToInt32 (Operators.ToUInt64 (x)) @ (65,35--65,41)"; + "let testHashUIntPtr(x) = Operators.op_BitwiseAnd (Operators.ToInt32 (Operators.ToUInt64 (x)),2147483647) @ (66,37--66,43)"; + "let testHashString(x) = (if Operators.op_Equality (x,dflt) then 0 else Operators.Hash (x)) @ (68,32--68,38)"; + "let testDualConv(x) = Operators.ToSingle (Operators.ToDouble (x)) @ (69,28--69,38)"; + "let testTypeOf(x) = Operators.TypeOf<'T> () @ (70,24--70,30)" ] + + // printFSharpDecls "" file2.Declarations |> Seq.iter (printfn "%s") printDeclarations None (List.ofSeq file1.Declarations) |> Seq.toList From 1e373c7b6e868da05b39fcf6f1266a4d1a1b10b5 Mon Sep 17 00:00:00 2001 From: ncave <777696+ncave@users.noreply.github.com> Date: Fri, 2 Feb 2018 05:12:22 -0800 Subject: [PATCH 16/21] more targeted replacements --- src/fsharp/symbols/Exprs.fs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/fsharp/symbols/Exprs.fs b/src/fsharp/symbols/Exprs.fs index 9106cc3d792..5a39e3c8491 100644 --- a/src/fsharp/symbols/Exprs.fs +++ b/src/fsharp/symbols/Exprs.fs @@ -617,12 +617,14 @@ module FSharpExprConvert = ConvExprPrim cenv env op | TOp.ILAsm ([ I_call (Normalcall, mspec, None) ], _), _, [arg] - when mspec.Name = "GetHashCode" -> + when mspec.MethodRef.EnclosingTypeRef.Name = "System.String" && mspec.Name = "GetHashCode" -> let ty = tyOfExpr cenv.g arg let op = mkCallHash cenv.g m ty arg ConvExprPrim cenv env op - | TOp.ILAsm([ I_ldtoken (ILToken.ILType _ilty) ], _), [ty], _ -> + | TOp.ILCall(_, _, _, _, _, _, _, mref, _, _, _), [], + [Expr.Op(TOp.ILAsm([ I_ldtoken (ILToken.ILType _) ], _), [ty], _, _)] + when mref.EnclosingTypeRef.Name = "System.Type" && mref.Name = "GetTypeFromHandle" -> let op = mkCallTypeOf cenv.g m ty ConvExprPrim cenv env op @@ -754,10 +756,6 @@ module FSharpExprConvert = else lim1 E.FastIntegerForLoop(ConvExpr cenv env lim0, ConvExpr cenv env lim1, ConvExpr cenv env body, dir <> FSharpForLoopDown) - | TOp.ILCall(_, _, _, _isNewObj, _valUseFlags, _isProp, _, ilMethRef, _enclTypeArgs, _methTypeArgs, _tys), [], [arg] - when ilMethRef.EnclosingTypeRef.Name = "System.Type" && ilMethRef.Name = "GetTypeFromHandle" -> - ConvExprPrim cenv env arg - | TOp.ILCall(_, _, _, isNewObj, valUseFlags, _isProp, _, ilMethRef, enclTypeArgs, methTypeArgs, _tys), [], callArgs -> ConvILCall cenv env (isNewObj, valUseFlags, ilMethRef, enclTypeArgs, methTypeArgs, callArgs, m) From e5f1c6fa11f5cb6e3ea6da8f38094aca15d20e6a Mon Sep 17 00:00:00 2001 From: ncave <777696+ncave@users.noreply.github.com> Date: Fri, 2 Feb 2018 05:52:57 -0800 Subject: [PATCH 17/21] adapt to latest --- src/fsharp/symbols/Exprs.fs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fsharp/symbols/Exprs.fs b/src/fsharp/symbols/Exprs.fs index 48153d482aa..ba5c1872438 100644 --- a/src/fsharp/symbols/Exprs.fs +++ b/src/fsharp/symbols/Exprs.fs @@ -617,14 +617,14 @@ module FSharpExprConvert = ConvExprPrim cenv env op | TOp.ILAsm ([ I_call (Normalcall, mspec, None) ], _), _, [arg] - when mspec.MethodRef.EnclosingTypeRef.Name = "System.String" && mspec.Name = "GetHashCode" -> + when mspec.MethodRef.DeclaringTypeRef.Name = "System.String" && mspec.Name = "GetHashCode" -> let ty = tyOfExpr cenv.g arg let op = mkCallHash cenv.g m ty arg ConvExprPrim cenv env op | TOp.ILCall(_, _, _, _, _, _, _, mref, _, _, _), [], [Expr.Op(TOp.ILAsm([ I_ldtoken (ILToken.ILType _) ], _), [ty], _, _)] - when mref.EnclosingTypeRef.Name = "System.Type" && mref.Name = "GetTypeFromHandle" -> + when mref.DeclaringTypeRef.Name = "System.Type" && mref.Name = "GetTypeFromHandle" -> let op = mkCallTypeOf cenv.g m ty ConvExprPrim cenv env op From c7da1b4b699a9cdde5566a66dc1acb179eacf76c Mon Sep 17 00:00:00 2001 From: ncave <777696+ncave@users.noreply.github.com> Date: Fri, 9 Feb 2018 10:02:52 -0800 Subject: [PATCH 18/21] added more tests --- tests/service/ExprTests.fs | 980 +++++++++++++++++++++++++++++++------ 1 file changed, 831 insertions(+), 149 deletions(-) diff --git a/tests/service/ExprTests.fs b/tests/service/ExprTests.fs index 718b9cbb901..91f1da5e824 100644 --- a/tests/service/ExprTests.fs +++ b/tests/service/ExprTests.fs @@ -546,6 +546,17 @@ type IntAbbrev = int let bool2 = false +let testHashChar (x:char) = hash x +let testHashSByte (x:sbyte) = hash x +let testHashInt16 (x:int16) = hash x +let testHashInt64 (x:int64) = hash x +let testHashUInt64 (x:uint64) = hash x +let testHashIntPtr (x:nativeint) = hash x +let testHashUIntPtr (x:unativeint) = hash x + +let testHashString (x:string) = hash x +let testTypeOf (x:'T) = typeof<'T> + let testEqualsOperator e1 e2 = (=) e1 e2 let testNotEqualsOperator e1 e2 = (<>) e1 e2 let testLessThanOperator e1 e2 = (<) e1 e2 @@ -572,43 +583,269 @@ let testSubtractionChecked e1 e2 = Checked.(-) e1 e2 let testMultiplyChecked e1 e2 = Checked.(*) e1 e2 let testUnaryNegChecked e1 = Checked.(~-) e1 -let testToByteChecked e1 = Checked.byte e1 -let testToSByteChecked e1 = Checked.sbyte e1 -let testToInt16Checked e1 = Checked.int16 e1 -let testToUInt16Checked e1 = Checked.uint16 e1 -let testToIntChecked e1 = Checked.int e1 -let testToInt32Checked e1 = Checked.int32 e1 -let testToUInt32Checked e1 = Checked.uint32 e1 -let testToInt64Checked e1 = Checked.int64 e1 -let testToUInt64Checked e1 = Checked.uint64 e1 -let testToIntPtrChecked e1 = Checked.nativeint e1 -let testToUIntPtrChecked e1 = Checked.unativeint e1 - -let testToByteOperator e1 = byte e1 -let testToSByteOperator e1 = sbyte e1 -let testToInt16Operator e1 = int16 e1 -let testToUInt16Operator e1 = uint16 e1 -let testToIntOperator e1 = int e1 -let testToInt32Operator e1 = int32 e1 -let testToUInt32Operator e1 = uint32 e1 -let testToInt64Operator e1 = int64 e1 -let testToUInt64Operator e1 = uint64 e1 -let testToSingleOperator e1 = float32 e1 -let testToDoubleOperator e1 = float e1 -let testToIntPtrOperator e1 = nativeint e1 -let testToUIntPtrOperator e1 = unativeint e1 - -let testHashChar (x:char) = hash x -let testHashSByte (x:sbyte) = hash x -let testHashInt16 (x:int16) = hash x -let testHashInt64 (x:int64) = hash x -let testHashUInt64 (x:uint64) = hash x -let testHashIntPtr (x:nativeint) = hash x -let testHashUIntPtr (x:unativeint) = hash x - -let testHashString (x:string) = hash x -let testDualConv (x:byte) = float32(x) -let testTypeOf (x:'T) = typeof<'T> +let testToByteChecked e1 = Checked.byte e1 +let testToSByteChecked e1 = Checked.sbyte e1 +let testToInt16Checked e1 = Checked.int16 e1 +let testToUInt16Checked e1 = Checked.uint16 e1 +let testToIntChecked e1 = Checked.int e1 +let testToInt32Checked e1 = Checked.int32 e1 +let testToUInt32Checked e1 = Checked.uint32 e1 +let testToInt64Checked e1 = Checked.int64 e1 +let testToUInt64Checked e1 = Checked.uint64 e1 +let testToIntPtrChecked e1 = Checked.nativeint e1 +let testToUIntPtrChecked e1 = Checked.unativeint e1 + +let testToByteOperator e1 = byte e1 +let testToSByteOperator e1 = sbyte e1 +let testToInt16Operator e1 = int16 e1 +let testToUInt16Operator e1 = uint16 e1 +let testToIntOperator e1 = int e1 +let testToInt32Operator e1 = int32 e1 +let testToUInt32Operator e1 = uint32 e1 +let testToInt64Operator e1 = int64 e1 +let testToUInt64Operator e1 = uint64 e1 +let testToIntPtrOperator e1 = nativeint e1 +let testToUIntPtrOperator e1 = unativeint e1 +let testToSingleOperator e1 = float32 e1 +let testToDoubleOperator e1 = float e1 +let testToDecimalOperator e1 = decimal e1 +let testToCharOperator e1 = char e1 +let testToStringOperator e1 = string e1 + +let testByteToByte (x:byte) = byte x +let testByteToSByte (x:byte) = sbyte x +let testByteToInt16 (x:byte) = int16 x +let testByteToUInt16 (x:byte) = uint16 x +let testByteToInt32 (x:byte) = int x +let testByteToUInt32 (x:byte) = uint32 x +let testByteToInt64 (x:byte) = int64 x +let testByteToUInt64 (x:byte) = uint64 x +let testByteToIntPtr (x:byte) = nativeint x +let testByteToUIntPtr (x:byte) = unativeint x +let testByteToSingle (x:byte) = float32 x +let testByteToDouble (x:byte) = float x +let testByteToDecimal (x:byte) = decimal x +let testByteToChar (x:byte) = char x +let testByteToString (x:byte) = string x + +let testSByteToByte (x:sbyte) = byte x +let testSByteToSByte (x:sbyte) = sbyte x +let testSByteToInt16 (x:sbyte) = int16 x +let testSByteToUInt16 (x:sbyte) = uint16 x +let testSByteToInt32 (x:sbyte) = int x +let testSByteToUInt32 (x:sbyte) = uint32 x +let testSByteToInt64 (x:sbyte) = int64 x +let testSByteToUInt64 (x:sbyte) = uint64 x +let testSByteToIntPtr (x:sbyte) = nativeint x +let testSByteToUIntPtr (x:sbyte) = unativeint x +let testSByteToSingle (x:sbyte) = float32 x +let testSByteToDouble (x:sbyte) = float x +let testSByteToDecimal (x:sbyte) = decimal x +let testSByteToChar (x:sbyte) = char x +let testSByteToString (x:sbyte) = string x + +let testInt16ToByte (x:int16) = byte x +let testInt16ToSByte (x:int16) = sbyte x +let testInt16ToInt16 (x:int16) = int16 x +let testInt16ToUInt16 (x:int16) = uint16 x +let testInt16ToInt32 (x:int16) = int x +let testInt16ToUInt32 (x:int16) = uint32 x +let testInt16ToInt64 (x:int16) = int64 x +let testInt16ToUInt64 (x:int16) = uint64 x +let testInt16ToIntPtr (x:int16) = nativeint x +let testInt16ToUIntPtr (x:int16) = unativeint x +let testInt16ToSingle (x:int16) = float32 x +let testInt16ToDouble (x:int16) = float x +let testInt16ToDecimal (x:int16) = decimal x +let testInt16ToChar (x:int16) = char x +let testInt16ToString (x:int16) = string x + +let testUInt16ToByte (x:uint16) = byte x +let testUInt16ToSByte (x:uint16) = sbyte x +let testUInt16ToInt16 (x:uint16) = int16 x +let testUInt16ToUInt16 (x:uint16) = uint16 x +let testUInt16ToInt32 (x:uint16) = int x +let testUInt16ToUInt32 (x:uint16) = uint32 x +let testUInt16ToInt64 (x:uint16) = int64 x +let testUInt16ToUInt64 (x:uint16) = uint64 x +let testUInt16ToIntPtr (x:uint16) = nativeint x +let testUInt16ToUIntPtr (x:uint16) = unativeint x +let testUInt16ToSingle (x:uint16) = float32 x +let testUInt16ToDouble (x:uint16) = float x +let testUInt16ToDecimal (x:uint16) = decimal x +let testUInt16ToChar (x:uint16) = char x +let testUInt16ToString (x:uint16) = string x + +let testInt32ToByte (x:int) = byte x +let testInt32ToSByte (x:int) = sbyte x +let testInt32ToInt16 (x:int) = int16 x +let testInt32ToUInt16 (x:int) = uint16 x +let testInt32ToInt32 (x:int) = int x +let testInt32ToUInt32 (x:int) = uint32 x +let testInt32ToInt64 (x:int) = int64 x +let testInt32ToUInt64 (x:int) = uint64 x +let testInt32ToIntPtr (x:int) = nativeint x +let testInt32ToUIntPtr (x:int) = unativeint x +let testInt32ToSingle (x:int) = float32 x +let testInt32ToDouble (x:int) = float x +let testInt32ToDecimal (x:int) = decimal x +let testInt32ToChar (x:int) = char x +let testInt32ToString (x:int) = string x + +let testUInt32ToByte (x:uint32) = byte x +let testUInt32ToSByte (x:uint32) = sbyte x +let testUInt32ToInt16 (x:uint32) = int16 x +let testUInt32ToUInt16 (x:uint32) = uint16 x +let testUInt32ToInt32 (x:uint32) = int x +let testUInt32ToUInt32 (x:uint32) = uint32 x +let testUInt32ToInt64 (x:uint32) = int64 x +let testUInt32ToUInt64 (x:uint32) = uint64 x +let testUInt32ToIntPtr (x:uint32) = nativeint x +let testUInt32ToUIntPtr (x:uint32) = unativeint x +let testUInt32ToSingle (x:uint32) = float32 x +let testUInt32ToDouble (x:uint32) = float x +let testUInt32ToDecimal (x:uint32) = decimal x +let testUInt32ToChar (x:uint32) = char x +let testUInt32ToString (x:uint32) = string x + +let testInt64ToByte (x:int64) = byte x +let testInt64ToSByte (x:int64) = sbyte x +let testInt64ToInt16 (x:int64) = int16 x +let testInt64ToUInt16 (x:int64) = uint16 x +let testInt64ToInt32 (x:int64) = int x +let testInt64ToUInt32 (x:int64) = uint32 x +let testInt64ToInt64 (x:int64) = int64 x +let testInt64ToUInt64 (x:int64) = uint64 x +let testInt64ToIntPtr (x:int64) = nativeint x +let testInt64ToUIntPtr (x:int64) = unativeint x +let testInt64ToSingle (x:int64) = float32 x +let testInt64ToDouble (x:int64) = float x +let testInt64ToDecimal (x:int64) = decimal x +let testInt64ToChar (x:int64) = char x +let testInt64ToString (x:int64) = string x + +let testUInt64ToByte (x:uint64) = byte x +let testUInt64ToSByte (x:uint64) = sbyte x +let testUInt64ToInt16 (x:uint64) = int16 x +let testUInt64ToUInt16 (x:uint64) = uint16 x +let testUInt64ToInt32 (x:uint64) = int x +let testUInt64ToUInt32 (x:uint64) = uint32 x +let testUInt64ToInt64 (x:uint64) = int64 x +let testUInt64ToUInt64 (x:uint64) = uint64 x +let testUInt64ToIntPtr (x:uint64) = nativeint x +let testUInt64ToUIntPtr (x:uint64) = unativeint x +let testUInt64ToSingle (x:uint64) = float32 x +let testUInt64ToDouble (x:uint64) = float x +let testUInt64ToDecimal (x:uint64) = decimal x +let testUInt64ToChar (x:uint64) = char x +let testUInt64ToString (x:uint64) = string x + +let testIntPtrToByte (x:nativeint) = byte x +let testIntPtrToSByte (x:nativeint) = sbyte x +let testIntPtrToInt16 (x:nativeint) = int16 x +let testIntPtrToUInt16 (x:nativeint) = uint16 x +let testIntPtrToInt32 (x:nativeint) = int x +let testIntPtrToUInt32 (x:nativeint) = uint32 x +let testIntPtrToInt64 (x:nativeint) = int64 x +let testIntPtrToUInt64 (x:nativeint) = uint64 x +let testIntPtrToIntPtr (x:nativeint) = nativeint x +let testIntPtrToUIntPtr (x:nativeint) = unativeint x +let testIntPtrToSingle (x:nativeint) = float32 x +let testIntPtrToDouble (x:nativeint) = float x +let testIntPtrToDecimal (x:nativeint) = decimal x +let testIntPtrToChar (x:nativeint) = char x +let testIntPtrToString (x:nativeint) = string x + +let testUIntPtrToByte (x:unativeint) = byte x +let testUIntPtrToSByte (x:unativeint) = sbyte x +let testUIntPtrToInt16 (x:unativeint) = int16 x +let testUIntPtrToUInt16 (x:unativeint) = uint16 x +let testUIntPtrToInt32 (x:unativeint) = int x +let testUIntPtrToUInt32 (x:unativeint) = uint32 x +let testUIntPtrToInt64 (x:unativeint) = int64 x +let testUIntPtrToUInt64 (x:unativeint) = uint64 x +let testUIntPtrToIntPtr (x:unativeint) = nativeint x +let testUIntPtrToUIntPtr (x:unativeint) = unativeint x +let testUIntPtrToSingle (x:unativeint) = float32 x +let testUIntPtrToDouble (x:unativeint) = float x +let testUIntPtrToDecimal (x:unativeint) = decimal x +let testUIntPtrToChar (x:unativeint) = char x +let testUIntPtrToString (x:unativeint) = string x + +let testSingleToByte (x:float32) = byte x +let testSingleToSByte (x:float32) = sbyte x +let testSingleToInt16 (x:float32) = int16 x +let testSingleToUInt16 (x:float32) = uint16 x +let testSingleToInt32 (x:float32) = int x +let testSingleToUInt32 (x:float32) = uint32 x +let testSingleToInt64 (x:float32) = int64 x +let testSingleToUInt64 (x:float32) = uint64 x +let testSingleToIntPtr (x:float32) = nativeint x +let testSingleToUIntPtr (x:float32) = unativeint x +let testSingleToSingle (x:float32) = float32 x +let testSingleToDouble (x:float32) = float x +let testSingleToDecimal (x:float32) = decimal x +let testSingleToChar (x:float32) = char x +let testSingleToString (x:float32) = string x + +let testDoubleToByte (x:float) = byte x +let testDoubleToSByte (x:float) = sbyte x +let testDoubleToInt16 (x:float) = int16 x +let testDoubleToUInt16 (x:float) = uint16 x +let testDoubleToInt32 (x:float) = int x +let testDoubleToUInt32 (x:float) = uint32 x +let testDoubleToInt64 (x:float) = int64 x +let testDoubleToUInt64 (x:float) = uint64 x +let testDoubleToIntPtr (x:float) = nativeint x +let testDoubleToUIntPtr (x:float) = unativeint x +let testDoubleToSingle (x:float) = float32 x +let testDoubleToDouble (x:float) = float x +let testDoubleToDecimal (x:float) = decimal x +let testDoubleToChar (x:float) = char x +let testDoubleToString (x:float) = string x + +let testDecimalToByte (x:decimal) = byte x +let testDecimalToSByte (x:decimal) = sbyte x +let testDecimalToInt16 (x:decimal) = int16 x +let testDecimalToUInt16 (x:decimal) = uint16 x +let testDecimalToInt32 (x:decimal) = int x +let testDecimalToUInt32 (x:decimal) = uint32 x +let testDecimalToInt64 (x:decimal) = int64 x +let testDecimalToUInt64 (x:decimal) = uint64 x +let testDecimalToSingle (x:decimal) = float32 x +let testDecimalToDouble (x:decimal) = float x +let testDecimalToDecimal (x:decimal) = decimal x +let testDecimalToChar (x:decimal) = char x +let testDecimalToString (x:decimal) = string x + +let testCharToByte (x:char) = byte x +let testCharToSByte (x:char) = sbyte x +let testCharToInt16 (x:char) = int16 x +let testCharToUInt16 (x:char) = uint16 x +let testCharToInt32 (x:char) = int x +let testCharToUInt32 (x:char) = uint32 x +let testCharToInt64 (x:char) = int64 x +let testCharToUInt64 (x:char) = uint64 x +let testCharToIntPtr (x:char) = nativeint x +let testCharToUIntPtr (x:char) = unativeint x +let testCharToSingle (x:char) = float32 x +let testCharToDouble (x:char) = float x +let testCharToChar (x:char) = char x +let testCharToString (x:char) = string x + +let testStringToByte (x:string) = byte x +let testStringToSByte (x:string) = sbyte x +let testStringToInt16 (x:string) = int16 x +let testStringToUInt16 (x:string) = uint16 x +let testStringToInt32 (x:string) = int x +let testStringToUInt32 (x:string) = uint32 x +let testStringToInt64 (x:string) = int64 x +let testStringToUInt64 (x:string) = uint64 x +let testStringToSingle (x:string) = float32 x +let testStringToDouble (x:string) = float x +let testStringToDecimal (x:string) = decimal x +let testStringToChar (x:string) = char x +let testStringToString (x:string) = string x """ File.WriteAllText(fileName2, fileSource2) @@ -732,62 +969,284 @@ let ``Test Declarations project1`` () = let expected2 = [ "type N"; "type IntAbbrev"; "let bool2 = False @ (6,12--6,17)"; - "let testEqualsOperator(e1) (e2) = Operators.op_Equality<'a> (e1,e2) @ (8,46--8,54)"; - "let testNotEqualsOperator(e1) (e2) = Operators.op_Inequality<'a> (e1,e2) @ (9,46--9,55)"; - "let testLessThanOperator(e1) (e2) = Operators.op_LessThan<'a> (e1,e2) @ (10,46--10,54)"; - "let testLessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual<'a> (e1,e2) @ (11,46--11,55)"; - "let testGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan<'a> (e1,e2) @ (12,46--12,54)"; - "let testGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual<'a> (e1,e2) @ (13,46--13,55)"; - "let testAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (15,38--15,46)"; - "let testSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (16,38--16,46)"; - "let testMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (17,37--17,46)"; - "let testDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (18,38--18,46)"; - "let testModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (19,38--19,46)"; - "let testBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (20,38--20,48)"; - "let testBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (21,38--21,48)"; - "let testBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (22,38--22,48)"; - "let testShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (23,38--23,48)"; - "let testShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (24,38--24,48)"; - "let testUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (26,33--26,39)"; - "let testUnaryNotOperator(e1) = Operators.Not (e1) @ (27,32--27,38)"; - "let testAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (29,35--29,52)"; - "let testSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (30,35--30,52)"; - "let testMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (31,35--31,52)"; - "let testUnaryNegChecked(e1) = Checked.op_UnaryNegation (e1) @ (32,32--32,47)"; - "let testToByteChecked(e1) = Checked.ToByte (e1) @ (34,31--34,46)"; - "let testToSByteChecked(e1) = Checked.ToSByte (e1) @ (35,31--35,47)"; - "let testToInt16Checked(e1) = Checked.ToInt16 (e1) @ (36,31--36,47)"; - "let testToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (37,31--37,48)"; - "let testToIntChecked(e1) = Checked.ToInt (e1) @ (38,31--38,45)"; - "let testToInt32Checked(e1) = Checked.ToInt32 (e1) @ (39,31--39,47)"; - "let testToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (40,31--40,48)"; - "let testToInt64Checked(e1) = Checked.ToInt64 (e1) @ (41,31--41,47)"; - "let testToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (42,31--42,48)"; - "let testToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (43,31--43,51)"; - "let testToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (44,31--44,52)"; - "let testToByteOperator(e1) = Operators.ToByte (e1) @ (46,31--46,38)"; - "let testToSByteOperator(e1) = Operators.ToSByte (e1) @ (47,31--47,39)"; - "let testToInt16Operator(e1) = Operators.ToInt16 (e1) @ (48,31--48,39)"; - "let testToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (49,31--49,40)"; - "let testToIntOperator(e1) = Operators.ToInt (e1) @ (50,31--50,37)"; - "let testToInt32Operator(e1) = Operators.ToInt32 (e1) @ (51,31--51,39)"; - "let testToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (52,31--52,40)"; - "let testToInt64Operator(e1) = Operators.ToInt64 (e1) @ (53,31--53,39)"; - "let testToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (54,31--54,40)"; - "let testToSingleOperator(e1) = Operators.ToSingle (e1) @ (55,31--55,41)"; - "let testToDoubleOperator(e1) = Operators.ToDouble (e1) @ (56,31--56,39)"; - "let testToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (57,31--57,43)"; - "let testToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (58,31--58,44)"; - "let testHashChar(x) = Operators.Hash (x) @ (60,28--60,34)"; - "let testHashSByte(x) = Operators.Hash (x) @ (61,30--61,36)"; - "let testHashInt16(x) = Operators.Hash (x) @ (62,30--62,36)"; - "let testHashInt64(x) = Operators.Hash (x) @ (63,30--63,36)"; - "let testHashUInt64(x) = Operators.Hash (x) @ (64,32--64,38)"; - "let testHashIntPtr(x) = Operators.Hash (x) @ (65,35--65,41)"; - "let testHashUIntPtr(x) = Operators.Hash (x) @ (66,37--66,43)"; - "let testHashString(x) = Operators.Hash (x) @ (68,32--68,38)"; - "let testDualConv(x) = Operators.ToSingle (x) @ (69,28--69,38)"; - "let testTypeOf(x) = Operators.TypeOf<'T> () @ (70,24--70,30)" ] + "let testHashChar(x) = Operators.Hash (x) @ (8,28--8,34)"; + "let testHashSByte(x) = Operators.Hash (x) @ (9,30--9,36)"; + "let testHashInt16(x) = Operators.Hash (x) @ (10,30--10,36)"; + "let testHashInt64(x) = Operators.Hash (x) @ (11,30--11,36)"; + "let testHashUInt64(x) = Operators.Hash (x) @ (12,32--12,38)"; + "let testHashIntPtr(x) = Operators.Hash (x) @ (13,35--13,41)"; + "let testHashUIntPtr(x) = Operators.Hash (x) @ (14,37--14,43)"; + "let testHashString(x) = Operators.Hash (x) @ (16,32--16,38)"; + "let testTypeOf(x) = Operators.TypeOf<'T> () @ (17,24--17,30)"; + "let testEqualsOperator(e1) (e2) = Operators.op_Equality<'a> (e1,e2) @ (19,46--19,54)"; + "let testNotEqualsOperator(e1) (e2) = Operators.op_Inequality<'a> (e1,e2) @ (20,46--20,55)"; + "let testLessThanOperator(e1) (e2) = Operators.op_LessThan<'a> (e1,e2) @ (21,46--21,54)"; + "let testLessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual<'a> (e1,e2) @ (22,46--22,55)"; + "let testGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan<'a> (e1,e2) @ (23,46--23,54)"; + "let testGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual<'a> (e1,e2) @ (24,46--24,55)"; + "let testAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (26,38--26,46)"; + "let testSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (27,38--27,46)"; + "let testMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (28,37--28,46)"; + "let testDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (29,38--29,46)"; + "let testModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (30,38--30,46)"; + "let testBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (31,38--31,48)"; + "let testBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (32,38--32,48)"; + "let testBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (33,38--33,48)"; + "let testShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (34,38--34,48)"; + "let testShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (35,38--35,48)"; + "let testUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (37,33--37,39)"; + "let testUnaryNotOperator(e1) = Operators.Not (e1) @ (38,32--38,38)"; + "let testAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (40,35--40,52)"; + "let testSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (41,35--41,52)"; + "let testMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (42,35--42,52)"; + "let testUnaryNegChecked(e1) = Checked.op_UnaryNegation (e1) @ (43,32--43,47)"; + "let testToByteChecked(e1) = Checked.ToByte (e1) @ (45,32--45,47)"; + "let testToSByteChecked(e1) = Checked.ToSByte (e1) @ (46,32--46,48)"; + "let testToInt16Checked(e1) = Checked.ToInt16 (e1) @ (47,32--47,48)"; + "let testToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (48,32--48,49)"; + "let testToIntChecked(e1) = Checked.ToInt (e1) @ (49,32--49,46)"; + "let testToInt32Checked(e1) = Checked.ToInt32 (e1) @ (50,32--50,48)"; + "let testToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (51,32--51,49)"; + "let testToInt64Checked(e1) = Checked.ToInt64 (e1) @ (52,32--52,48)"; + "let testToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (53,32--53,49)"; + "let testToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (54,32--54,52)"; + "let testToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (55,32--55,53)"; + "let testToByteOperator(e1) = Operators.ToByte (e1) @ (57,32--57,39)"; + "let testToSByteOperator(e1) = Operators.ToSByte (e1) @ (58,32--58,40)"; + "let testToInt16Operator(e1) = Operators.ToInt16 (e1) @ (59,32--59,40)"; + "let testToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (60,32--60,41)"; + "let testToIntOperator(e1) = Operators.ToInt (e1) @ (61,32--61,38)"; + "let testToInt32Operator(e1) = Operators.ToInt32 (e1) @ (62,32--62,40)"; + "let testToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (63,32--63,41)"; + "let testToInt64Operator(e1) = Operators.ToInt64 (e1) @ (64,32--64,40)"; + "let testToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (65,32--65,41)"; + "let testToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (66,32--66,44)"; + "let testToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (67,32--67,45)"; + "let testToSingleOperator(e1) = Operators.ToSingle (e1) @ (68,32--68,42)"; + "let testToDoubleOperator(e1) = Operators.ToDouble (e1) @ (69,32--69,40)"; + "let testToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (70,32--70,42)"; + "let testToCharOperator(e1) = Operators.ToChar (e1) @ (71,32--71,39)"; + "let testToStringOperator(e1) = Operators.ToString (e1) @ (72,32--72,41)"; + "let testByteToByte(x) = Operators.ToByte (x) @ (74,33--74,39)"; + "let testByteToSByte(x) = Operators.ToSByte (x) @ (75,33--75,40)"; + "let testByteToInt16(x) = Operators.ToInt16 (x) @ (76,33--76,40)"; + "let testByteToUInt16(x) = Operators.ToUInt16 (x) @ (77,33--77,41)"; + "let testByteToInt32(x) = Operators.ToInt (x) @ (78,33--78,38)"; + "let testByteToUInt32(x) = Operators.ToUInt32 (x) @ (79,33--79,41)"; + "let testByteToInt64(x) = Operators.ToInt64 (x) @ (80,33--80,40)"; + "let testByteToUInt64(x) = Operators.ToUInt64 (x) @ (81,33--81,41)"; + "let testByteToIntPtr(x) = Operators.ToIntPtr (x) @ (82,33--82,44)"; + "let testByteToUIntPtr(x) = Operators.ToUIntPtr (x) @ (83,33--83,45)"; + "let testByteToSingle(x) = Operators.ToSingle (x) @ (84,33--84,42)"; + "let testByteToDouble(x) = Operators.ToDouble (x) @ (85,33--85,40)"; + "let testByteToDecimal(x) = Operators.ToDecimal (x) @ (86,33--86,42)"; + "let testByteToChar(x) = Operators.ToChar (x) @ (87,33--87,39)"; + "let testByteToString(x) = Operators.ToString (x) @ (88,33--88,41)"; + "let testSByteToByte(x) = Operators.ToByte (x) @ (90,35--90,41)"; + "let testSByteToSByte(x) = Operators.ToSByte (x) @ (91,35--91,42)"; + "let testSByteToInt16(x) = Operators.ToInt16 (x) @ (92,35--92,42)"; + "let testSByteToUInt16(x) = Operators.ToUInt16 (x) @ (93,35--93,43)"; + "let testSByteToInt32(x) = Operators.ToInt (x) @ (94,35--94,40)"; + "let testSByteToUInt32(x) = Operators.ToUInt32 (x) @ (95,35--95,43)"; + "let testSByteToInt64(x) = Operators.ToInt64 (x) @ (96,35--96,42)"; + "let testSByteToUInt64(x) = Operators.ToUInt64 (x) @ (97,35--97,43)"; + "let testSByteToIntPtr(x) = Operators.ToIntPtr (x) @ (98,35--98,46)"; + "let testSByteToUIntPtr(x) = Operators.ToUIntPtr (x) @ (99,35--99,47)"; + "let testSByteToSingle(x) = Operators.ToSingle (x) @ (100,35--100,44)"; + "let testSByteToDouble(x) = Operators.ToDouble (x) @ (101,35--101,42)"; + "let testSByteToDecimal(x) = Operators.ToDecimal (x) @ (102,35--102,44)"; + "let testSByteToChar(x) = Operators.ToChar (x) @ (103,35--103,41)"; + "let testSByteToString(x) = Operators.ToString (x) @ (104,35--104,43)"; + "let testInt16ToByte(x) = Operators.ToByte (x) @ (106,35--106,41)"; + "let testInt16ToSByte(x) = Operators.ToSByte (x) @ (107,35--107,42)"; + "let testInt16ToInt16(x) = Operators.ToInt16 (x) @ (108,35--108,42)"; + "let testInt16ToUInt16(x) = Operators.ToUInt16 (x) @ (109,35--109,43)"; + "let testInt16ToInt32(x) = Operators.ToInt (x) @ (110,35--110,40)"; + "let testInt16ToUInt32(x) = Operators.ToUInt32 (x) @ (111,35--111,43)"; + "let testInt16ToInt64(x) = Operators.ToInt64 (x) @ (112,35--112,42)"; + "let testInt16ToUInt64(x) = Operators.ToUInt64 (x) @ (113,35--113,43)"; + "let testInt16ToIntPtr(x) = Operators.ToIntPtr (x) @ (114,35--114,46)"; + "let testInt16ToUIntPtr(x) = Operators.ToUIntPtr (x) @ (115,35--115,47)"; + "let testInt16ToSingle(x) = Operators.ToSingle (x) @ (116,35--116,44)"; + "let testInt16ToDouble(x) = Operators.ToDouble (x) @ (117,35--117,42)"; + "let testInt16ToDecimal(x) = Operators.ToDecimal (x) @ (118,35--118,44)"; + "let testInt16ToChar(x) = Operators.ToChar (x) @ (119,35--119,41)"; + "let testInt16ToString(x) = Operators.ToString (x) @ (120,35--120,43)"; + "let testUInt16ToByte(x) = Operators.ToByte (x) @ (122,37--122,43)"; + "let testUInt16ToSByte(x) = Operators.ToSByte (x) @ (123,37--123,44)"; + "let testUInt16ToInt16(x) = Operators.ToInt16 (x) @ (124,37--124,44)"; + "let testUInt16ToUInt16(x) = Operators.ToUInt16 (x) @ (125,37--125,45)"; + "let testUInt16ToInt32(x) = Operators.ToInt (x) @ (126,37--126,42)"; + "let testUInt16ToUInt32(x) = Operators.ToUInt32 (x) @ (127,37--127,45)"; + "let testUInt16ToInt64(x) = Operators.ToInt64 (x) @ (128,37--128,44)"; + "let testUInt16ToUInt64(x) = Operators.ToUInt64 (x) @ (129,37--129,45)"; + "let testUInt16ToIntPtr(x) = Operators.ToIntPtr (x) @ (130,37--130,48)"; + "let testUInt16ToUIntPtr(x) = Operators.ToUIntPtr (x) @ (131,37--131,49)"; + "let testUInt16ToSingle(x) = Operators.ToSingle (x) @ (132,37--132,46)"; + "let testUInt16ToDouble(x) = Operators.ToDouble (x) @ (133,37--133,44)"; + "let testUInt16ToDecimal(x) = Operators.ToDecimal (x) @ (134,37--134,46)"; + "let testUInt16ToChar(x) = Operators.ToChar (x) @ (135,37--135,43)"; + "let testUInt16ToString(x) = Operators.ToString (x) @ (136,37--136,45)"; + "let testInt32ToByte(x) = Operators.ToByte (x) @ (138,33--138,39)"; + "let testInt32ToSByte(x) = Operators.ToSByte (x) @ (139,33--139,40)"; + "let testInt32ToInt16(x) = Operators.ToInt16 (x) @ (140,33--140,40)"; + "let testInt32ToUInt16(x) = Operators.ToUInt16 (x) @ (141,33--141,41)"; + "let testInt32ToInt32(x) = Operators.ToInt (x) @ (142,33--142,38)"; + "let testInt32ToUInt32(x) = Operators.ToUInt32 (x) @ (143,33--143,41)"; + "let testInt32ToInt64(x) = Operators.ToInt64 (x) @ (144,33--144,40)"; + "let testInt32ToUInt64(x) = Operators.ToUInt64 (x) @ (145,33--145,41)"; + "let testInt32ToIntPtr(x) = Operators.ToIntPtr (x) @ (146,33--146,44)"; + "let testInt32ToUIntPtr(x) = Operators.ToUIntPtr (x) @ (147,33--147,45)"; + "let testInt32ToSingle(x) = Operators.ToSingle (x) @ (148,33--148,42)"; + "let testInt32ToDouble(x) = Operators.ToDouble (x) @ (149,33--149,40)"; + "let testInt32ToDecimal(x) = Operators.ToDecimal (x) @ (150,33--150,42)"; + "let testInt32ToChar(x) = Operators.ToChar (x) @ (151,33--151,39)"; + "let testInt32ToString(x) = Operators.ToString (x) @ (152,33--152,41)"; + "let testUInt32ToByte(x) = Operators.ToByte (x) @ (154,37--154,43)"; + "let testUInt32ToSByte(x) = Operators.ToSByte (x) @ (155,37--155,44)"; + "let testUInt32ToInt16(x) = Operators.ToInt16 (x) @ (156,37--156,44)"; + "let testUInt32ToUInt16(x) = Operators.ToUInt16 (x) @ (157,37--157,45)"; + "let testUInt32ToInt32(x) = Operators.ToInt (x) @ (158,37--158,42)"; + "let testUInt32ToUInt32(x) = Operators.ToUInt32 (x) @ (159,37--159,45)"; + "let testUInt32ToInt64(x) = Operators.ToInt64 (x) @ (160,37--160,44)"; + "let testUInt32ToUInt64(x) = Operators.ToUInt64 (x) @ (161,37--161,45)"; + "let testUInt32ToIntPtr(x) = Operators.ToIntPtr (x) @ (162,37--162,48)"; + "let testUInt32ToUIntPtr(x) = Operators.ToUIntPtr (x) @ (163,37--163,49)"; + "let testUInt32ToSingle(x) = Operators.ToSingle (x) @ (164,37--164,46)"; + "let testUInt32ToDouble(x) = Operators.ToDouble (x) @ (165,37--165,44)"; + "let testUInt32ToDecimal(x) = Operators.ToDecimal (x) @ (166,37--166,46)"; + "let testUInt32ToChar(x) = Operators.ToChar (x) @ (167,37--167,43)"; + "let testUInt32ToString(x) = Operators.ToString (x) @ (168,37--168,45)"; + "let testInt64ToByte(x) = Operators.ToByte (x) @ (170,35--170,41)"; + "let testInt64ToSByte(x) = Operators.ToSByte (x) @ (171,35--171,42)"; + "let testInt64ToInt16(x) = Operators.ToInt16 (x) @ (172,35--172,42)"; + "let testInt64ToUInt16(x) = Operators.ToUInt16 (x) @ (173,35--173,43)"; + "let testInt64ToInt32(x) = Operators.ToInt (x) @ (174,35--174,40)"; + "let testInt64ToUInt32(x) = Operators.ToUInt32 (x) @ (175,35--175,43)"; + "let testInt64ToInt64(x) = Operators.ToInt64 (x) @ (176,35--176,42)"; + "let testInt64ToUInt64(x) = Operators.ToUInt64 (x) @ (177,35--177,43)"; + "let testInt64ToIntPtr(x) = Operators.ToIntPtr (x) @ (178,35--178,46)"; + "let testInt64ToUIntPtr(x) = Operators.ToUIntPtr (x) @ (179,35--179,47)"; + "let testInt64ToSingle(x) = Operators.ToSingle (x) @ (180,35--180,44)"; + "let testInt64ToDouble(x) = Operators.ToDouble (x) @ (181,35--181,42)"; + "let testInt64ToDecimal(x) = Operators.ToDecimal (x) @ (182,35--182,44)"; + "let testInt64ToChar(x) = Operators.ToChar (x) @ (183,35--183,41)"; + "let testInt64ToString(x) = Operators.ToString (x) @ (184,35--184,43)"; + "let testUInt64ToByte(x) = Operators.ToByte (x) @ (186,37--186,43)"; + "let testUInt64ToSByte(x) = Operators.ToSByte (x) @ (187,37--187,44)"; + "let testUInt64ToInt16(x) = Operators.ToInt16 (x) @ (188,37--188,44)"; + "let testUInt64ToUInt16(x) = Operators.ToUInt16 (x) @ (189,37--189,45)"; + "let testUInt64ToInt32(x) = Operators.ToInt (x) @ (190,37--190,42)"; + "let testUInt64ToUInt32(x) = Operators.ToUInt32 (x) @ (191,37--191,45)"; + "let testUInt64ToInt64(x) = Operators.ToInt64 (x) @ (192,37--192,44)"; + "let testUInt64ToUInt64(x) = Operators.ToUInt64 (x) @ (193,37--193,45)"; + "let testUInt64ToIntPtr(x) = Operators.ToIntPtr (x) @ (194,37--194,48)"; + "let testUInt64ToUIntPtr(x) = Operators.ToUIntPtr (x) @ (195,37--195,49)"; + "let testUInt64ToSingle(x) = Operators.ToSingle (x) @ (196,37--196,46)"; + "let testUInt64ToDouble(x) = Operators.ToDouble (x) @ (197,37--197,44)"; + "let testUInt64ToDecimal(x) = Operators.ToDecimal (x) @ (198,37--198,46)"; + "let testUInt64ToChar(x) = Operators.ToChar (x) @ (199,37--199,43)"; + "let testUInt64ToString(x) = Operators.ToString (x) @ (200,37--200,45)"; + "let testIntPtrToByte(x) = Operators.ToByte (x) @ (202,40--202,46)"; + "let testIntPtrToSByte(x) = Operators.ToSByte (x) @ (203,40--203,47)"; + "let testIntPtrToInt16(x) = Operators.ToInt16 (x) @ (204,40--204,47)"; + "let testIntPtrToUInt16(x) = Operators.ToUInt16 (x) @ (205,40--205,48)"; + "let testIntPtrToInt32(x) = Operators.ToInt (x) @ (206,40--206,45)"; + "let testIntPtrToUInt32(x) = Operators.ToUInt32 (x) @ (207,40--207,48)"; + "let testIntPtrToInt64(x) = Operators.ToInt64 (x) @ (208,40--208,47)"; + "let testIntPtrToUInt64(x) = Operators.ToUInt64 (x) @ (209,40--209,48)"; + "let testIntPtrToIntPtr(x) = Operators.ToIntPtr (x) @ (210,40--210,51)"; + "let testIntPtrToUIntPtr(x) = Operators.ToUIntPtr (x) @ (211,40--211,52)"; + "let testIntPtrToSingle(x) = Operators.ToSingle (x) @ (212,40--212,49)"; + "let testIntPtrToDouble(x) = Operators.ToDouble (x) @ (213,40--213,47)"; + "let testIntPtrToDecimal(x) = Operators.ToDecimal (x) @ (214,40--214,49)"; + "let testIntPtrToChar(x) = Operators.ToChar (x) @ (215,40--215,46)"; + "let testIntPtrToString(x) = Operators.ToString (x) @ (216,40--216,48)"; + "let testUIntPtrToByte(x) = Operators.ToByte (x) @ (218,42--218,48)"; + "let testUIntPtrToSByte(x) = Operators.ToSByte (x) @ (219,42--219,49)"; + "let testUIntPtrToInt16(x) = Operators.ToInt16 (x) @ (220,42--220,49)"; + "let testUIntPtrToUInt16(x) = Operators.ToUInt16 (x) @ (221,42--221,50)"; + "let testUIntPtrToInt32(x) = Operators.ToInt (x) @ (222,42--222,47)"; + "let testUIntPtrToUInt32(x) = Operators.ToUInt32 (x) @ (223,42--223,50)"; + "let testUIntPtrToInt64(x) = Operators.ToInt64 (x) @ (224,42--224,49)"; + "let testUIntPtrToUInt64(x) = Operators.ToUInt64 (x) @ (225,42--225,50)"; + "let testUIntPtrToIntPtr(x) = Operators.ToIntPtr (x) @ (226,42--226,53)"; + "let testUIntPtrToUIntPtr(x) = Operators.ToUIntPtr (x) @ (227,42--227,54)"; + "let testUIntPtrToSingle(x) = Operators.ToSingle (x) @ (228,42--228,51)"; + "let testUIntPtrToDouble(x) = Operators.ToDouble (x) @ (229,42--229,49)"; + "let testUIntPtrToDecimal(x) = Operators.ToDecimal (x) @ (230,42--230,51)"; + "let testUIntPtrToChar(x) = Operators.ToChar (x) @ (231,42--231,48)"; + "let testUIntPtrToString(x) = Operators.ToString (x) @ (232,42--232,50)"; + "let testSingleToByte(x) = Operators.ToByte (x) @ (234,38--234,44)"; + "let testSingleToSByte(x) = Operators.ToSByte (x) @ (235,38--235,45)"; + "let testSingleToInt16(x) = Operators.ToInt16 (x) @ (236,38--236,45)"; + "let testSingleToUInt16(x) = Operators.ToUInt16 (x) @ (237,38--237,46)"; + "let testSingleToInt32(x) = Operators.ToInt (x) @ (238,38--238,43)"; + "let testSingleToUInt32(x) = Operators.ToUInt32 (x) @ (239,38--239,46)"; + "let testSingleToInt64(x) = Operators.ToInt64 (x) @ (240,38--240,45)"; + "let testSingleToUInt64(x) = Operators.ToUInt64 (x) @ (241,38--241,46)"; + "let testSingleToIntPtr(x) = Operators.ToIntPtr (x) @ (242,38--242,49)"; + "let testSingleToUIntPtr(x) = Operators.ToUIntPtr (x) @ (243,38--243,50)"; + "let testSingleToSingle(x) = Operators.ToSingle (x) @ (244,38--244,47)"; + "let testSingleToDouble(x) = Operators.ToDouble (x) @ (245,38--245,45)"; + "let testSingleToDecimal(x) = Operators.ToDecimal (x) @ (246,38--246,47)"; + "let testSingleToChar(x) = Operators.ToChar (x) @ (247,38--247,44)"; + "let testSingleToString(x) = Operators.ToString (x) @ (248,38--248,46)"; + "let testDoubleToByte(x) = Operators.ToByte (x) @ (250,36--250,42)"; + "let testDoubleToSByte(x) = Operators.ToSByte (x) @ (251,36--251,43)"; + "let testDoubleToInt16(x) = Operators.ToInt16 (x) @ (252,36--252,43)"; + "let testDoubleToUInt16(x) = Operators.ToUInt16 (x) @ (253,36--253,44)"; + "let testDoubleToInt32(x) = Operators.ToInt (x) @ (254,36--254,41)"; + "let testDoubleToUInt32(x) = Operators.ToUInt32 (x) @ (255,36--255,44)"; + "let testDoubleToInt64(x) = Operators.ToInt64 (x) @ (256,36--256,43)"; + "let testDoubleToUInt64(x) = Operators.ToUInt64 (x) @ (257,36--257,44)"; + "let testDoubleToIntPtr(x) = Operators.ToIntPtr (x) @ (258,36--258,47)"; + "let testDoubleToUIntPtr(x) = Operators.ToUIntPtr (x) @ (259,36--259,48)"; + "let testDoubleToSingle(x) = Operators.ToSingle (x) @ (260,36--260,45)"; + "let testDoubleToDouble(x) = Operators.ToDouble (x) @ (261,36--261,43)"; + "let testDoubleToDecimal(x) = Operators.ToDecimal (x) @ (262,36--262,45)"; + "let testDoubleToChar(x) = Operators.ToChar (x) @ (263,36--263,42)"; + "let testDoubleToString(x) = Operators.ToString (x) @ (264,36--264,44)"; + "let testDecimalToByte(x) = Operators.ToByte (x) @ (266,39--266,45)"; + "let testDecimalToSByte(x) = Operators.ToSByte (x) @ (267,39--267,46)"; + "let testDecimalToInt16(x) = Operators.ToInt16 (x) @ (268,39--268,46)"; + "let testDecimalToUInt16(x) = Operators.ToUInt16 (x) @ (269,39--269,47)"; + "let testDecimalToInt32(x) = Operators.ToInt (x) @ (270,39--270,44)"; + "let testDecimalToUInt32(x) = Operators.ToUInt32 (x) @ (271,39--271,47)"; + "let testDecimalToInt64(x) = Operators.ToInt64 (x) @ (272,39--272,46)"; + "let testDecimalToUInt64(x) = Operators.ToUInt64 (x) @ (273,39--273,47)"; + "let testDecimalToSingle(x) = Operators.ToSingle (x) @ (274,39--274,48)"; + "let testDecimalToDouble(x) = Operators.ToDouble (x) @ (275,39--275,46)"; + "let testDecimalToDecimal(x) = Operators.ToDecimal (x) @ (276,39--276,48)"; + "let testDecimalToChar(x) = Operators.ToChar (x) @ (277,39--277,45)"; + "let testDecimalToString(x) = Operators.ToString (x) @ (278,39--278,47)"; + "let testCharToByte(x) = Operators.ToByte (x) @ (280,33--280,39)"; + "let testCharToSByte(x) = Operators.ToSByte (x) @ (281,33--281,40)"; + "let testCharToInt16(x) = Operators.ToInt16 (x) @ (282,33--282,40)"; + "let testCharToUInt16(x) = Operators.ToUInt16 (x) @ (283,33--283,41)"; + "let testCharToInt32(x) = Operators.ToInt (x) @ (284,33--284,38)"; + "let testCharToUInt32(x) = Operators.ToUInt32 (x) @ (285,33--285,41)"; + "let testCharToInt64(x) = Operators.ToInt64 (x) @ (286,33--286,40)"; + "let testCharToUInt64(x) = Operators.ToUInt64 (x) @ (287,33--287,41)"; + "let testCharToIntPtr(x) = Operators.ToIntPtr (x) @ (288,33--288,44)"; + "let testCharToUIntPtr(x) = Operators.ToUIntPtr (x) @ (289,33--289,45)"; + "let testCharToSingle(x) = Operators.ToSingle (x) @ (290,33--290,42)"; + "let testCharToDouble(x) = Operators.ToDouble (x) @ (291,33--291,40)"; + "let testCharToChar(x) = Operators.ToChar (x) @ (292,33--292,39)"; + "let testCharToString(x) = Operators.ToString (x) @ (293,33--293,41)"; + "let testStringToByte(x) = Operators.ToByte (x) @ (295,37--295,43)"; + "let testStringToSByte(x) = Operators.ToSByte (x) @ (296,37--296,44)"; + "let testStringToInt16(x) = Operators.ToInt16 (x) @ (297,37--297,44)"; + "let testStringToUInt16(x) = Operators.ToUInt16 (x) @ (298,37--298,45)"; + "let testStringToInt32(x) = Operators.ToInt (x) @ (299,37--299,42)"; + "let testStringToUInt32(x) = Operators.ToUInt32 (x) @ (300,37--300,45)"; + "let testStringToInt64(x) = Operators.ToInt64 (x) @ (301,37--301,44)"; + "let testStringToUInt64(x) = Operators.ToUInt64 (x) @ (302,37--302,45)"; + "let testStringToSingle(x) = Operators.ToSingle (x) @ (303,37--303,46)"; + "let testStringToDouble(x) = Operators.ToDouble (x) @ (304,37--304,44)"; + "let testStringToDecimal(x) = Operators.ToDecimal (x) @ (305,37--305,46)"; + "let testStringToChar(x) = Operators.ToChar (x) @ (306,37--306,43)"; + "let testStringToString(x) = Operators.ToString (x) @ (307,37--307,45)" ] printDeclarations None (List.ofSeq file1.Declarations) |> Seq.toList @@ -929,62 +1388,285 @@ let ``Test Optimized Declarations Project1`` () = let expected2 = [ "type N"; "type IntAbbrev"; "let bool2 = False @ (6,12--6,17)"; - "let testEqualsOperator(e1) (e2) = HashCompare.GenericEqualityIntrinsic<'a> (e1,e2) @ (8,46--8,54)"; - "let testNotEqualsOperator(e1) (e2) = Operators.op_Equality (HashCompare.GenericEqualityIntrinsic<'a> (e1,e2),False) @ (9,46--9,55)"; - "let testLessThanOperator(e1) (e2) = HashCompare.GenericLessThanIntrinsic<'a> (e1,e2) @ (10,46--10,54)"; - "let testLessThanOrEqualsOperator(e1) (e2) = HashCompare.GenericLessOrEqualIntrinsic<'a> (e1,e2) @ (11,46--11,55)"; - "let testGreaterThanOperator(e1) (e2) = HashCompare.GenericGreaterThanIntrinsic<'a> (e1,e2) @ (12,46--12,54)"; - "let testGreaterThanOrEqualsOperator(e1) (e2) = HashCompare.GenericGreaterOrEqualIntrinsic<'a> (e1,e2) @ (13,46--13,55)"; - "let testAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (15,38--15,46)"; - "let testSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (16,38--16,46)"; - "let testMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (17,37--17,46)"; - "let testDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (18,38--18,46)"; - "let testModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (19,38--19,46)"; - "let testBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (20,38--20,48)"; - "let testBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (21,38--21,48)"; - "let testBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (22,38--22,48)"; - "let testShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,Operators.op_BitwiseAnd (e2,31)) @ (23,38--23,48)"; - "let testShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,Operators.op_BitwiseAnd (e2,31)) @ (24,38--24,48)"; - "let testUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (26,33--26,39)"; - "let testUnaryNotOperator(e1) = Operators.op_Equality (e1,False) @ (27,32--27,35)"; - "let testAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (29,35--29,52)"; - "let testSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (30,35--30,52)"; - "let testMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (31,35--31,52)"; - "let testUnaryNegChecked(e1) = Checked.op_Subtraction (0,e1) @ (32,32--32,47)"; - "let testToByteChecked(e1) = Checked.ToByte (e1) @ (34,31--34,46)"; - "let testToSByteChecked(e1) = Checked.ToSByte (e1) @ (35,31--35,47)"; - "let testToInt16Checked(e1) = Checked.ToInt16 (e1) @ (36,31--36,47)"; - "let testToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (37,31--37,48)"; - "let testToIntChecked(e1) = Checked.ToInt32 (e1) @ (38,31--38,45)"; - "let testToInt32Checked(e1) = Checked.ToInt32 (e1) @ (39,31--39,47)"; - "let testToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (40,31--40,48)"; - "let testToInt64Checked(e1) = Checked.ToInt64 (e1) @ (41,31--41,47)"; - "let testToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (42,31--42,48)"; - "let testToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (43,31--43,51)"; - "let testToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (44,31--44,52)"; - "let testToByteOperator(e1) = Operators.ToByte (e1) @ (46,31--46,38)"; - "let testToSByteOperator(e1) = Operators.ToSByte (e1) @ (47,31--47,39)"; - "let testToInt16Operator(e1) = Operators.ToInt16 (e1) @ (48,31--48,39)"; - "let testToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (49,31--49,40)"; - "let testToIntOperator(e1) = e1 @ (50,35--50,37)"; - "let testToInt32Operator(e1) = e1 @ (51,37--51,39)"; - "let testToUInt32Operator(e1) = e1 @ (52,31--52,40)"; - "let testToInt64Operator(e1) = Operators.ToInt64 (e1) @ (53,31--53,39)"; - "let testToUInt64Operator(e1) = Operators.ToInt64 (e1) @ (54,31--54,40)"; - "let testToSingleOperator(e1) = Operators.ToSingle (e1) @ (55,31--55,41)"; - "let testToDoubleOperator(e1) = Operators.ToDouble (e1) @ (56,31--56,39)"; - "let testToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (57,31--57,43)"; - "let testToUIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (58,31--58,44)"; - "let testHashChar(x) = Operators.op_BitwiseOr (Operators.op_LeftShift (x,16),x) @ (60,28--60,34)"; - "let testHashSByte(x) = Operators.op_ExclusiveOr (Operators.op_LeftShift (x,8),x) @ (61,30--61,36)"; - "let testHashInt16(x) = Operators.op_BitwiseOr (Operators.ToUInt16 (x),Operators.op_LeftShift (x,16)) @ (62,30--62,36)"; - "let testHashInt64(x) = Operators.op_ExclusiveOr (Operators.ToInt32 (x),Operators.ToInt32 (Operators.op_RightShift (x,32))) @ (63,30--63,36)"; - "let testHashUInt64(x) = Operators.op_ExclusiveOr (Operators.ToInt32 (x),Operators.ToInt32 (Operators.op_RightShift (x,32))) @ (64,32--64,38)"; - "let testHashIntPtr(x) = Operators.ToInt32 (Operators.ToUInt64 (x)) @ (65,35--65,41)"; - "let testHashUIntPtr(x) = Operators.op_BitwiseAnd (Operators.ToInt32 (Operators.ToUInt64 (x)),2147483647) @ (66,37--66,43)"; - "let testHashString(x) = (if Operators.op_Equality (x,dflt) then 0 else Operators.Hash (x)) @ (68,32--68,38)"; - "let testDualConv(x) = Operators.ToSingle (Operators.ToDouble (x)) @ (69,28--69,38)"; - "let testTypeOf(x) = Operators.TypeOf<'T> () @ (70,24--70,30)" ] + "let testHashChar(x) = Operators.op_BitwiseOr (Operators.op_LeftShift (x,16),x) @ (8,28--8,34)"; + "let testHashSByte(x) = Operators.op_ExclusiveOr (Operators.op_LeftShift (x,8),x) @ (9,30--9,36)"; + "let testHashInt16(x) = Operators.op_BitwiseOr (Operators.ToUInt16 (x),Operators.op_LeftShift (x,16)) @ (10,30--10,36)"; + "let testHashInt64(x) = Operators.op_ExclusiveOr (Operators.ToInt32 (x),Operators.ToInt32 (Operators.op_RightShift (x,32))) @ (11,30--11,36)"; + "let testHashUInt64(x) = Operators.op_ExclusiveOr (Operators.ToInt32 (x),Operators.ToInt32 (Operators.op_RightShift (x,32))) @ (12,32--12,38)"; + "let testHashIntPtr(x) = Operators.ToInt32 (Operators.ToUInt64 (x)) @ (13,35--13,41)"; + "let testHashUIntPtr(x) = Operators.op_BitwiseAnd (Operators.ToInt32 (Operators.ToUInt64 (x)),2147483647) @ (14,37--14,43)"; + "let testHashString(x) = (if Operators.op_Equality (x,dflt) then 0 else Operators.Hash (x)) @ (16,32--16,38)"; + "let testTypeOf(x) = Operators.TypeOf<'T> () @ (17,24--17,30)"; + "let testEqualsOperator(e1) (e2) = HashCompare.GenericEqualityIntrinsic<'a> (e1,e2) @ (19,46--19,54)"; + "let testNotEqualsOperator(e1) (e2) = Operators.op_Equality (HashCompare.GenericEqualityIntrinsic<'a> (e1,e2),False) @ (20,46--20,55)"; + "let testLessThanOperator(e1) (e2) = HashCompare.GenericLessThanIntrinsic<'a> (e1,e2) @ (21,46--21,54)"; + "let testLessThanOrEqualsOperator(e1) (e2) = HashCompare.GenericLessOrEqualIntrinsic<'a> (e1,e2) @ (22,46--22,55)"; + "let testGreaterThanOperator(e1) (e2) = HashCompare.GenericGreaterThanIntrinsic<'a> (e1,e2) @ (23,46--23,54)"; + "let testGreaterThanOrEqualsOperator(e1) (e2) = HashCompare.GenericGreaterOrEqualIntrinsic<'a> (e1,e2) @ (24,46--24,55)"; + "let testAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (26,38--26,46)"; + "let testSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (27,38--27,46)"; + "let testMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (28,37--28,46)"; + "let testDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (29,38--29,46)"; + "let testModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (30,38--30,46)"; + "let testBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (31,38--31,48)"; + "let testBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (32,38--32,48)"; + "let testBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (33,38--33,48)"; + "let testShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,Operators.op_BitwiseAnd (e2,31)) @ (34,38--34,48)"; + "let testShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,Operators.op_BitwiseAnd (e2,31)) @ (35,38--35,48)"; + "let testUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (37,33--37,39)"; + "let testUnaryNotOperator(e1) = Operators.op_Equality (e1,False) @ (38,32--38,35)"; + "let testAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (40,35--40,52)"; + "let testSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (41,35--41,52)"; + "let testMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (42,35--42,52)"; + "let testUnaryNegChecked(e1) = Checked.op_Subtraction (0,e1) @ (43,32--43,47)"; + "let testToByteChecked(e1) = Checked.ToByte (e1) @ (45,32--45,47)"; + "let testToSByteChecked(e1) = Checked.ToSByte (e1) @ (46,32--46,48)"; + "let testToInt16Checked(e1) = Checked.ToInt16 (e1) @ (47,32--47,48)"; + "let testToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (48,32--48,49)"; + "let testToIntChecked(e1) = Checked.ToInt32 (e1) @ (49,32--49,46)"; + "let testToInt32Checked(e1) = Checked.ToInt32 (e1) @ (50,32--50,48)"; + "let testToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (51,32--51,49)"; + "let testToInt64Checked(e1) = Checked.ToInt64 (e1) @ (52,32--52,48)"; + "let testToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (53,32--53,49)"; + "let testToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (54,32--54,52)"; + "let testToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (55,32--55,53)"; + "let testToByteOperator(e1) = Operators.ToByte (e1) @ (57,32--57,39)"; + "let testToSByteOperator(e1) = Operators.ToSByte (e1) @ (58,32--58,40)"; + "let testToInt16Operator(e1) = Operators.ToInt16 (e1) @ (59,32--59,40)"; + "let testToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (60,32--60,41)"; + "let testToIntOperator(e1) = e1 @ (61,36--61,38)"; + "let testToInt32Operator(e1) = e1 @ (62,38--62,40)"; + "let testToUInt32Operator(e1) = e1 @ (63,32--63,41)"; + "let testToInt64Operator(e1) = Operators.ToInt64 (e1) @ (64,32--64,40)"; + "let testToUInt64Operator(e1) = Operators.ToInt64 (e1) @ (65,32--65,41)"; + "let testToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (66,32--66,44)"; + "let testToUIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (67,32--67,45)"; + "let testToSingleOperator(e1) = Operators.ToSingle (e1) @ (68,32--68,42)"; + "let testToDoubleOperator(e1) = Operators.ToDouble (e1) @ (69,32--69,40)"; + "let testToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (70,32--70,42)"; + "let testToCharOperator(e1) = Operators.ToUInt16 (e1) @ (71,32--71,39)"; + "let testToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (72,32--72,41)"; + "let testByteToByte(x) = Operators.ToByte (x) @ (74,33--74,39)"; + "let testByteToSByte(x) = Operators.ToSByte (x) @ (75,33--75,40)"; + "let testByteToInt16(x) = Operators.ToInt16 (x) @ (76,33--76,40)"; + "let testByteToUInt16(x) = Operators.ToUInt16 (x) @ (77,33--77,41)"; + "let testByteToInt32(x) = Operators.ToInt32 (x) @ (78,33--78,38)"; + "let testByteToUInt32(x) = Operators.ToUInt32 (x) @ (79,33--79,41)"; + "let testByteToInt64(x) = Operators.ToUInt64 (x) @ (80,33--80,40)"; + "let testByteToUInt64(x) = Operators.ToUInt64 (x) @ (81,33--81,41)"; + "let testByteToIntPtr(x) = Operators.ToIntPtr (x) @ (82,33--82,44)"; + "let testByteToUIntPtr(x) = Operators.ToUIntPtr (x) @ (83,33--83,45)"; + "let testByteToSingle(x) = Operators.ToSingle (Operators.ToDouble (x)) @ (84,33--84,42)"; + "let testByteToDouble(x) = Operators.ToDouble (Operators.ToDouble (x)) @ (85,33--85,40)"; + "let testByteToDecimal(x) = Convert.ToDecimal (x) @ (86,33--86,42)"; + "let testByteToChar(x) = Operators.ToUInt16 (x) @ (87,33--87,39)"; + "let testByteToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (88,33--88,41)"; + "let testSByteToByte(x) = Operators.ToByte (x) @ (90,35--90,41)"; + "let testSByteToSByte(x) = Operators.ToSByte (x) @ (91,35--91,42)"; + "let testSByteToInt16(x) = Operators.ToInt16 (x) @ (92,35--92,42)"; + "let testSByteToUInt16(x) = Operators.ToUInt16 (x) @ (93,35--93,43)"; + "let testSByteToInt32(x) = x @ (94,35--94,40)"; + "let testSByteToUInt32(x) = x @ (95,35--95,43)"; + "let testSByteToInt64(x) = Operators.ToInt64 (x) @ (96,35--96,42)"; + "let testSByteToUInt64(x) = Operators.ToInt64 (x) @ (97,35--97,43)"; + "let testSByteToIntPtr(x) = Operators.ToIntPtr (x) @ (98,35--98,46)"; + "let testSByteToUIntPtr(x) = Operators.ToIntPtr (x) @ (99,35--99,47)"; + "let testSByteToSingle(x) = Operators.ToSingle (x) @ (100,35--100,44)"; + "let testSByteToDouble(x) = Operators.ToDouble (x) @ (101,35--101,42)"; + "let testSByteToDecimal(x) = Convert.ToDecimal (x) @ (102,35--102,44)"; + "let testSByteToChar(x) = Operators.ToUInt16 (x) @ (103,35--103,41)"; + "let testSByteToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (104,35--104,43)"; + "let testInt16ToByte(x) = Operators.ToByte (x) @ (106,35--106,41)"; + "let testInt16ToSByte(x) = Operators.ToSByte (x) @ (107,35--107,42)"; + "let testInt16ToInt16(x) = Operators.ToInt16 (x) @ (108,35--108,42)"; + "let testInt16ToUInt16(x) = Operators.ToUInt16 (x) @ (109,35--109,43)"; + "let testInt16ToInt32(x) = x @ (110,35--110,40)"; + "let testInt16ToUInt32(x) = x @ (111,35--111,43)"; + "let testInt16ToInt64(x) = Operators.ToInt64 (x) @ (112,35--112,42)"; + "let testInt16ToUInt64(x) = Operators.ToInt64 (x) @ (113,35--113,43)"; + "let testInt16ToIntPtr(x) = Operators.ToIntPtr (x) @ (114,35--114,46)"; + "let testInt16ToUIntPtr(x) = Operators.ToIntPtr (x) @ (115,35--115,47)"; + "let testInt16ToSingle(x) = Operators.ToSingle (x) @ (116,35--116,44)"; + "let testInt16ToDouble(x) = Operators.ToDouble (x) @ (117,35--117,42)"; + "let testInt16ToDecimal(x) = Convert.ToDecimal (x) @ (118,35--118,44)"; + "let testInt16ToChar(x) = Operators.ToUInt16 (x) @ (119,35--119,41)"; + "let testInt16ToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (120,35--120,43)"; + "let testUInt16ToByte(x) = Operators.ToByte (x) @ (122,37--122,43)"; + "let testUInt16ToSByte(x) = Operators.ToSByte (x) @ (123,37--123,44)"; + "let testUInt16ToInt16(x) = Operators.ToInt16 (x) @ (124,37--124,44)"; + "let testUInt16ToUInt16(x) = Operators.ToUInt16 (x) @ (125,37--125,45)"; + "let testUInt16ToInt32(x) = Operators.ToInt32 (x) @ (126,37--126,42)"; + "let testUInt16ToUInt32(x) = Operators.ToUInt32 (x) @ (127,37--127,45)"; + "let testUInt16ToInt64(x) = Operators.ToUInt64 (x) @ (128,37--128,44)"; + "let testUInt16ToUInt64(x) = Operators.ToUInt64 (x) @ (129,37--129,45)"; + "let testUInt16ToIntPtr(x) = Operators.ToUIntPtr (x) @ (130,37--130,48)"; + "let testUInt16ToUIntPtr(x) = Operators.ToUIntPtr (x) @ (131,37--131,49)"; + "let testUInt16ToSingle(x) = Operators.ToSingle (Operators.ToDouble (x)) @ (132,37--132,46)"; + "let testUInt16ToDouble(x) = Operators.ToDouble (Operators.ToDouble (x)) @ (133,37--133,44)"; + "let testUInt16ToDecimal(x) = Convert.ToDecimal (x) @ (134,37--134,46)"; + "let testUInt16ToChar(x) = Operators.ToUInt16 (x) @ (135,37--135,43)"; + "let testUInt16ToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (136,37--136,45)"; + "let testInt32ToByte(x) = Operators.ToByte (x) @ (138,33--138,39)"; + "let testInt32ToSByte(x) = Operators.ToSByte (x) @ (139,33--139,40)"; + "let testInt32ToInt16(x) = Operators.ToInt16 (x) @ (140,33--140,40)"; + "let testInt32ToUInt16(x) = Operators.ToUInt16 (x) @ (141,33--141,41)"; + "let testInt32ToInt32(x) = x @ (142,37--142,38)"; + "let testInt32ToUInt32(x) = x @ (143,33--143,41)"; + "let testInt32ToInt64(x) = Operators.ToInt64 (x) @ (144,33--144,40)"; + "let testInt32ToUInt64(x) = Operators.ToInt64 (x) @ (145,33--145,41)"; + "let testInt32ToIntPtr(x) = Operators.ToIntPtr (x) @ (146,33--146,44)"; + "let testInt32ToUIntPtr(x) = Operators.ToIntPtr (x) @ (147,33--147,45)"; + "let testInt32ToSingle(x) = Operators.ToSingle (x) @ (148,33--148,42)"; + "let testInt32ToDouble(x) = Operators.ToDouble (x) @ (149,33--149,40)"; + "let testInt32ToDecimal(x) = Convert.ToDecimal (x) @ (150,33--150,42)"; + "let testInt32ToChar(x) = Operators.ToUInt16 (x) @ (151,33--151,39)"; + "let testInt32ToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (152,33--152,41)"; + "let testUInt32ToByte(x) = Operators.ToByte (x) @ (154,37--154,43)"; + "let testUInt32ToSByte(x) = Operators.ToSByte (x) @ (155,37--155,44)"; + "let testUInt32ToInt16(x) = Operators.ToInt16 (x) @ (156,37--156,44)"; + "let testUInt32ToUInt16(x) = Operators.ToUInt16 (x) @ (157,37--157,45)"; + "let testUInt32ToInt32(x) = x @ (158,37--158,42)"; + "let testUInt32ToUInt32(x) = Operators.ToUInt32 (x) @ (159,37--159,45)"; + "let testUInt32ToInt64(x) = Operators.ToUInt64 (x) @ (160,37--160,44)"; + "let testUInt32ToUInt64(x) = Operators.ToUInt64 (x) @ (161,37--161,45)"; + "let testUInt32ToIntPtr(x) = Operators.ToUIntPtr (x) @ (162,37--162,48)"; + "let testUInt32ToUIntPtr(x) = Operators.ToUIntPtr (x) @ (163,37--163,49)"; + "let testUInt32ToSingle(x) = Operators.ToSingle (Operators.ToDouble (x)) @ (164,37--164,46)"; + "let testUInt32ToDouble(x) = Operators.ToDouble (Operators.ToDouble (x)) @ (165,37--165,44)"; + "let testUInt32ToDecimal(x) = Convert.ToDecimal (x) @ (166,37--166,46)"; + "let testUInt32ToChar(x) = Operators.ToUInt16 (x) @ (167,37--167,43)"; + "let testUInt32ToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (168,37--168,45)"; + "let testInt64ToByte(x) = Operators.ToByte (x) @ (170,35--170,41)"; + "let testInt64ToSByte(x) = Operators.ToSByte (x) @ (171,35--171,42)"; + "let testInt64ToInt16(x) = Operators.ToInt16 (x) @ (172,35--172,42)"; + "let testInt64ToUInt16(x) = Operators.ToUInt16 (x) @ (173,35--173,43)"; + "let testInt64ToInt32(x) = Operators.ToInt32 (x) @ (174,35--174,40)"; + "let testInt64ToUInt32(x) = Operators.ToUInt32 (x) @ (175,35--175,43)"; + "let testInt64ToInt64(x) = Operators.ToInt64 (x) @ (176,35--176,42)"; + "let testInt64ToUInt64(x) = x @ (177,35--177,43)"; + "let testInt64ToIntPtr(x) = Operators.ToIntPtr (x) @ (178,35--178,46)"; + "let testInt64ToUIntPtr(x) = Operators.ToIntPtr (x) @ (179,35--179,47)"; + "let testInt64ToSingle(x) = Operators.ToSingle (x) @ (180,35--180,44)"; + "let testInt64ToDouble(x) = Operators.ToDouble (x) @ (181,35--181,42)"; + "let testInt64ToDecimal(x) = Convert.ToDecimal (x) @ (182,35--182,44)"; + "let testInt64ToChar(x) = Operators.ToUInt16 (x) @ (183,35--183,41)"; + "let testInt64ToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (184,35--184,43)"; + "let testUInt64ToByte(x) = Operators.ToByte (x) @ (186,37--186,43)"; + "let testUInt64ToSByte(x) = Operators.ToSByte (x) @ (187,37--187,44)"; + "let testUInt64ToInt16(x) = Operators.ToInt16 (x) @ (188,37--188,44)"; + "let testUInt64ToUInt16(x) = Operators.ToUInt16 (x) @ (189,37--189,45)"; + "let testUInt64ToInt32(x) = Operators.ToInt32 (x) @ (190,37--190,42)"; + "let testUInt64ToUInt32(x) = Operators.ToUInt32 (x) @ (191,37--191,45)"; + "let testUInt64ToInt64(x) = x @ (192,37--192,44)"; + "let testUInt64ToUInt64(x) = x @ (193,44--193,45)"; + "let testUInt64ToIntPtr(x) = Operators.ToUIntPtr (x) @ (194,37--194,48)"; + "let testUInt64ToUIntPtr(x) = Operators.ToUIntPtr (x) @ (195,37--195,49)"; + "let testUInt64ToSingle(x) = Operators.ToSingle (Operators.ToDouble (x)) @ (196,37--196,46)"; + "let testUInt64ToDouble(x) = Operators.ToDouble (Operators.ToDouble (x)) @ (197,37--197,44)"; + "let testUInt64ToDecimal(x) = Convert.ToDecimal (x) @ (198,37--198,46)"; + "let testUInt64ToChar(x) = Operators.ToUInt16 (x) @ (199,37--199,43)"; + "let testUInt64ToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (200,37--200,45)"; + "let testIntPtrToByte(x) = Operators.ToByte (x) @ (202,40--202,46)"; + "let testIntPtrToSByte(x) = Operators.ToSByte (x) @ (203,40--203,47)"; + "let testIntPtrToInt16(x) = Operators.ToInt16 (x) @ (204,40--204,47)"; + "let testIntPtrToUInt16(x) = Operators.ToUInt16 (x) @ (205,40--205,48)"; + "let testIntPtrToInt32(x) = Operators.ToInt32 (x) @ (206,40--206,45)"; + "let testIntPtrToUInt32(x) = Operators.ToUInt32 (x) @ (207,40--207,48)"; + "let testIntPtrToInt64(x) = Operators.ToInt64 (x) @ (208,40--208,47)"; + "let testIntPtrToUInt64(x) = Operators.ToInt64 (x) @ (209,40--209,48)"; + "let testIntPtrToIntPtr(x) = Operators.ToIntPtr (x) @ (210,40--210,51)"; + "let testIntPtrToUIntPtr(x) = x @ (211,40--211,52)"; + "let testIntPtrToSingle(x) = Operators.ToSingle (x) @ (212,40--212,49)"; + "let testIntPtrToDouble(x) = Operators.ToDouble (x) @ (213,40--213,47)"; + "let testIntPtrToDecimal(x) = Convert.ToDecimal (Operators.ToInt64 (x)) @ (214,40--214,49)"; + "let testIntPtrToChar(x) = Operators.ToUInt16 (x) @ (215,40--215,46)"; + "let testIntPtrToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (216,40--216,48)"; + "let testUIntPtrToByte(x) = Operators.ToByte (x) @ (218,42--218,48)"; + "let testUIntPtrToSByte(x) = Operators.ToSByte (x) @ (219,42--219,49)"; + "let testUIntPtrToInt16(x) = Operators.ToInt16 (x) @ (220,42--220,49)"; + "let testUIntPtrToUInt16(x) = Operators.ToUInt16 (x) @ (221,42--221,50)"; + "let testUIntPtrToInt32(x) = Operators.ToInt32 (x) @ (222,42--222,47)"; + "let testUIntPtrToUInt32(x) = Operators.ToUInt32 (x) @ (223,42--223,50)"; + "let testUIntPtrToInt64(x) = Operators.ToUInt64 (x) @ (224,42--224,49)"; + "let testUIntPtrToUInt64(x) = Operators.ToUInt64 (x) @ (225,42--225,50)"; + "let testUIntPtrToIntPtr(x) = x @ (226,42--226,53)"; + "let testUIntPtrToUIntPtr(x) = x @ (227,53--227,54)"; + "let testUIntPtrToSingle(x) = Operators.ToSingle (Operators.ToDouble (x)) @ (228,42--228,51)"; + "let testUIntPtrToDouble(x) = Operators.ToDouble (Operators.ToDouble (x)) @ (229,42--229,49)"; + "let testUIntPtrToDecimal(x) = Convert.ToDecimal (Operators.ToUInt64 (x)) @ (230,42--230,51)"; + "let testUIntPtrToChar(x) = Operators.ToUInt16 (x) @ (231,42--231,48)"; + "let testUIntPtrToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (232,42--232,50)"; + "let testSingleToByte(x) = Operators.ToByte (x) @ (234,38--234,44)"; + "let testSingleToSByte(x) = Operators.ToSByte (x) @ (235,38--235,45)"; + "let testSingleToInt16(x) = Operators.ToInt16 (x) @ (236,38--236,45)"; + "let testSingleToUInt16(x) = Operators.ToUInt16 (x) @ (237,38--237,46)"; + "let testSingleToInt32(x) = Operators.ToInt32 (x) @ (238,38--238,43)"; + "let testSingleToUInt32(x) = Operators.ToUInt32 (x) @ (239,38--239,46)"; + "let testSingleToInt64(x) = Operators.ToInt64 (x) @ (240,38--240,45)"; + "let testSingleToUInt64(x) = Operators.ToUInt64 (x) @ (241,38--241,46)"; + "let testSingleToIntPtr(x) = Operators.ToIntPtr (x) @ (242,38--242,49)"; + "let testSingleToUIntPtr(x) = Operators.ToUIntPtr (x) @ (243,38--243,50)"; + "let testSingleToSingle(x) = Operators.ToSingle (x) @ (244,38--244,47)"; + "let testSingleToDouble(x) = Operators.ToDouble (x) @ (245,38--245,45)"; + "let testSingleToDecimal(x) = Convert.ToDecimal (x) @ (246,38--246,47)"; + "let testSingleToChar(x) = Operators.ToUInt16 (x) @ (247,38--247,44)"; + "let testSingleToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (248,38--248,46)"; + "let testDoubleToByte(x) = Operators.ToByte (x) @ (250,36--250,42)"; + "let testDoubleToSByte(x) = Operators.ToSByte (x) @ (251,36--251,43)"; + "let testDoubleToInt16(x) = Operators.ToInt16 (x) @ (252,36--252,43)"; + "let testDoubleToUInt16(x) = Operators.ToUInt16 (x) @ (253,36--253,44)"; + "let testDoubleToInt32(x) = Operators.ToInt32 (x) @ (254,36--254,41)"; + "let testDoubleToUInt32(x) = Operators.ToUInt32 (x) @ (255,36--255,44)"; + "let testDoubleToInt64(x) = Operators.ToInt64 (x) @ (256,36--256,43)"; + "let testDoubleToUInt64(x) = Operators.ToUInt64 (x) @ (257,36--257,44)"; + "let testDoubleToIntPtr(x) = Operators.ToIntPtr (x) @ (258,36--258,47)"; + "let testDoubleToUIntPtr(x) = Operators.ToUIntPtr (x) @ (259,36--259,48)"; + "let testDoubleToSingle(x) = Operators.ToSingle (x) @ (260,36--260,45)"; + "let testDoubleToDouble(x) = Operators.ToDouble (x) @ (261,36--261,43)"; + "let testDoubleToDecimal(x) = Convert.ToDecimal (x) @ (262,36--262,45)"; + "let testDoubleToChar(x) = Operators.ToUInt16 (x) @ (263,36--263,42)"; + "let testDoubleToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (264,36--264,44)"; + "let testDecimalToByte(x) = Decimal.op_Explicit (x) @ (266,39--266,45)"; + "let testDecimalToSByte(x) = Decimal.op_Explicit (x) @ (267,39--267,46)"; + "let testDecimalToInt16(x) = Decimal.op_Explicit (x) @ (268,39--268,46)"; + "let testDecimalToUInt16(x) = Decimal.op_Explicit (x) @ (269,39--269,47)"; + "let testDecimalToInt32(x) = Decimal.op_Explicit (x) @ (270,39--270,44)"; + "let testDecimalToUInt32(x) = Decimal.op_Explicit (x) @ (271,39--271,47)"; + "let testDecimalToInt64(x) = Decimal.op_Explicit (x) @ (272,39--272,46)"; + "let testDecimalToUInt64(x) = Decimal.op_Explicit (x) @ (273,39--273,47)"; + "let testDecimalToSingle(x) = Decimal.op_Explicit (x) @ (274,39--274,48)"; + "let testDecimalToDouble(x) = Convert.ToDouble (x) @ (275,39--275,46)"; + "let testDecimalToDecimal(x) = x @ (276,47--276,48)"; + "let testDecimalToChar(x) = Decimal.op_Explicit (x) @ (277,39--277,45)"; + "let testDecimalToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (278,39--278,47)"; + "let testCharToByte(x) = Operators.ToByte (x) @ (280,33--280,39)"; + "let testCharToSByte(x) = Operators.ToSByte (x) @ (281,33--281,40)"; + "let testCharToInt16(x) = Operators.ToInt16 (x) @ (282,33--282,40)"; + "let testCharToUInt16(x) = Operators.ToUInt16 (x) @ (283,33--283,41)"; + "let testCharToInt32(x) = Operators.ToInt32 (x) @ (284,33--284,38)"; + "let testCharToUInt32(x) = Operators.ToUInt32 (x) @ (285,33--285,41)"; + "let testCharToInt64(x) = Operators.ToUInt64 (x) @ (286,33--286,40)"; + "let testCharToUInt64(x) = Operators.ToUInt64 (x) @ (287,33--287,41)"; + "let testCharToIntPtr(x) = Operators.ToUIntPtr (x) @ (288,33--288,44)"; + "let testCharToUIntPtr(x) = Operators.ToUIntPtr (x) @ (289,33--289,45)"; + "let testCharToSingle(x) = Operators.ToSingle (Operators.ToDouble (x)) @ (290,33--290,42)"; + "let testCharToDouble(x) = Operators.ToDouble (Operators.ToDouble (x)) @ (291,33--291,40)"; + "let testCharToChar(x) = Operators.ToUInt16 (x) @ (292,33--292,39)"; + "let testCharToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (293,33--293,41)"; + "let testStringToByte(x) = Checked.ToByte (LanguagePrimitives.ParseUInt32 (x)) @ (295,37--295,43)"; + "let testStringToSByte(x) = Checked.ToSByte (LanguagePrimitives.ParseInt32 (x)) @ (296,37--296,44)"; + "let testStringToInt16(x) = Checked.ToInt16 (LanguagePrimitives.ParseInt32 (x)) @ (297,37--297,44)"; + "let testStringToUInt16(x) = Checked.ToUInt16 (LanguagePrimitives.ParseUInt32 (x)) @ (298,37--298,45)"; + "let testStringToInt32(x) = LanguagePrimitives.ParseInt32 (x) @ (299,37--299,42)"; + "let testStringToUInt32(x) = LanguagePrimitives.ParseUInt32 (x) @ (300,37--300,45)"; + "let testStringToInt64(x) = LanguagePrimitives.ParseInt64 (x) @ (301,37--301,44)"; + "let testStringToUInt64(x) = LanguagePrimitives.ParseUInt64 (x) @ (302,37--302,45)"; + "let testStringToSingle(x) = Single.Parse ((if Operators.op_Equality (x,dflt) then dflt else x.Replace(\"_\",\"\")),167,CultureInfo.get_InvariantCulture () :> System.IFormatProvider) @ (303,37--303,46)"; + "let testStringToDouble(x) = Double.Parse ((if Operators.op_Equality (x,dflt) then dflt else x.Replace(\"_\",\"\")),167,CultureInfo.get_InvariantCulture () :> System.IFormatProvider) @ (304,37--304,44)"; + "let testStringToDecimal(x) = Decimal.Parse (x,167,CultureInfo.get_InvariantCulture () :> System.IFormatProvider) @ (305,37--305,46)"; + "let testStringToChar(x) = Char.Parse (x) @ (306,37--306,43)"; + "let testStringToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (307,37--307,45)" ] + // printFSharpDecls "" file2.Declarations |> Seq.iter (printfn "%s") From a8dd212532c7d764abef775e2acf6e4cb97cce3c Mon Sep 17 00:00:00 2001 From: ncave <777696+ncave@users.noreply.github.com> Date: Fri, 9 Feb 2018 15:47:35 -0800 Subject: [PATCH 19/21] added more tests --- tests/service/Common.fs | 6 +- tests/service/ExprTests.fs | 3000 ++++++++++++++++++++++++------------ 2 files changed, 1991 insertions(+), 1015 deletions(-) diff --git a/tests/service/Common.fs b/tests/service/Common.fs index e3378e77b43..b00ab51e5db 100644 --- a/tests/service/Common.fs +++ b/tests/service/Common.fs @@ -112,7 +112,7 @@ let mkStandardProjectReferences () = yield fsCoreDefaultReference() ] #endif -let mkProjectCommandLineArgs (dllName, fileNames) = +let mkProjectCommandLineArgsSilent (dllName, fileNames) = let args = [| yield "--simpleresolution" yield "--noframework" @@ -134,6 +134,10 @@ let mkProjectCommandLineArgs (dllName, fileNames) = for r in references do yield "-r:" + r |] + args + +let mkProjectCommandLineArgs (dllName, fileNames) = + let args = mkProjectCommandLineArgsSilent (dllName, fileNames) printfn "dllName = %A, args = %A" dllName args args diff --git a/tests/service/ExprTests.fs b/tests/service/ExprTests.fs index 91f1da5e824..b013ee83920 100644 --- a/tests/service/ExprTests.fs +++ b/tests/service/ExprTests.fs @@ -557,306 +557,76 @@ let testHashUIntPtr (x:unativeint) = hash x let testHashString (x:string) = hash x let testTypeOf (x:'T) = typeof<'T> -let testEqualsOperator e1 e2 = (=) e1 e2 -let testNotEqualsOperator e1 e2 = (<>) e1 e2 -let testLessThanOperator e1 e2 = (<) e1 e2 -let testLessThanOrEqualsOperator e1 e2 = (<=) e1 e2 -let testGreaterThanOperator e1 e2 = (>) e1 e2 -let testGreaterThanOrEqualsOperator e1 e2 = (>=) e1 e2 - -let testAdditionOperator e1 e2 = (+) e1 e2 -let testSubtractionOperator e1 e2 = (-) e1 e2 -let testMultiplyOperator e1 e2 = (*) e1 e2 -let testDivisionOperator e1 e2 = (/) e1 e2 -let testModulusOperator e1 e2 = (%) e1 e2 -let testBitwiseAndOperator e1 e2 = (&&&) e1 e2 -let testBitwiseOrOperator e1 e2 = (|||) e1 e2 -let testBitwiseXorOperator e1 e2 = (^^^) e1 e2 -let testShiftLeftOperator e1 e2 = (<<<) e1 e2 -let testShiftRightOperator e1 e2 = (>>>) e1 e2 - -let testUnaryNegOperator e1 = (~-) e1 -let testUnaryNotOperator e1 = not e1 - -let testAdditionChecked e1 e2 = Checked.(+) e1 e2 -let testSubtractionChecked e1 e2 = Checked.(-) e1 e2 -let testMultiplyChecked e1 e2 = Checked.(*) e1 e2 -let testUnaryNegChecked e1 = Checked.(~-) e1 - -let testToByteChecked e1 = Checked.byte e1 -let testToSByteChecked e1 = Checked.sbyte e1 -let testToInt16Checked e1 = Checked.int16 e1 -let testToUInt16Checked e1 = Checked.uint16 e1 -let testToIntChecked e1 = Checked.int e1 -let testToInt32Checked e1 = Checked.int32 e1 -let testToUInt32Checked e1 = Checked.uint32 e1 -let testToInt64Checked e1 = Checked.int64 e1 -let testToUInt64Checked e1 = Checked.uint64 e1 -let testToIntPtrChecked e1 = Checked.nativeint e1 -let testToUIntPtrChecked e1 = Checked.unativeint e1 - -let testToByteOperator e1 = byte e1 -let testToSByteOperator e1 = sbyte e1 -let testToInt16Operator e1 = int16 e1 -let testToUInt16Operator e1 = uint16 e1 -let testToIntOperator e1 = int e1 -let testToInt32Operator e1 = int32 e1 -let testToUInt32Operator e1 = uint32 e1 -let testToInt64Operator e1 = int64 e1 -let testToUInt64Operator e1 = uint64 e1 -let testToIntPtrOperator e1 = nativeint e1 -let testToUIntPtrOperator e1 = unativeint e1 -let testToSingleOperator e1 = float32 e1 -let testToDoubleOperator e1 = float e1 -let testToDecimalOperator e1 = decimal e1 -let testToCharOperator e1 = char e1 -let testToStringOperator e1 = string e1 - -let testByteToByte (x:byte) = byte x -let testByteToSByte (x:byte) = sbyte x -let testByteToInt16 (x:byte) = int16 x -let testByteToUInt16 (x:byte) = uint16 x -let testByteToInt32 (x:byte) = int x -let testByteToUInt32 (x:byte) = uint32 x -let testByteToInt64 (x:byte) = int64 x -let testByteToUInt64 (x:byte) = uint64 x -let testByteToIntPtr (x:byte) = nativeint x -let testByteToUIntPtr (x:byte) = unativeint x -let testByteToSingle (x:byte) = float32 x -let testByteToDouble (x:byte) = float x -let testByteToDecimal (x:byte) = decimal x -let testByteToChar (x:byte) = char x -let testByteToString (x:byte) = string x - -let testSByteToByte (x:sbyte) = byte x -let testSByteToSByte (x:sbyte) = sbyte x -let testSByteToInt16 (x:sbyte) = int16 x -let testSByteToUInt16 (x:sbyte) = uint16 x -let testSByteToInt32 (x:sbyte) = int x -let testSByteToUInt32 (x:sbyte) = uint32 x -let testSByteToInt64 (x:sbyte) = int64 x -let testSByteToUInt64 (x:sbyte) = uint64 x -let testSByteToIntPtr (x:sbyte) = nativeint x -let testSByteToUIntPtr (x:sbyte) = unativeint x -let testSByteToSingle (x:sbyte) = float32 x -let testSByteToDouble (x:sbyte) = float x -let testSByteToDecimal (x:sbyte) = decimal x -let testSByteToChar (x:sbyte) = char x -let testSByteToString (x:sbyte) = string x - -let testInt16ToByte (x:int16) = byte x -let testInt16ToSByte (x:int16) = sbyte x -let testInt16ToInt16 (x:int16) = int16 x -let testInt16ToUInt16 (x:int16) = uint16 x -let testInt16ToInt32 (x:int16) = int x -let testInt16ToUInt32 (x:int16) = uint32 x -let testInt16ToInt64 (x:int16) = int64 x -let testInt16ToUInt64 (x:int16) = uint64 x -let testInt16ToIntPtr (x:int16) = nativeint x -let testInt16ToUIntPtr (x:int16) = unativeint x -let testInt16ToSingle (x:int16) = float32 x -let testInt16ToDouble (x:int16) = float x -let testInt16ToDecimal (x:int16) = decimal x -let testInt16ToChar (x:int16) = char x -let testInt16ToString (x:int16) = string x - -let testUInt16ToByte (x:uint16) = byte x -let testUInt16ToSByte (x:uint16) = sbyte x -let testUInt16ToInt16 (x:uint16) = int16 x -let testUInt16ToUInt16 (x:uint16) = uint16 x -let testUInt16ToInt32 (x:uint16) = int x -let testUInt16ToUInt32 (x:uint16) = uint32 x -let testUInt16ToInt64 (x:uint16) = int64 x -let testUInt16ToUInt64 (x:uint16) = uint64 x -let testUInt16ToIntPtr (x:uint16) = nativeint x -let testUInt16ToUIntPtr (x:uint16) = unativeint x -let testUInt16ToSingle (x:uint16) = float32 x -let testUInt16ToDouble (x:uint16) = float x -let testUInt16ToDecimal (x:uint16) = decimal x -let testUInt16ToChar (x:uint16) = char x -let testUInt16ToString (x:uint16) = string x - -let testInt32ToByte (x:int) = byte x -let testInt32ToSByte (x:int) = sbyte x -let testInt32ToInt16 (x:int) = int16 x -let testInt32ToUInt16 (x:int) = uint16 x -let testInt32ToInt32 (x:int) = int x -let testInt32ToUInt32 (x:int) = uint32 x -let testInt32ToInt64 (x:int) = int64 x -let testInt32ToUInt64 (x:int) = uint64 x -let testInt32ToIntPtr (x:int) = nativeint x -let testInt32ToUIntPtr (x:int) = unativeint x -let testInt32ToSingle (x:int) = float32 x -let testInt32ToDouble (x:int) = float x -let testInt32ToDecimal (x:int) = decimal x -let testInt32ToChar (x:int) = char x -let testInt32ToString (x:int) = string x - -let testUInt32ToByte (x:uint32) = byte x -let testUInt32ToSByte (x:uint32) = sbyte x -let testUInt32ToInt16 (x:uint32) = int16 x -let testUInt32ToUInt16 (x:uint32) = uint16 x -let testUInt32ToInt32 (x:uint32) = int x -let testUInt32ToUInt32 (x:uint32) = uint32 x -let testUInt32ToInt64 (x:uint32) = int64 x -let testUInt32ToUInt64 (x:uint32) = uint64 x -let testUInt32ToIntPtr (x:uint32) = nativeint x -let testUInt32ToUIntPtr (x:uint32) = unativeint x -let testUInt32ToSingle (x:uint32) = float32 x -let testUInt32ToDouble (x:uint32) = float x -let testUInt32ToDecimal (x:uint32) = decimal x -let testUInt32ToChar (x:uint32) = char x -let testUInt32ToString (x:uint32) = string x - -let testInt64ToByte (x:int64) = byte x -let testInt64ToSByte (x:int64) = sbyte x -let testInt64ToInt16 (x:int64) = int16 x -let testInt64ToUInt16 (x:int64) = uint16 x -let testInt64ToInt32 (x:int64) = int x -let testInt64ToUInt32 (x:int64) = uint32 x -let testInt64ToInt64 (x:int64) = int64 x -let testInt64ToUInt64 (x:int64) = uint64 x -let testInt64ToIntPtr (x:int64) = nativeint x -let testInt64ToUIntPtr (x:int64) = unativeint x -let testInt64ToSingle (x:int64) = float32 x -let testInt64ToDouble (x:int64) = float x -let testInt64ToDecimal (x:int64) = decimal x -let testInt64ToChar (x:int64) = char x -let testInt64ToString (x:int64) = string x - -let testUInt64ToByte (x:uint64) = byte x -let testUInt64ToSByte (x:uint64) = sbyte x -let testUInt64ToInt16 (x:uint64) = int16 x -let testUInt64ToUInt16 (x:uint64) = uint16 x -let testUInt64ToInt32 (x:uint64) = int x -let testUInt64ToUInt32 (x:uint64) = uint32 x -let testUInt64ToInt64 (x:uint64) = int64 x -let testUInt64ToUInt64 (x:uint64) = uint64 x -let testUInt64ToIntPtr (x:uint64) = nativeint x -let testUInt64ToUIntPtr (x:uint64) = unativeint x -let testUInt64ToSingle (x:uint64) = float32 x -let testUInt64ToDouble (x:uint64) = float x -let testUInt64ToDecimal (x:uint64) = decimal x -let testUInt64ToChar (x:uint64) = char x -let testUInt64ToString (x:uint64) = string x - -let testIntPtrToByte (x:nativeint) = byte x -let testIntPtrToSByte (x:nativeint) = sbyte x -let testIntPtrToInt16 (x:nativeint) = int16 x -let testIntPtrToUInt16 (x:nativeint) = uint16 x -let testIntPtrToInt32 (x:nativeint) = int x -let testIntPtrToUInt32 (x:nativeint) = uint32 x -let testIntPtrToInt64 (x:nativeint) = int64 x -let testIntPtrToUInt64 (x:nativeint) = uint64 x -let testIntPtrToIntPtr (x:nativeint) = nativeint x -let testIntPtrToUIntPtr (x:nativeint) = unativeint x -let testIntPtrToSingle (x:nativeint) = float32 x -let testIntPtrToDouble (x:nativeint) = float x -let testIntPtrToDecimal (x:nativeint) = decimal x -let testIntPtrToChar (x:nativeint) = char x -let testIntPtrToString (x:nativeint) = string x - -let testUIntPtrToByte (x:unativeint) = byte x -let testUIntPtrToSByte (x:unativeint) = sbyte x -let testUIntPtrToInt16 (x:unativeint) = int16 x -let testUIntPtrToUInt16 (x:unativeint) = uint16 x -let testUIntPtrToInt32 (x:unativeint) = int x -let testUIntPtrToUInt32 (x:unativeint) = uint32 x -let testUIntPtrToInt64 (x:unativeint) = int64 x -let testUIntPtrToUInt64 (x:unativeint) = uint64 x -let testUIntPtrToIntPtr (x:unativeint) = nativeint x -let testUIntPtrToUIntPtr (x:unativeint) = unativeint x -let testUIntPtrToSingle (x:unativeint) = float32 x -let testUIntPtrToDouble (x:unativeint) = float x -let testUIntPtrToDecimal (x:unativeint) = decimal x -let testUIntPtrToChar (x:unativeint) = char x -let testUIntPtrToString (x:unativeint) = string x - -let testSingleToByte (x:float32) = byte x -let testSingleToSByte (x:float32) = sbyte x -let testSingleToInt16 (x:float32) = int16 x -let testSingleToUInt16 (x:float32) = uint16 x -let testSingleToInt32 (x:float32) = int x -let testSingleToUInt32 (x:float32) = uint32 x -let testSingleToInt64 (x:float32) = int64 x -let testSingleToUInt64 (x:float32) = uint64 x -let testSingleToIntPtr (x:float32) = nativeint x -let testSingleToUIntPtr (x:float32) = unativeint x -let testSingleToSingle (x:float32) = float32 x -let testSingleToDouble (x:float32) = float x -let testSingleToDecimal (x:float32) = decimal x -let testSingleToChar (x:float32) = char x -let testSingleToString (x:float32) = string x - -let testDoubleToByte (x:float) = byte x -let testDoubleToSByte (x:float) = sbyte x -let testDoubleToInt16 (x:float) = int16 x -let testDoubleToUInt16 (x:float) = uint16 x -let testDoubleToInt32 (x:float) = int x -let testDoubleToUInt32 (x:float) = uint32 x -let testDoubleToInt64 (x:float) = int64 x -let testDoubleToUInt64 (x:float) = uint64 x -let testDoubleToIntPtr (x:float) = nativeint x -let testDoubleToUIntPtr (x:float) = unativeint x -let testDoubleToSingle (x:float) = float32 x -let testDoubleToDouble (x:float) = float x -let testDoubleToDecimal (x:float) = decimal x -let testDoubleToChar (x:float) = char x -let testDoubleToString (x:float) = string x - -let testDecimalToByte (x:decimal) = byte x -let testDecimalToSByte (x:decimal) = sbyte x -let testDecimalToInt16 (x:decimal) = int16 x -let testDecimalToUInt16 (x:decimal) = uint16 x -let testDecimalToInt32 (x:decimal) = int x -let testDecimalToUInt32 (x:decimal) = uint32 x -let testDecimalToInt64 (x:decimal) = int64 x -let testDecimalToUInt64 (x:decimal) = uint64 x -let testDecimalToSingle (x:decimal) = float32 x -let testDecimalToDouble (x:decimal) = float x -let testDecimalToDecimal (x:decimal) = decimal x -let testDecimalToChar (x:decimal) = char x -let testDecimalToString (x:decimal) = string x - -let testCharToByte (x:char) = byte x -let testCharToSByte (x:char) = sbyte x -let testCharToInt16 (x:char) = int16 x -let testCharToUInt16 (x:char) = uint16 x -let testCharToInt32 (x:char) = int x -let testCharToUInt32 (x:char) = uint32 x -let testCharToInt64 (x:char) = int64 x -let testCharToUInt64 (x:char) = uint64 x -let testCharToIntPtr (x:char) = nativeint x -let testCharToUIntPtr (x:char) = unativeint x -let testCharToSingle (x:char) = float32 x -let testCharToDouble (x:char) = float x -let testCharToChar (x:char) = char x -let testCharToString (x:char) = string x - -let testStringToByte (x:string) = byte x -let testStringToSByte (x:string) = sbyte x -let testStringToInt16 (x:string) = int16 x -let testStringToUInt16 (x:string) = uint16 x -let testStringToInt32 (x:string) = int x -let testStringToUInt32 (x:string) = uint32 x -let testStringToInt64 (x:string) = int64 x -let testStringToUInt64 (x:string) = uint64 x -let testStringToSingle (x:string) = float32 x -let testStringToDouble (x:string) = float x -let testStringToDecimal (x:string) = decimal x -let testStringToChar (x:string) = char x -let testStringToString (x:string) = string x - """ + File.WriteAllText(fileName2, fileSource2) let fileNames = [fileName1; fileName2] let args = mkProjectCommandLineArgs (dllName, fileNames) let options = checker.GetProjectOptionsFromCommandLineArgs (projFileName, args) + let operatorTests = """ +module OperatorTests{0} + +let test{0}EqualsOperator (e1:{1}) (e2:{1}) = (=) e1 e2 +let test{0}NotEqualsOperator (e1:{1}) (e2:{1}) = (<>) e1 e2 +let test{0}LessThanOperator (e1:{1}) (e2:{1}) = (<) e1 e2 +let test{0}LessThanOrEqualsOperator (e1:{1}) (e2:{1}) = (<=) e1 e2 +let test{0}GreaterThanOperator (e1:{1}) (e2:{1}) = (>) e1 e2 +let test{0}GreaterThanOrEqualsOperator (e1:{1}) (e2:{1}) = (>=) e1 e2 + +let test{0}AdditionOperator (e1:{1}) (e2:{1}) = (+) e1 e2 +let test{0}SubtractionOperator (e1:{1}) (e2:{1}) = (-) e1 e2 +let test{0}MultiplyOperator (e1:{1}) (e2:{1}) = (*) e1 e2 +let test{0}DivisionOperator (e1:{1}) (e2:{1}) = (/) e1 e2 +let test{0}ModulusOperator (e1:{1}) (e2:{1}) = (%) e1 e2 +let test{0}BitwiseAndOperator (e1:{1}) (e2:{1}) = (&&&) e1 e2 +let test{0}BitwiseOrOperator (e1:{1}) (e2:{1}) = (|||) e1 e2 +let test{0}BitwiseXorOperator (e1:{1}) (e2:{1}) = (^^^) e1 e2 +let test{0}ShiftLeftOperator (e1:{1}) (e2:int) = (<<<) e1 e2 +let test{0}ShiftRightOperator (e1:{1}) (e2:int) = (>>>) e1 e2 + +let test{0}UnaryNegOperator (e1:{1}) = (~-) e1 + +let test{0}AdditionChecked (e1:{1}) (e2:{1}) = Checked.(+) e1 e2 +let test{0}SubtractionChecked (e1:{1}) (e2:{1}) = Checked.(-) e1 e2 +let test{0}MultiplyChecked (e1:{1}) (e2:{1}) = Checked.(*) e1 e2 +let test{0}UnaryNegChecked (e1:{1}) = Checked.(~-) e1 + +let test{0}ToByteChecked (e1:{1}) = Checked.byte e1 +let test{0}ToSByteChecked (e1:{1}) = Checked.sbyte e1 +let test{0}ToInt16Checked (e1:{1}) = Checked.int16 e1 +let test{0}ToUInt16Checked (e1:{1}) = Checked.uint16 e1 +let test{0}ToIntChecked (e1:{1}) = Checked.int e1 +let test{0}ToInt32Checked (e1:{1}) = Checked.int32 e1 +let test{0}ToUInt32Checked (e1:{1}) = Checked.uint32 e1 +let test{0}ToInt64Checked (e1:{1}) = Checked.int64 e1 +let test{0}ToUInt64Checked (e1:{1}) = Checked.uint64 e1 +let test{0}ToIntPtrChecked (e1:{1}) = Checked.nativeint e1 +let test{0}ToUIntPtrChecked (e1:{1}) = Checked.unativeint e1 + +let test{0}ToByteOperator (e1:{1}) = byte e1 +let test{0}ToSByteOperator (e1:{1}) = sbyte e1 +let test{0}ToInt16Operator (e1:{1}) = int16 e1 +let test{0}ToUInt16Operator (e1:{1}) = uint16 e1 +let test{0}ToIntOperator (e1:{1}) = int e1 +let test{0}ToInt32Operator (e1:{1}) = int32 e1 +let test{0}ToUInt32Operator (e1:{1}) = uint32 e1 +let test{0}ToInt64Operator (e1:{1}) = int64 e1 +let test{0}ToUInt64Operator (e1:{1}) = uint64 e1 +let test{0}ToIntPtrOperator (e1:{1}) = nativeint e1 +let test{0}ToUIntPtrOperator (e1:{1}) = unativeint e1 +let test{0}ToSingleOperator (e1:{1}) = float32 e1 +let test{0}ToDoubleOperator (e1:{1}) = float e1 +let test{0}ToDecimalOperator (e1:{1}) = decimal e1 +let test{0}ToCharOperator (e1:{1}) = char e1 +let test{0}ToStringOperator (e1:{1}) = string e1 + +""" + //<@ let x = Some(3) in x.IsSome @> [] -let ``Test Declarations project1`` () = +let ``Test Unoptimized Declarations Project1`` () = let wholeProjectResults = exprChecker.ParseAndCheckProject(Project1.options) |> Async.RunSynchronously for e in wholeProjectResults.Errors do @@ -879,96 +649,97 @@ let ``Test Declarations project1`` () = s.Replace("ILArrayShape [(Some 0, None)]", "ILArrayShapeFIX") .Replace("ILArrayShape [(Some 0, null)]", "ILArrayShapeFIX")) - let expected = - ["type M"; "type IntAbbrev"; "let boolEx1 = True @ (6,14--6,18)"; - "let intEx1 = 1 @ (7,13--7,14)"; "let int64Ex1 = 1 @ (8,15--8,17)"; - "let tupleEx1 = (1,1) @ (9,16--9,21)"; - "let tupleEx2 = (1,1,1) @ (10,16--10,25)"; - "let tupleEx3 = (1,1,1,1) @ (11,16--11,29)"; - "let localExample = let y: Microsoft.FSharp.Core.int = 1 in let z: Microsoft.FSharp.Core.int = 1 in (y,z) @ (14,7--14,8)"; - "let localGenericFunctionExample(unitVar0) = let y: Microsoft.FSharp.Core.int = 1 in let compiledAsLocalGenericFunction: 'a -> 'a = FUN ... -> fun x -> x in (compiledAsLocalGenericFunction y,compiledAsLocalGenericFunction 1) @ (19,7--19,8)"; - "let funcEx1(x) = x @ (23,23--23,24)"; - "let genericFuncEx1(x) = x @ (24,29--24,30)"; - "let topPair1b = M.patternInput@25 ().Item1 @ (25,4--25,26)"; - "let topPair1a = M.patternInput@25 ().Item0 @ (25,4--25,26)"; - "let testILCall1 = new Object() @ (27,18--27,27)"; - "let testILCall2 = Console.WriteLine (\"176\") @ (28,18--28,49)"; - "let recValNeverUsedAtRuntime = recValNeverUsedAtRuntime@31.Force(()) @ (31,8--31,32)"; - "let recFuncIgnoresFirstArg(g) (v) = v @ (32,33--32,34)"; - "let testFun4(unitVar0) = let rec ... in recValNeverUsedAtRuntime @ (36,4--39,28)"; - "type ClassWithImplicitConstructor"; - "member .ctor(compiledAsArg) = (new Object(); (this.compiledAsArg <- compiledAsArg; (this.compiledAsField <- 1; let compiledAsLocal: Microsoft.FSharp.Core.int = 1 in let compiledAsLocal2: Microsoft.FSharp.Core.int = Operators.op_Addition (compiledAsLocal,compiledAsLocal) in ()))) @ (41,5--41,33)"; - "member .cctor(unitVar) = (compiledAsStaticField <- 1; let compiledAsStaticLocal: Microsoft.FSharp.Core.int = 1 in let compiledAsStaticLocal2: Microsoft.FSharp.Core.int = Operators.op_Addition (compiledAsStaticLocal,compiledAsStaticLocal) in ()) @ (49,11--49,40)"; - "member M1(__) (unitVar1) = Operators.op_Addition (Operators.op_Addition (__.compiledAsField,let x: Microsoft.FSharp.Core.int = __.compiledAsField in __.compiledAsGenericInstanceMethod(x)),__.compiledAsArg) @ (55,21--55,102)"; - "member M2(__) (unitVar1) = __.compiledAsInstanceMethod(()) @ (56,21--56,47)"; - "member SM1(unitVar0) = Operators.op_Addition (compiledAsStaticField,let x: Microsoft.FSharp.Core.int = compiledAsStaticField in ClassWithImplicitConstructor.compiledAsGenericStaticMethod (x)) @ (57,26--57,101)"; - "member SM2(unitVar0) = ClassWithImplicitConstructor.compiledAsStaticMethod (()) @ (58,26--58,50)"; - "member ToString(__) (unitVar1) = Operators.op_Addition (base.ToString(),Operators.ToString (999)) @ (59,29--59,57)"; - "member TestCallinToString(this) (unitVar1) = this.ToString() @ (60,39--60,54)"; - "type Error"; "let err = {Data0 = 3; Data1 = 4} @ (64,10--64,20)"; - "let matchOnException(err) = match (if err :? M.Error then $0 else $1) targets ... @ (66,33--66,36)"; - "let upwardForLoop(unitVar0) = let mutable a: Microsoft.FSharp.Core.int = 1 in (for-loop; a) @ (69,16--69,17)"; - "let upwardForLoop2(unitVar0) = let mutable a: Microsoft.FSharp.Core.int = 1 in (for-loop; a) @ (74,16--74,17)"; - "let downwardForLoop(unitVar0) = let mutable a: Microsoft.FSharp.Core.int = 1 in (for-loop; a) @ (79,16--79,17)"; - "let quotationTest1(unitVar0) = quote(Operators.op_Addition (1,1)) @ (83,24--83,35)"; - "let quotationTest2(v) = quote(Operators.op_Addition (ExtraTopLevelOperators.SpliceExpression (v),1)) @ (84,24--84,36)"; - "type RecdType"; "type UnionType"; "type ClassWithEventsAndProperties"; - "member .ctor(unitVar0) = (new Object(); (this.ev <- new FSharpEvent`1(()); ())) @ (89,5--89,33)"; - "member .cctor(unitVar) = (sev <- new FSharpEvent`1(()); ()) @ (91,11--91,35)"; - "member get_InstanceProperty(x) (unitVar1) = (x.ev.Trigger(1); 1) @ (92,32--92,48)"; - "member get_StaticProperty(unitVar0) = (sev.Trigger(1); 1) @ (93,35--93,52)"; - "member get_InstanceEvent(x) (unitVar1) = x.ev.get_Publish(()) @ (94,29--94,39)"; - "member get_StaticEvent(x) (unitVar1) = sev.get_Publish(()) @ (95,27--95,38)"; - "let c = new ClassWithEventsAndProperties(()) @ (97,8--97,38)"; - "let v = M.c ().get_InstanceProperty(()) @ (98,8--98,26)"; - "do Console.WriteLine (\"777\")"; - "let functionWithSubmsumption(x) = IntrinsicFunctions.UnboxGeneric (x) @ (102,40--102,52)"; - "let functionWithCoercion(x) = Operators.op_PipeRight (Operators.op_PipeRight (IntrinsicFunctions.UnboxGeneric (x :> Microsoft.FSharp.Core.obj),fun x -> M.functionWithSubmsumption (x :> Microsoft.FSharp.Core.obj)),fun x -> M.functionWithSubmsumption (x :> Microsoft.FSharp.Core.obj)) @ (103,39--103,116)"; - "type MultiArgMethods"; - "member .ctor(c,d) = (new Object(); ()) @ (105,5--105,20)"; - "member Method(x) (a,b) = 1 @ (106,37--106,38)"; - "member CurriedMethod(x) (a1,b1) (a2,b2) = 1 @ (107,63--107,64)"; - "let testFunctionThatCallsMultiArgMethods(unitVar0) = let m: M.MultiArgMethods = new MultiArgMethods(3,4) in Operators.op_Addition (m.Method(7,8),fun tupledArg -> let arg00: Microsoft.FSharp.Core.int = tupledArg.Item0 in let arg01: Microsoft.FSharp.Core.int = tupledArg.Item1 in fun tupledArg -> let arg10: Microsoft.FSharp.Core.int = tupledArg.Item0 in let arg11: Microsoft.FSharp.Core.int = tupledArg.Item1 in m.CurriedMethod(arg00,arg01,arg10,arg11) (9,10) (11,12)) @ (110,8--110,9)"; - "let functionThatUsesObjectExpression(unitVar0) = { new Object() with member x.ToString(unitVar1) = Operators.ToString (888) } @ (114,3--114,55)"; - "let functionThatUsesObjectExpressionWithInterfaceImpl(unitVar0) = { new Object() with member x.ToString(unitVar1) = Operators.ToString (888) interface System.IComparable with member x.CompareTo(y) = 0 } :> System.IComparable @ (117,3--120,38)"; - "let testFunctionThatUsesUnitsOfMeasure(x) (y) = Operators.op_Addition,Microsoft.FSharp.Core.float<'u>,Microsoft.FSharp.Core.float<'u>> (x,y) @ (122,70--122,75)"; - "let testFunctionThatUsesAddressesAndByrefs(x) = let mutable w: Microsoft.FSharp.Core.int = 4 in let y1: Microsoft.FSharp.Core.byref = x in let y2: Microsoft.FSharp.Core.byref = &w in let arr: Microsoft.FSharp.Core.int Microsoft.FSharp.Core.[] = [|3; 4|] in let r: Microsoft.FSharp.Core.int Microsoft.FSharp.Core.ref = Operators.Ref (3) in let y3: Microsoft.FSharp.Core.byref = [I_ldelema (NormalAddress,false,ILArrayShape [(Some 0, None)],TypeVar 0us)](arr,0) in let y4: Microsoft.FSharp.Core.byref = &r.contents in let z: Microsoft.FSharp.Core.int = Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (x,y1),y2),y3) in (w <- 3; (x <- 4; (y2 <- 4; (y3 <- 5; Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (z,x),y1),y2),y3),y4),IntrinsicFunctions.GetArray (arr,0)),r.contents))))) @ (125,16--125,17)"; - "let testFunctionThatUsesStructs1(dt) = dt.AddDays(3) @ (139,57--139,72)"; - "let testFunctionThatUsesStructs2(unitVar0) = let dt1: System.DateTime = DateTime.get_Now () in let mutable dt2: System.DateTime = DateTime.get_Now () in let dt3: System.TimeSpan = Operators.op_Subtraction (dt1,dt2) in let dt4: System.DateTime = dt1.AddDays(3) in let dt5: Microsoft.FSharp.Core.int = dt1.get_Millisecond() in let dt6: Microsoft.FSharp.Core.byref = &dt2 in let dt7: System.TimeSpan = Operators.op_Subtraction (dt6,dt4) in dt7 @ (142,7--142,10)"; - "let testFunctionThatUsesWhileLoop(unitVar0) = let mutable x: Microsoft.FSharp.Core.int = 1 in (while Operators.op_LessThan (x,100) do x <- Operators.op_Addition (x,1) done; x) @ (152,15--152,16)"; - "let testFunctionThatUsesTryWith(unitVar0) = try M.testFunctionThatUsesWhileLoop (()) with matchValue -> match (if matchValue :? System.ArgumentException then $0 else $1) targets ... @ (158,3--160,60)"; - "let testFunctionThatUsesTryFinally(unitVar0) = try M.testFunctionThatUsesWhileLoop (()) finally Console.WriteLine (\"8888\") @ (164,3--167,37)"; - "member Console.WriteTwoLines.Static(unitVar0) = (Console.WriteLine (); Console.WriteLine ()) @ (170,36--170,90)"; - "member DateTime.get_TwoMinute(x) (unitVar1) = Operators.op_Addition (x.get_Minute(),x.get_Minute()) @ (173,25--173,44)"; - "let testFunctionThatUsesExtensionMembers(unitVar0) = (M.Console.WriteTwoLines.Static (()); let v: Microsoft.FSharp.Core.int = DateTime.get_Now ().DateTime.get_TwoMinute(()) in M.Console.WriteTwoLines.Static (())) @ (176,3--178,33)"; - "let testFunctionThatUsesOptionMembers(unitVar0) = let x: Microsoft.FSharp.Core.int Microsoft.FSharp.Core.option = Some(3) in (x.get_IsSome() (),x.get_IsNone() ()) @ (181,7--181,8)"; - "let testFunctionThatUsesOverAppliedFunction(unitVar0) = Operators.Identity Microsoft.FSharp.Core.int> (fun x -> Operators.Identity (x)) 3 @ (185,3--185,10)"; - "let testFunctionThatUsesPatternMatchingOnLists(x) = match (if x.Isop_ColonColon then (if x.Tail.Isop_ColonColon then (if x.Tail.Tail.Isop_Nil then $2 else $3) else $1) else $0) targets ... @ (188,10--188,11)"; - "let testFunctionThatUsesPatternMatchingOnOptions(x) = match (if x.IsSome then $1 else $0) targets ... @ (195,10--195,11)"; - "let testFunctionThatUsesPatternMatchingOnOptions2(x) = match (if x.IsSome then $1 else $0) targets ... @ (200,10--200,11)"; - "let testFunctionThatUsesConditionalOnOptions2(x) = (if x.get_IsSome() () then 1 else 2) @ (205,4--205,29)"; - "let f(x) (y) = Operators.op_Addition (x,y) @ (207,12--207,15)"; - "let g = let x: Microsoft.FSharp.Core.int = 1 in fun y -> M.f (x,y) @ (208,8--208,11)"; - "let h = Operators.op_Addition (M.g () 2,3) @ (209,8--209,17)"; - "type TestFuncProp"; - "member .ctor(unitVar0) = (new Object(); ()) @ (211,5--211,17)"; - "member get_Id(this) (unitVar1) = fun x -> x @ (212,21--212,31)"; - "let wrong = Operators.op_Equality (new TestFuncProp(()).get_Id(()) 0,0) @ (214,12--214,35)"; - "let start(name) = (name,name) @ (217,4--217,14)"; - "let last(name,values) = Operators.Identity ((name,values)) @ (220,4--220,21)"; - "let last2(name) = Operators.Identity (name) @ (223,4--223,11)"; - "let test7(s) = Operators.op_PipeRight (M.start (s),fun tupledArg -> let name: Microsoft.FSharp.Core.string = tupledArg.Item0 in let values: Microsoft.FSharp.Core.string = tupledArg.Item1 in M.last (name,values)) @ (226,4--226,19)"; - "let test8(unitVar0) = fun tupledArg -> let name: Microsoft.FSharp.Core.string = tupledArg.Item0 in let values: Microsoft.FSharp.Core.string = tupledArg.Item1 in M.last (name,values) @ (229,4--229,8)"; - "let test9(s) = Operators.op_PipeRight ((s,s),fun tupledArg -> let name: Microsoft.FSharp.Core.string = tupledArg.Item0 in let values: Microsoft.FSharp.Core.string = tupledArg.Item1 in M.last (name,values)) @ (232,4--232,17)"; - "let test10(unitVar0) = fun name -> M.last2 (name) @ (235,4--235,9)"; - "let test11(s) = Operators.op_PipeRight (s,fun name -> M.last2 (name)) @ (238,4--238,14)"; - "let badLoop = badLoop@240.Force Microsoft.FSharp.Core.int>(()) @ (240,8--240,15)"; - "type LetLambda"; - "let f = ((); fun a -> fun b -> Operators.op_Addition (a,b)) @ (246,8--247,24)"; - "let letLambdaRes = Operators.op_PipeRight<(Microsoft.FSharp.Core.int * Microsoft.FSharp.Core.int) Microsoft.FSharp.Collections.list,Microsoft.FSharp.Core.int Microsoft.FSharp.Collections.list> (Cons((1,2),Empty()),let mapping: Microsoft.FSharp.Core.int * Microsoft.FSharp.Core.int -> Microsoft.FSharp.Core.int = fun tupledArg -> let a: Microsoft.FSharp.Core.int = tupledArg.Item0 in let b: Microsoft.FSharp.Core.int = tupledArg.Item1 in (LetLambda.f () a) b in fun list -> ListModule.Map (mapping,list)) @ (249,19--249,71)"] - - let expected2 = - [ "type N"; "type IntAbbrev"; "let bool2 = False @ (6,12--6,17)"; + let expected = [ + "type M"; "type IntAbbrev"; "let boolEx1 = True @ (6,14--6,18)"; + "let intEx1 = 1 @ (7,13--7,14)"; "let int64Ex1 = 1 @ (8,15--8,17)"; + "let tupleEx1 = (1,1) @ (9,16--9,21)"; + "let tupleEx2 = (1,1,1) @ (10,16--10,25)"; + "let tupleEx3 = (1,1,1,1) @ (11,16--11,29)"; + "let localExample = let y: Microsoft.FSharp.Core.int = 1 in let z: Microsoft.FSharp.Core.int = 1 in (y,z) @ (14,7--14,8)"; + "let localGenericFunctionExample(unitVar0) = let y: Microsoft.FSharp.Core.int = 1 in let compiledAsLocalGenericFunction: 'a -> 'a = FUN ... -> fun x -> x in (compiledAsLocalGenericFunction y,compiledAsLocalGenericFunction 1) @ (19,7--19,8)"; + "let funcEx1(x) = x @ (23,23--23,24)"; + "let genericFuncEx1(x) = x @ (24,29--24,30)"; + "let topPair1b = M.patternInput@25 ().Item1 @ (25,4--25,26)"; + "let topPair1a = M.patternInput@25 ().Item0 @ (25,4--25,26)"; + "let testILCall1 = new Object() @ (27,18--27,27)"; + "let testILCall2 = Console.WriteLine (\"176\") @ (28,18--28,49)"; + "let recValNeverUsedAtRuntime = recValNeverUsedAtRuntime@31.Force(()) @ (31,8--31,32)"; + "let recFuncIgnoresFirstArg(g) (v) = v @ (32,33--32,34)"; + "let testFun4(unitVar0) = let rec ... in recValNeverUsedAtRuntime @ (36,4--39,28)"; + "type ClassWithImplicitConstructor"; + "member .ctor(compiledAsArg) = (new Object(); (this.compiledAsArg <- compiledAsArg; (this.compiledAsField <- 1; let compiledAsLocal: Microsoft.FSharp.Core.int = 1 in let compiledAsLocal2: Microsoft.FSharp.Core.int = Operators.op_Addition (compiledAsLocal,compiledAsLocal) in ()))) @ (41,5--41,33)"; + "member .cctor(unitVar) = (compiledAsStaticField <- 1; let compiledAsStaticLocal: Microsoft.FSharp.Core.int = 1 in let compiledAsStaticLocal2: Microsoft.FSharp.Core.int = Operators.op_Addition (compiledAsStaticLocal,compiledAsStaticLocal) in ()) @ (49,11--49,40)"; + "member M1(__) (unitVar1) = Operators.op_Addition (Operators.op_Addition (__.compiledAsField,let x: Microsoft.FSharp.Core.int = __.compiledAsField in __.compiledAsGenericInstanceMethod(x)),__.compiledAsArg) @ (55,21--55,102)"; + "member M2(__) (unitVar1) = __.compiledAsInstanceMethod(()) @ (56,21--56,47)"; + "member SM1(unitVar0) = Operators.op_Addition (compiledAsStaticField,let x: Microsoft.FSharp.Core.int = compiledAsStaticField in ClassWithImplicitConstructor.compiledAsGenericStaticMethod (x)) @ (57,26--57,101)"; + "member SM2(unitVar0) = ClassWithImplicitConstructor.compiledAsStaticMethod (()) @ (58,26--58,50)"; + "member ToString(__) (unitVar1) = Operators.op_Addition (base.ToString(),Operators.ToString (999)) @ (59,29--59,57)"; + "member TestCallinToString(this) (unitVar1) = this.ToString() @ (60,39--60,54)"; + "type Error"; "let err = {Data0 = 3; Data1 = 4} @ (64,10--64,20)"; + "let matchOnException(err) = match (if err :? M.Error then $0 else $1) targets ... @ (66,33--66,36)"; + "let upwardForLoop(unitVar0) = let mutable a: Microsoft.FSharp.Core.int = 1 in (for-loop; a) @ (69,16--69,17)"; + "let upwardForLoop2(unitVar0) = let mutable a: Microsoft.FSharp.Core.int = 1 in (for-loop; a) @ (74,16--74,17)"; + "let downwardForLoop(unitVar0) = let mutable a: Microsoft.FSharp.Core.int = 1 in (for-loop; a) @ (79,16--79,17)"; + "let quotationTest1(unitVar0) = quote(Operators.op_Addition (1,1)) @ (83,24--83,35)"; + "let quotationTest2(v) = quote(Operators.op_Addition (ExtraTopLevelOperators.SpliceExpression (v),1)) @ (84,24--84,36)"; + "type RecdType"; "type UnionType"; "type ClassWithEventsAndProperties"; + "member .ctor(unitVar0) = (new Object(); (this.ev <- new FSharpEvent`1(()); ())) @ (89,5--89,33)"; + "member .cctor(unitVar) = (sev <- new FSharpEvent`1(()); ()) @ (91,11--91,35)"; + "member get_InstanceProperty(x) (unitVar1) = (x.ev.Trigger(1); 1) @ (92,32--92,48)"; + "member get_StaticProperty(unitVar0) = (sev.Trigger(1); 1) @ (93,35--93,52)"; + "member get_InstanceEvent(x) (unitVar1) = x.ev.get_Publish(()) @ (94,29--94,39)"; + "member get_StaticEvent(x) (unitVar1) = sev.get_Publish(()) @ (95,27--95,38)"; + "let c = new ClassWithEventsAndProperties(()) @ (97,8--97,38)"; + "let v = M.c ().get_InstanceProperty(()) @ (98,8--98,26)"; + "do Console.WriteLine (\"777\")"; + "let functionWithSubmsumption(x) = IntrinsicFunctions.UnboxGeneric (x) @ (102,40--102,52)"; + "let functionWithCoercion(x) = Operators.op_PipeRight (Operators.op_PipeRight (IntrinsicFunctions.UnboxGeneric (x :> Microsoft.FSharp.Core.obj),fun x -> M.functionWithSubmsumption (x :> Microsoft.FSharp.Core.obj)),fun x -> M.functionWithSubmsumption (x :> Microsoft.FSharp.Core.obj)) @ (103,39--103,116)"; + "type MultiArgMethods"; + "member .ctor(c,d) = (new Object(); ()) @ (105,5--105,20)"; + "member Method(x) (a,b) = 1 @ (106,37--106,38)"; + "member CurriedMethod(x) (a1,b1) (a2,b2) = 1 @ (107,63--107,64)"; + "let testFunctionThatCallsMultiArgMethods(unitVar0) = let m: M.MultiArgMethods = new MultiArgMethods(3,4) in Operators.op_Addition (m.Method(7,8),fun tupledArg -> let arg00: Microsoft.FSharp.Core.int = tupledArg.Item0 in let arg01: Microsoft.FSharp.Core.int = tupledArg.Item1 in fun tupledArg -> let arg10: Microsoft.FSharp.Core.int = tupledArg.Item0 in let arg11: Microsoft.FSharp.Core.int = tupledArg.Item1 in m.CurriedMethod(arg00,arg01,arg10,arg11) (9,10) (11,12)) @ (110,8--110,9)"; + "let functionThatUsesObjectExpression(unitVar0) = { new Object() with member x.ToString(unitVar1) = Operators.ToString (888) } @ (114,3--114,55)"; + "let functionThatUsesObjectExpressionWithInterfaceImpl(unitVar0) = { new Object() with member x.ToString(unitVar1) = Operators.ToString (888) interface System.IComparable with member x.CompareTo(y) = 0 } :> System.IComparable @ (117,3--120,38)"; + "let testFunctionThatUsesUnitsOfMeasure(x) (y) = Operators.op_Addition,Microsoft.FSharp.Core.float<'u>,Microsoft.FSharp.Core.float<'u>> (x,y) @ (122,70--122,75)"; + "let testFunctionThatUsesAddressesAndByrefs(x) = let mutable w: Microsoft.FSharp.Core.int = 4 in let y1: Microsoft.FSharp.Core.byref = x in let y2: Microsoft.FSharp.Core.byref = &w in let arr: Microsoft.FSharp.Core.int Microsoft.FSharp.Core.[] = [|3; 4|] in let r: Microsoft.FSharp.Core.int Microsoft.FSharp.Core.ref = Operators.Ref (3) in let y3: Microsoft.FSharp.Core.byref = [I_ldelema (NormalAddress,false,ILArrayShape [(Some 0, None)],TypeVar 0us)](arr,0) in let y4: Microsoft.FSharp.Core.byref = &r.contents in let z: Microsoft.FSharp.Core.int = Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (x,y1),y2),y3) in (w <- 3; (x <- 4; (y2 <- 4; (y3 <- 5; Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (z,x),y1),y2),y3),y4),IntrinsicFunctions.GetArray (arr,0)),r.contents))))) @ (125,16--125,17)"; + "let testFunctionThatUsesStructs1(dt) = dt.AddDays(3) @ (139,57--139,72)"; + "let testFunctionThatUsesStructs2(unitVar0) = let dt1: System.DateTime = DateTime.get_Now () in let mutable dt2: System.DateTime = DateTime.get_Now () in let dt3: System.TimeSpan = Operators.op_Subtraction (dt1,dt2) in let dt4: System.DateTime = dt1.AddDays(3) in let dt5: Microsoft.FSharp.Core.int = dt1.get_Millisecond() in let dt6: Microsoft.FSharp.Core.byref = &dt2 in let dt7: System.TimeSpan = Operators.op_Subtraction (dt6,dt4) in dt7 @ (142,7--142,10)"; + "let testFunctionThatUsesWhileLoop(unitVar0) = let mutable x: Microsoft.FSharp.Core.int = 1 in (while Operators.op_LessThan (x,100) do x <- Operators.op_Addition (x,1) done; x) @ (152,15--152,16)"; + "let testFunctionThatUsesTryWith(unitVar0) = try M.testFunctionThatUsesWhileLoop (()) with matchValue -> match (if matchValue :? System.ArgumentException then $0 else $1) targets ... @ (158,3--160,60)"; + "let testFunctionThatUsesTryFinally(unitVar0) = try M.testFunctionThatUsesWhileLoop (()) finally Console.WriteLine (\"8888\") @ (164,3--167,37)"; + "member Console.WriteTwoLines.Static(unitVar0) = (Console.WriteLine (); Console.WriteLine ()) @ (170,36--170,90)"; + "member DateTime.get_TwoMinute(x) (unitVar1) = Operators.op_Addition (x.get_Minute(),x.get_Minute()) @ (173,25--173,44)"; + "let testFunctionThatUsesExtensionMembers(unitVar0) = (M.Console.WriteTwoLines.Static (()); let v: Microsoft.FSharp.Core.int = DateTime.get_Now ().DateTime.get_TwoMinute(()) in M.Console.WriteTwoLines.Static (())) @ (176,3--178,33)"; + "let testFunctionThatUsesOptionMembers(unitVar0) = let x: Microsoft.FSharp.Core.int Microsoft.FSharp.Core.option = Some(3) in (x.get_IsSome() (),x.get_IsNone() ()) @ (181,7--181,8)"; + "let testFunctionThatUsesOverAppliedFunction(unitVar0) = Operators.Identity Microsoft.FSharp.Core.int> (fun x -> Operators.Identity (x)) 3 @ (185,3--185,10)"; + "let testFunctionThatUsesPatternMatchingOnLists(x) = match (if x.Isop_ColonColon then (if x.Tail.Isop_ColonColon then (if x.Tail.Tail.Isop_Nil then $2 else $3) else $1) else $0) targets ... @ (188,10--188,11)"; + "let testFunctionThatUsesPatternMatchingOnOptions(x) = match (if x.IsSome then $1 else $0) targets ... @ (195,10--195,11)"; + "let testFunctionThatUsesPatternMatchingOnOptions2(x) = match (if x.IsSome then $1 else $0) targets ... @ (200,10--200,11)"; + "let testFunctionThatUsesConditionalOnOptions2(x) = (if x.get_IsSome() () then 1 else 2) @ (205,4--205,29)"; + "let f(x) (y) = Operators.op_Addition (x,y) @ (207,12--207,15)"; + "let g = let x: Microsoft.FSharp.Core.int = 1 in fun y -> M.f (x,y) @ (208,8--208,11)"; + "let h = Operators.op_Addition (M.g () 2,3) @ (209,8--209,17)"; + "type TestFuncProp"; + "member .ctor(unitVar0) = (new Object(); ()) @ (211,5--211,17)"; + "member get_Id(this) (unitVar1) = fun x -> x @ (212,21--212,31)"; + "let wrong = Operators.op_Equality (new TestFuncProp(()).get_Id(()) 0,0) @ (214,12--214,35)"; + "let start(name) = (name,name) @ (217,4--217,14)"; + "let last(name,values) = Operators.Identity ((name,values)) @ (220,4--220,21)"; + "let last2(name) = Operators.Identity (name) @ (223,4--223,11)"; + "let test7(s) = Operators.op_PipeRight (M.start (s),fun tupledArg -> let name: Microsoft.FSharp.Core.string = tupledArg.Item0 in let values: Microsoft.FSharp.Core.string = tupledArg.Item1 in M.last (name,values)) @ (226,4--226,19)"; + "let test8(unitVar0) = fun tupledArg -> let name: Microsoft.FSharp.Core.string = tupledArg.Item0 in let values: Microsoft.FSharp.Core.string = tupledArg.Item1 in M.last (name,values) @ (229,4--229,8)"; + "let test9(s) = Operators.op_PipeRight ((s,s),fun tupledArg -> let name: Microsoft.FSharp.Core.string = tupledArg.Item0 in let values: Microsoft.FSharp.Core.string = tupledArg.Item1 in M.last (name,values)) @ (232,4--232,17)"; + "let test10(unitVar0) = fun name -> M.last2 (name) @ (235,4--235,9)"; + "let test11(s) = Operators.op_PipeRight (s,fun name -> M.last2 (name)) @ (238,4--238,14)"; + "let badLoop = badLoop@240.Force Microsoft.FSharp.Core.int>(()) @ (240,8--240,15)"; + "type LetLambda"; + "let f = ((); fun a -> fun b -> Operators.op_Addition (a,b)) @ (246,8--247,24)"; + "let letLambdaRes = Operators.op_PipeRight<(Microsoft.FSharp.Core.int * Microsoft.FSharp.Core.int) Microsoft.FSharp.Collections.list,Microsoft.FSharp.Core.int Microsoft.FSharp.Collections.list> (Cons((1,2),Empty()),let mapping: Microsoft.FSharp.Core.int * Microsoft.FSharp.Core.int -> Microsoft.FSharp.Core.int = fun tupledArg -> let a: Microsoft.FSharp.Core.int = tupledArg.Item0 in let b: Microsoft.FSharp.Core.int = tupledArg.Item1 in (LetLambda.f () a) b in fun list -> ListModule.Map (mapping,list)) @ (249,19--249,71)"; + ] + + let expected2 = [ + "type N"; "type IntAbbrev"; "let bool2 = False @ (6,12--6,17)"; "let testHashChar(x) = Operators.Hash (x) @ (8,28--8,34)"; "let testHashSByte(x) = Operators.Hash (x) @ (9,30--9,36)"; "let testHashInt16(x) = Operators.Hash (x) @ (10,30--10,36)"; @@ -978,275 +749,7 @@ let ``Test Declarations project1`` () = "let testHashUIntPtr(x) = Operators.Hash (x) @ (14,37--14,43)"; "let testHashString(x) = Operators.Hash (x) @ (16,32--16,38)"; "let testTypeOf(x) = Operators.TypeOf<'T> () @ (17,24--17,30)"; - "let testEqualsOperator(e1) (e2) = Operators.op_Equality<'a> (e1,e2) @ (19,46--19,54)"; - "let testNotEqualsOperator(e1) (e2) = Operators.op_Inequality<'a> (e1,e2) @ (20,46--20,55)"; - "let testLessThanOperator(e1) (e2) = Operators.op_LessThan<'a> (e1,e2) @ (21,46--21,54)"; - "let testLessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual<'a> (e1,e2) @ (22,46--22,55)"; - "let testGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan<'a> (e1,e2) @ (23,46--23,54)"; - "let testGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual<'a> (e1,e2) @ (24,46--24,55)"; - "let testAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (26,38--26,46)"; - "let testSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (27,38--27,46)"; - "let testMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (28,37--28,46)"; - "let testDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (29,38--29,46)"; - "let testModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (30,38--30,46)"; - "let testBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (31,38--31,48)"; - "let testBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (32,38--32,48)"; - "let testBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (33,38--33,48)"; - "let testShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (34,38--34,48)"; - "let testShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (35,38--35,48)"; - "let testUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (37,33--37,39)"; - "let testUnaryNotOperator(e1) = Operators.Not (e1) @ (38,32--38,38)"; - "let testAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (40,35--40,52)"; - "let testSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (41,35--41,52)"; - "let testMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (42,35--42,52)"; - "let testUnaryNegChecked(e1) = Checked.op_UnaryNegation (e1) @ (43,32--43,47)"; - "let testToByteChecked(e1) = Checked.ToByte (e1) @ (45,32--45,47)"; - "let testToSByteChecked(e1) = Checked.ToSByte (e1) @ (46,32--46,48)"; - "let testToInt16Checked(e1) = Checked.ToInt16 (e1) @ (47,32--47,48)"; - "let testToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (48,32--48,49)"; - "let testToIntChecked(e1) = Checked.ToInt (e1) @ (49,32--49,46)"; - "let testToInt32Checked(e1) = Checked.ToInt32 (e1) @ (50,32--50,48)"; - "let testToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (51,32--51,49)"; - "let testToInt64Checked(e1) = Checked.ToInt64 (e1) @ (52,32--52,48)"; - "let testToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (53,32--53,49)"; - "let testToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (54,32--54,52)"; - "let testToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (55,32--55,53)"; - "let testToByteOperator(e1) = Operators.ToByte (e1) @ (57,32--57,39)"; - "let testToSByteOperator(e1) = Operators.ToSByte (e1) @ (58,32--58,40)"; - "let testToInt16Operator(e1) = Operators.ToInt16 (e1) @ (59,32--59,40)"; - "let testToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (60,32--60,41)"; - "let testToIntOperator(e1) = Operators.ToInt (e1) @ (61,32--61,38)"; - "let testToInt32Operator(e1) = Operators.ToInt32 (e1) @ (62,32--62,40)"; - "let testToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (63,32--63,41)"; - "let testToInt64Operator(e1) = Operators.ToInt64 (e1) @ (64,32--64,40)"; - "let testToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (65,32--65,41)"; - "let testToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (66,32--66,44)"; - "let testToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (67,32--67,45)"; - "let testToSingleOperator(e1) = Operators.ToSingle (e1) @ (68,32--68,42)"; - "let testToDoubleOperator(e1) = Operators.ToDouble (e1) @ (69,32--69,40)"; - "let testToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (70,32--70,42)"; - "let testToCharOperator(e1) = Operators.ToChar (e1) @ (71,32--71,39)"; - "let testToStringOperator(e1) = Operators.ToString (e1) @ (72,32--72,41)"; - "let testByteToByte(x) = Operators.ToByte (x) @ (74,33--74,39)"; - "let testByteToSByte(x) = Operators.ToSByte (x) @ (75,33--75,40)"; - "let testByteToInt16(x) = Operators.ToInt16 (x) @ (76,33--76,40)"; - "let testByteToUInt16(x) = Operators.ToUInt16 (x) @ (77,33--77,41)"; - "let testByteToInt32(x) = Operators.ToInt (x) @ (78,33--78,38)"; - "let testByteToUInt32(x) = Operators.ToUInt32 (x) @ (79,33--79,41)"; - "let testByteToInt64(x) = Operators.ToInt64 (x) @ (80,33--80,40)"; - "let testByteToUInt64(x) = Operators.ToUInt64 (x) @ (81,33--81,41)"; - "let testByteToIntPtr(x) = Operators.ToIntPtr (x) @ (82,33--82,44)"; - "let testByteToUIntPtr(x) = Operators.ToUIntPtr (x) @ (83,33--83,45)"; - "let testByteToSingle(x) = Operators.ToSingle (x) @ (84,33--84,42)"; - "let testByteToDouble(x) = Operators.ToDouble (x) @ (85,33--85,40)"; - "let testByteToDecimal(x) = Operators.ToDecimal (x) @ (86,33--86,42)"; - "let testByteToChar(x) = Operators.ToChar (x) @ (87,33--87,39)"; - "let testByteToString(x) = Operators.ToString (x) @ (88,33--88,41)"; - "let testSByteToByte(x) = Operators.ToByte (x) @ (90,35--90,41)"; - "let testSByteToSByte(x) = Operators.ToSByte (x) @ (91,35--91,42)"; - "let testSByteToInt16(x) = Operators.ToInt16 (x) @ (92,35--92,42)"; - "let testSByteToUInt16(x) = Operators.ToUInt16 (x) @ (93,35--93,43)"; - "let testSByteToInt32(x) = Operators.ToInt (x) @ (94,35--94,40)"; - "let testSByteToUInt32(x) = Operators.ToUInt32 (x) @ (95,35--95,43)"; - "let testSByteToInt64(x) = Operators.ToInt64 (x) @ (96,35--96,42)"; - "let testSByteToUInt64(x) = Operators.ToUInt64 (x) @ (97,35--97,43)"; - "let testSByteToIntPtr(x) = Operators.ToIntPtr (x) @ (98,35--98,46)"; - "let testSByteToUIntPtr(x) = Operators.ToUIntPtr (x) @ (99,35--99,47)"; - "let testSByteToSingle(x) = Operators.ToSingle (x) @ (100,35--100,44)"; - "let testSByteToDouble(x) = Operators.ToDouble (x) @ (101,35--101,42)"; - "let testSByteToDecimal(x) = Operators.ToDecimal (x) @ (102,35--102,44)"; - "let testSByteToChar(x) = Operators.ToChar (x) @ (103,35--103,41)"; - "let testSByteToString(x) = Operators.ToString (x) @ (104,35--104,43)"; - "let testInt16ToByte(x) = Operators.ToByte (x) @ (106,35--106,41)"; - "let testInt16ToSByte(x) = Operators.ToSByte (x) @ (107,35--107,42)"; - "let testInt16ToInt16(x) = Operators.ToInt16 (x) @ (108,35--108,42)"; - "let testInt16ToUInt16(x) = Operators.ToUInt16 (x) @ (109,35--109,43)"; - "let testInt16ToInt32(x) = Operators.ToInt (x) @ (110,35--110,40)"; - "let testInt16ToUInt32(x) = Operators.ToUInt32 (x) @ (111,35--111,43)"; - "let testInt16ToInt64(x) = Operators.ToInt64 (x) @ (112,35--112,42)"; - "let testInt16ToUInt64(x) = Operators.ToUInt64 (x) @ (113,35--113,43)"; - "let testInt16ToIntPtr(x) = Operators.ToIntPtr (x) @ (114,35--114,46)"; - "let testInt16ToUIntPtr(x) = Operators.ToUIntPtr (x) @ (115,35--115,47)"; - "let testInt16ToSingle(x) = Operators.ToSingle (x) @ (116,35--116,44)"; - "let testInt16ToDouble(x) = Operators.ToDouble (x) @ (117,35--117,42)"; - "let testInt16ToDecimal(x) = Operators.ToDecimal (x) @ (118,35--118,44)"; - "let testInt16ToChar(x) = Operators.ToChar (x) @ (119,35--119,41)"; - "let testInt16ToString(x) = Operators.ToString (x) @ (120,35--120,43)"; - "let testUInt16ToByte(x) = Operators.ToByte (x) @ (122,37--122,43)"; - "let testUInt16ToSByte(x) = Operators.ToSByte (x) @ (123,37--123,44)"; - "let testUInt16ToInt16(x) = Operators.ToInt16 (x) @ (124,37--124,44)"; - "let testUInt16ToUInt16(x) = Operators.ToUInt16 (x) @ (125,37--125,45)"; - "let testUInt16ToInt32(x) = Operators.ToInt (x) @ (126,37--126,42)"; - "let testUInt16ToUInt32(x) = Operators.ToUInt32 (x) @ (127,37--127,45)"; - "let testUInt16ToInt64(x) = Operators.ToInt64 (x) @ (128,37--128,44)"; - "let testUInt16ToUInt64(x) = Operators.ToUInt64 (x) @ (129,37--129,45)"; - "let testUInt16ToIntPtr(x) = Operators.ToIntPtr (x) @ (130,37--130,48)"; - "let testUInt16ToUIntPtr(x) = Operators.ToUIntPtr (x) @ (131,37--131,49)"; - "let testUInt16ToSingle(x) = Operators.ToSingle (x) @ (132,37--132,46)"; - "let testUInt16ToDouble(x) = Operators.ToDouble (x) @ (133,37--133,44)"; - "let testUInt16ToDecimal(x) = Operators.ToDecimal (x) @ (134,37--134,46)"; - "let testUInt16ToChar(x) = Operators.ToChar (x) @ (135,37--135,43)"; - "let testUInt16ToString(x) = Operators.ToString (x) @ (136,37--136,45)"; - "let testInt32ToByte(x) = Operators.ToByte (x) @ (138,33--138,39)"; - "let testInt32ToSByte(x) = Operators.ToSByte (x) @ (139,33--139,40)"; - "let testInt32ToInt16(x) = Operators.ToInt16 (x) @ (140,33--140,40)"; - "let testInt32ToUInt16(x) = Operators.ToUInt16 (x) @ (141,33--141,41)"; - "let testInt32ToInt32(x) = Operators.ToInt (x) @ (142,33--142,38)"; - "let testInt32ToUInt32(x) = Operators.ToUInt32 (x) @ (143,33--143,41)"; - "let testInt32ToInt64(x) = Operators.ToInt64 (x) @ (144,33--144,40)"; - "let testInt32ToUInt64(x) = Operators.ToUInt64 (x) @ (145,33--145,41)"; - "let testInt32ToIntPtr(x) = Operators.ToIntPtr (x) @ (146,33--146,44)"; - "let testInt32ToUIntPtr(x) = Operators.ToUIntPtr (x) @ (147,33--147,45)"; - "let testInt32ToSingle(x) = Operators.ToSingle (x) @ (148,33--148,42)"; - "let testInt32ToDouble(x) = Operators.ToDouble (x) @ (149,33--149,40)"; - "let testInt32ToDecimal(x) = Operators.ToDecimal (x) @ (150,33--150,42)"; - "let testInt32ToChar(x) = Operators.ToChar (x) @ (151,33--151,39)"; - "let testInt32ToString(x) = Operators.ToString (x) @ (152,33--152,41)"; - "let testUInt32ToByte(x) = Operators.ToByte (x) @ (154,37--154,43)"; - "let testUInt32ToSByte(x) = Operators.ToSByte (x) @ (155,37--155,44)"; - "let testUInt32ToInt16(x) = Operators.ToInt16 (x) @ (156,37--156,44)"; - "let testUInt32ToUInt16(x) = Operators.ToUInt16 (x) @ (157,37--157,45)"; - "let testUInt32ToInt32(x) = Operators.ToInt (x) @ (158,37--158,42)"; - "let testUInt32ToUInt32(x) = Operators.ToUInt32 (x) @ (159,37--159,45)"; - "let testUInt32ToInt64(x) = Operators.ToInt64 (x) @ (160,37--160,44)"; - "let testUInt32ToUInt64(x) = Operators.ToUInt64 (x) @ (161,37--161,45)"; - "let testUInt32ToIntPtr(x) = Operators.ToIntPtr (x) @ (162,37--162,48)"; - "let testUInt32ToUIntPtr(x) = Operators.ToUIntPtr (x) @ (163,37--163,49)"; - "let testUInt32ToSingle(x) = Operators.ToSingle (x) @ (164,37--164,46)"; - "let testUInt32ToDouble(x) = Operators.ToDouble (x) @ (165,37--165,44)"; - "let testUInt32ToDecimal(x) = Operators.ToDecimal (x) @ (166,37--166,46)"; - "let testUInt32ToChar(x) = Operators.ToChar (x) @ (167,37--167,43)"; - "let testUInt32ToString(x) = Operators.ToString (x) @ (168,37--168,45)"; - "let testInt64ToByte(x) = Operators.ToByte (x) @ (170,35--170,41)"; - "let testInt64ToSByte(x) = Operators.ToSByte (x) @ (171,35--171,42)"; - "let testInt64ToInt16(x) = Operators.ToInt16 (x) @ (172,35--172,42)"; - "let testInt64ToUInt16(x) = Operators.ToUInt16 (x) @ (173,35--173,43)"; - "let testInt64ToInt32(x) = Operators.ToInt (x) @ (174,35--174,40)"; - "let testInt64ToUInt32(x) = Operators.ToUInt32 (x) @ (175,35--175,43)"; - "let testInt64ToInt64(x) = Operators.ToInt64 (x) @ (176,35--176,42)"; - "let testInt64ToUInt64(x) = Operators.ToUInt64 (x) @ (177,35--177,43)"; - "let testInt64ToIntPtr(x) = Operators.ToIntPtr (x) @ (178,35--178,46)"; - "let testInt64ToUIntPtr(x) = Operators.ToUIntPtr (x) @ (179,35--179,47)"; - "let testInt64ToSingle(x) = Operators.ToSingle (x) @ (180,35--180,44)"; - "let testInt64ToDouble(x) = Operators.ToDouble (x) @ (181,35--181,42)"; - "let testInt64ToDecimal(x) = Operators.ToDecimal (x) @ (182,35--182,44)"; - "let testInt64ToChar(x) = Operators.ToChar (x) @ (183,35--183,41)"; - "let testInt64ToString(x) = Operators.ToString (x) @ (184,35--184,43)"; - "let testUInt64ToByte(x) = Operators.ToByte (x) @ (186,37--186,43)"; - "let testUInt64ToSByte(x) = Operators.ToSByte (x) @ (187,37--187,44)"; - "let testUInt64ToInt16(x) = Operators.ToInt16 (x) @ (188,37--188,44)"; - "let testUInt64ToUInt16(x) = Operators.ToUInt16 (x) @ (189,37--189,45)"; - "let testUInt64ToInt32(x) = Operators.ToInt (x) @ (190,37--190,42)"; - "let testUInt64ToUInt32(x) = Operators.ToUInt32 (x) @ (191,37--191,45)"; - "let testUInt64ToInt64(x) = Operators.ToInt64 (x) @ (192,37--192,44)"; - "let testUInt64ToUInt64(x) = Operators.ToUInt64 (x) @ (193,37--193,45)"; - "let testUInt64ToIntPtr(x) = Operators.ToIntPtr (x) @ (194,37--194,48)"; - "let testUInt64ToUIntPtr(x) = Operators.ToUIntPtr (x) @ (195,37--195,49)"; - "let testUInt64ToSingle(x) = Operators.ToSingle (x) @ (196,37--196,46)"; - "let testUInt64ToDouble(x) = Operators.ToDouble (x) @ (197,37--197,44)"; - "let testUInt64ToDecimal(x) = Operators.ToDecimal (x) @ (198,37--198,46)"; - "let testUInt64ToChar(x) = Operators.ToChar (x) @ (199,37--199,43)"; - "let testUInt64ToString(x) = Operators.ToString (x) @ (200,37--200,45)"; - "let testIntPtrToByte(x) = Operators.ToByte (x) @ (202,40--202,46)"; - "let testIntPtrToSByte(x) = Operators.ToSByte (x) @ (203,40--203,47)"; - "let testIntPtrToInt16(x) = Operators.ToInt16 (x) @ (204,40--204,47)"; - "let testIntPtrToUInt16(x) = Operators.ToUInt16 (x) @ (205,40--205,48)"; - "let testIntPtrToInt32(x) = Operators.ToInt (x) @ (206,40--206,45)"; - "let testIntPtrToUInt32(x) = Operators.ToUInt32 (x) @ (207,40--207,48)"; - "let testIntPtrToInt64(x) = Operators.ToInt64 (x) @ (208,40--208,47)"; - "let testIntPtrToUInt64(x) = Operators.ToUInt64 (x) @ (209,40--209,48)"; - "let testIntPtrToIntPtr(x) = Operators.ToIntPtr (x) @ (210,40--210,51)"; - "let testIntPtrToUIntPtr(x) = Operators.ToUIntPtr (x) @ (211,40--211,52)"; - "let testIntPtrToSingle(x) = Operators.ToSingle (x) @ (212,40--212,49)"; - "let testIntPtrToDouble(x) = Operators.ToDouble (x) @ (213,40--213,47)"; - "let testIntPtrToDecimal(x) = Operators.ToDecimal (x) @ (214,40--214,49)"; - "let testIntPtrToChar(x) = Operators.ToChar (x) @ (215,40--215,46)"; - "let testIntPtrToString(x) = Operators.ToString (x) @ (216,40--216,48)"; - "let testUIntPtrToByte(x) = Operators.ToByte (x) @ (218,42--218,48)"; - "let testUIntPtrToSByte(x) = Operators.ToSByte (x) @ (219,42--219,49)"; - "let testUIntPtrToInt16(x) = Operators.ToInt16 (x) @ (220,42--220,49)"; - "let testUIntPtrToUInt16(x) = Operators.ToUInt16 (x) @ (221,42--221,50)"; - "let testUIntPtrToInt32(x) = Operators.ToInt (x) @ (222,42--222,47)"; - "let testUIntPtrToUInt32(x) = Operators.ToUInt32 (x) @ (223,42--223,50)"; - "let testUIntPtrToInt64(x) = Operators.ToInt64 (x) @ (224,42--224,49)"; - "let testUIntPtrToUInt64(x) = Operators.ToUInt64 (x) @ (225,42--225,50)"; - "let testUIntPtrToIntPtr(x) = Operators.ToIntPtr (x) @ (226,42--226,53)"; - "let testUIntPtrToUIntPtr(x) = Operators.ToUIntPtr (x) @ (227,42--227,54)"; - "let testUIntPtrToSingle(x) = Operators.ToSingle (x) @ (228,42--228,51)"; - "let testUIntPtrToDouble(x) = Operators.ToDouble (x) @ (229,42--229,49)"; - "let testUIntPtrToDecimal(x) = Operators.ToDecimal (x) @ (230,42--230,51)"; - "let testUIntPtrToChar(x) = Operators.ToChar (x) @ (231,42--231,48)"; - "let testUIntPtrToString(x) = Operators.ToString (x) @ (232,42--232,50)"; - "let testSingleToByte(x) = Operators.ToByte (x) @ (234,38--234,44)"; - "let testSingleToSByte(x) = Operators.ToSByte (x) @ (235,38--235,45)"; - "let testSingleToInt16(x) = Operators.ToInt16 (x) @ (236,38--236,45)"; - "let testSingleToUInt16(x) = Operators.ToUInt16 (x) @ (237,38--237,46)"; - "let testSingleToInt32(x) = Operators.ToInt (x) @ (238,38--238,43)"; - "let testSingleToUInt32(x) = Operators.ToUInt32 (x) @ (239,38--239,46)"; - "let testSingleToInt64(x) = Operators.ToInt64 (x) @ (240,38--240,45)"; - "let testSingleToUInt64(x) = Operators.ToUInt64 (x) @ (241,38--241,46)"; - "let testSingleToIntPtr(x) = Operators.ToIntPtr (x) @ (242,38--242,49)"; - "let testSingleToUIntPtr(x) = Operators.ToUIntPtr (x) @ (243,38--243,50)"; - "let testSingleToSingle(x) = Operators.ToSingle (x) @ (244,38--244,47)"; - "let testSingleToDouble(x) = Operators.ToDouble (x) @ (245,38--245,45)"; - "let testSingleToDecimal(x) = Operators.ToDecimal (x) @ (246,38--246,47)"; - "let testSingleToChar(x) = Operators.ToChar (x) @ (247,38--247,44)"; - "let testSingleToString(x) = Operators.ToString (x) @ (248,38--248,46)"; - "let testDoubleToByte(x) = Operators.ToByte (x) @ (250,36--250,42)"; - "let testDoubleToSByte(x) = Operators.ToSByte (x) @ (251,36--251,43)"; - "let testDoubleToInt16(x) = Operators.ToInt16 (x) @ (252,36--252,43)"; - "let testDoubleToUInt16(x) = Operators.ToUInt16 (x) @ (253,36--253,44)"; - "let testDoubleToInt32(x) = Operators.ToInt (x) @ (254,36--254,41)"; - "let testDoubleToUInt32(x) = Operators.ToUInt32 (x) @ (255,36--255,44)"; - "let testDoubleToInt64(x) = Operators.ToInt64 (x) @ (256,36--256,43)"; - "let testDoubleToUInt64(x) = Operators.ToUInt64 (x) @ (257,36--257,44)"; - "let testDoubleToIntPtr(x) = Operators.ToIntPtr (x) @ (258,36--258,47)"; - "let testDoubleToUIntPtr(x) = Operators.ToUIntPtr (x) @ (259,36--259,48)"; - "let testDoubleToSingle(x) = Operators.ToSingle (x) @ (260,36--260,45)"; - "let testDoubleToDouble(x) = Operators.ToDouble (x) @ (261,36--261,43)"; - "let testDoubleToDecimal(x) = Operators.ToDecimal (x) @ (262,36--262,45)"; - "let testDoubleToChar(x) = Operators.ToChar (x) @ (263,36--263,42)"; - "let testDoubleToString(x) = Operators.ToString (x) @ (264,36--264,44)"; - "let testDecimalToByte(x) = Operators.ToByte (x) @ (266,39--266,45)"; - "let testDecimalToSByte(x) = Operators.ToSByte (x) @ (267,39--267,46)"; - "let testDecimalToInt16(x) = Operators.ToInt16 (x) @ (268,39--268,46)"; - "let testDecimalToUInt16(x) = Operators.ToUInt16 (x) @ (269,39--269,47)"; - "let testDecimalToInt32(x) = Operators.ToInt (x) @ (270,39--270,44)"; - "let testDecimalToUInt32(x) = Operators.ToUInt32 (x) @ (271,39--271,47)"; - "let testDecimalToInt64(x) = Operators.ToInt64 (x) @ (272,39--272,46)"; - "let testDecimalToUInt64(x) = Operators.ToUInt64 (x) @ (273,39--273,47)"; - "let testDecimalToSingle(x) = Operators.ToSingle (x) @ (274,39--274,48)"; - "let testDecimalToDouble(x) = Operators.ToDouble (x) @ (275,39--275,46)"; - "let testDecimalToDecimal(x) = Operators.ToDecimal (x) @ (276,39--276,48)"; - "let testDecimalToChar(x) = Operators.ToChar (x) @ (277,39--277,45)"; - "let testDecimalToString(x) = Operators.ToString (x) @ (278,39--278,47)"; - "let testCharToByte(x) = Operators.ToByte (x) @ (280,33--280,39)"; - "let testCharToSByte(x) = Operators.ToSByte (x) @ (281,33--281,40)"; - "let testCharToInt16(x) = Operators.ToInt16 (x) @ (282,33--282,40)"; - "let testCharToUInt16(x) = Operators.ToUInt16 (x) @ (283,33--283,41)"; - "let testCharToInt32(x) = Operators.ToInt (x) @ (284,33--284,38)"; - "let testCharToUInt32(x) = Operators.ToUInt32 (x) @ (285,33--285,41)"; - "let testCharToInt64(x) = Operators.ToInt64 (x) @ (286,33--286,40)"; - "let testCharToUInt64(x) = Operators.ToUInt64 (x) @ (287,33--287,41)"; - "let testCharToIntPtr(x) = Operators.ToIntPtr (x) @ (288,33--288,44)"; - "let testCharToUIntPtr(x) = Operators.ToUIntPtr (x) @ (289,33--289,45)"; - "let testCharToSingle(x) = Operators.ToSingle (x) @ (290,33--290,42)"; - "let testCharToDouble(x) = Operators.ToDouble (x) @ (291,33--291,40)"; - "let testCharToChar(x) = Operators.ToChar (x) @ (292,33--292,39)"; - "let testCharToString(x) = Operators.ToString (x) @ (293,33--293,41)"; - "let testStringToByte(x) = Operators.ToByte (x) @ (295,37--295,43)"; - "let testStringToSByte(x) = Operators.ToSByte (x) @ (296,37--296,44)"; - "let testStringToInt16(x) = Operators.ToInt16 (x) @ (297,37--297,44)"; - "let testStringToUInt16(x) = Operators.ToUInt16 (x) @ (298,37--298,45)"; - "let testStringToInt32(x) = Operators.ToInt (x) @ (299,37--299,42)"; - "let testStringToUInt32(x) = Operators.ToUInt32 (x) @ (300,37--300,45)"; - "let testStringToInt64(x) = Operators.ToInt64 (x) @ (301,37--301,44)"; - "let testStringToUInt64(x) = Operators.ToUInt64 (x) @ (302,37--302,45)"; - "let testStringToSingle(x) = Operators.ToSingle (x) @ (303,37--303,46)"; - "let testStringToDouble(x) = Operators.ToDouble (x) @ (304,37--304,44)"; - "let testStringToDecimal(x) = Operators.ToDecimal (x) @ (305,37--305,46)"; - "let testStringToChar(x) = Operators.ToChar (x) @ (306,37--306,43)"; - "let testStringToString(x) = Operators.ToString (x) @ (307,37--307,45)" ] + ] printDeclarations None (List.ofSeq file1.Declarations) |> Seq.toList @@ -1285,109 +788,110 @@ let ``Test Optimized Declarations Project1`` () = s.Replace("ILArrayShape [(Some 0, None)]", "ILArrayShapeFIX") .Replace("ILArrayShape [(Some 0, null)]", "ILArrayShapeFIX")) - let expected = - ["type M"; "type IntAbbrev"; "let boolEx1 = True @ (6,14--6,18)"; - "let intEx1 = 1 @ (7,13--7,14)"; "let int64Ex1 = 1 @ (8,15--8,17)"; - "let tupleEx1 = (1,1) @ (9,16--9,21)"; - "let tupleEx2 = (1,1,1) @ (10,16--10,25)"; - "let tupleEx3 = (1,1,1,1) @ (11,16--11,29)"; - "let localExample = let y: Microsoft.FSharp.Core.int = 1 in let z: Microsoft.FSharp.Core.int = 1 in (y,z) @ (14,7--14,8)"; - "let localGenericFunctionExample(unitVar0) = let y: Microsoft.FSharp.Core.int = 1 in let compiledAsLocalGenericFunction: 'a -> 'a = FUN ... -> fun x -> x in (compiledAsLocalGenericFunction y,compiledAsLocalGenericFunction 1) @ (19,7--19,8)"; - "let funcEx1(x) = x @ (23,23--23,24)"; - "let genericFuncEx1(x) = x @ (24,29--24,30)"; - "let topPair1b = M.patternInput@25 ().Item1 @ (25,4--25,26)"; - "let topPair1a = M.patternInput@25 ().Item0 @ (25,4--25,26)"; - "let testILCall1 = new Object() @ (27,18--27,27)"; - "let testILCall2 = Console.WriteLine (\"176\") @ (28,18--28,49)"; - "let recValNeverUsedAtRuntime = recValNeverUsedAtRuntime@31.Force(()) @ (31,8--31,32)"; - "let recFuncIgnoresFirstArg(g) (v) = v @ (32,33--32,34)"; - "let testFun4(unitVar0) = let rec ... in recValNeverUsedAtRuntime @ (36,4--39,28)"; - "type ClassWithImplicitConstructor"; - "member .ctor(compiledAsArg) = (new Object(); (this.compiledAsArg <- compiledAsArg; (this.compiledAsField <- 1; let compiledAsLocal: Microsoft.FSharp.Core.int = 1 in let compiledAsLocal2: Microsoft.FSharp.Core.int = Operators.op_Addition (compiledAsLocal,compiledAsLocal) in ()))) @ (41,5--41,33)"; - "member .cctor(unitVar) = (compiledAsStaticField <- 1; let compiledAsStaticLocal: Microsoft.FSharp.Core.int = 1 in let compiledAsStaticLocal2: Microsoft.FSharp.Core.int = Operators.op_Addition (compiledAsStaticLocal,compiledAsStaticLocal) in ()) @ (49,11--49,40)"; - "member M1(__) (unitVar1) = Operators.op_Addition (Operators.op_Addition (__.compiledAsField,__.compiledAsGenericInstanceMethod(__.compiledAsField)),__.compiledAsArg) @ (55,21--55,102)"; - "member M2(__) (unitVar1) = __.compiledAsInstanceMethod(()) @ (56,21--56,47)"; - "member SM1(unitVar0) = Operators.op_Addition (compiledAsStaticField,ClassWithImplicitConstructor.compiledAsGenericStaticMethod (compiledAsStaticField)) @ (57,26--57,101)"; - "member SM2(unitVar0) = ClassWithImplicitConstructor.compiledAsStaticMethod (()) @ (58,26--58,50)"; + let expected = [ + "type M"; "type IntAbbrev"; "let boolEx1 = True @ (6,14--6,18)"; + "let intEx1 = 1 @ (7,13--7,14)"; "let int64Ex1 = 1 @ (8,15--8,17)"; + "let tupleEx1 = (1,1) @ (9,16--9,21)"; + "let tupleEx2 = (1,1,1) @ (10,16--10,25)"; + "let tupleEx3 = (1,1,1,1) @ (11,16--11,29)"; + "let localExample = let y: Microsoft.FSharp.Core.int = 1 in let z: Microsoft.FSharp.Core.int = 1 in (y,z) @ (14,7--14,8)"; + "let localGenericFunctionExample(unitVar0) = let y: Microsoft.FSharp.Core.int = 1 in let compiledAsLocalGenericFunction: 'a -> 'a = FUN ... -> fun x -> x in (compiledAsLocalGenericFunction y,compiledAsLocalGenericFunction 1) @ (19,7--19,8)"; + "let funcEx1(x) = x @ (23,23--23,24)"; + "let genericFuncEx1(x) = x @ (24,29--24,30)"; + "let topPair1b = M.patternInput@25 ().Item1 @ (25,4--25,26)"; + "let topPair1a = M.patternInput@25 ().Item0 @ (25,4--25,26)"; + "let testILCall1 = new Object() @ (27,18--27,27)"; + "let testILCall2 = Console.WriteLine (\"176\") @ (28,18--28,49)"; + "let recValNeverUsedAtRuntime = recValNeverUsedAtRuntime@31.Force(()) @ (31,8--31,32)"; + "let recFuncIgnoresFirstArg(g) (v) = v @ (32,33--32,34)"; + "let testFun4(unitVar0) = let rec ... in recValNeverUsedAtRuntime @ (36,4--39,28)"; + "type ClassWithImplicitConstructor"; + "member .ctor(compiledAsArg) = (new Object(); (this.compiledAsArg <- compiledAsArg; (this.compiledAsField <- 1; let compiledAsLocal: Microsoft.FSharp.Core.int = 1 in let compiledAsLocal2: Microsoft.FSharp.Core.int = Operators.op_Addition (compiledAsLocal,compiledAsLocal) in ()))) @ (41,5--41,33)"; + "member .cctor(unitVar) = (compiledAsStaticField <- 1; let compiledAsStaticLocal: Microsoft.FSharp.Core.int = 1 in let compiledAsStaticLocal2: Microsoft.FSharp.Core.int = Operators.op_Addition (compiledAsStaticLocal,compiledAsStaticLocal) in ()) @ (49,11--49,40)"; + "member M1(__) (unitVar1) = Operators.op_Addition (Operators.op_Addition (__.compiledAsField,__.compiledAsGenericInstanceMethod(__.compiledAsField)),__.compiledAsArg) @ (55,21--55,102)"; + "member M2(__) (unitVar1) = __.compiledAsInstanceMethod(()) @ (56,21--56,47)"; + "member SM1(unitVar0) = Operators.op_Addition (compiledAsStaticField,ClassWithImplicitConstructor.compiledAsGenericStaticMethod (compiledAsStaticField)) @ (57,26--57,101)"; + "member SM2(unitVar0) = ClassWithImplicitConstructor.compiledAsStaticMethod (()) @ (58,26--58,50)"; #if NO_PROJECTCRACKER // proxy for COMPILER - "member ToString(__) (unitVar1) = String.Concat (base.ToString(),let value: Microsoft.FSharp.Core.int = 999 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (value) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ...) @ (59,29--59,57)"; + "member ToString(__) (unitVar1) = String.Concat (base.ToString(),let value: Microsoft.FSharp.Core.int = 999 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (value) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ...) @ (59,29--59,57)"; #else - "member ToString(__) (unitVar1) = String.Concat (base.ToString(),let x: Microsoft.FSharp.Core.int = 999 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ...) @ (59,29--59,57)"; + "member ToString(__) (unitVar1) = String.Concat (base.ToString(),let x: Microsoft.FSharp.Core.int = 999 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ...) @ (59,29--59,57)"; #endif - "member TestCallinToString(this) (unitVar1) = this.ToString() @ (60,39--60,54)"; - "type Error"; "let err = {Data0 = 3; Data1 = 4} @ (64,10--64,20)"; - "let matchOnException(err) = match (if err :? M.Error then $0 else $1) targets ... @ (66,33--66,36)"; - "let upwardForLoop(unitVar0) = let mutable a: Microsoft.FSharp.Core.int = 1 in (for-loop; a) @ (69,16--69,17)"; - "let upwardForLoop2(unitVar0) = let mutable a: Microsoft.FSharp.Core.int = 1 in (for-loop; a) @ (74,16--74,17)"; - "let downwardForLoop(unitVar0) = let mutable a: Microsoft.FSharp.Core.int = 1 in (for-loop; a) @ (79,16--79,17)"; - "let quotationTest1(unitVar0) = quote(Operators.op_Addition (1,1)) @ (83,24--83,35)"; - "let quotationTest2(v) = quote(Operators.op_Addition (ExtraTopLevelOperators.SpliceExpression (v),1)) @ (84,24--84,36)"; - "type RecdType"; "type UnionType"; "type ClassWithEventsAndProperties"; - "member .ctor(unitVar0) = (new Object(); (this.ev <- new FSharpEvent`1(()); ())) @ (89,5--89,33)"; - "member .cctor(unitVar) = (sev <- new FSharpEvent`1(()); ()) @ (91,11--91,35)"; - "member get_InstanceProperty(x) (unitVar1) = (x.ev.Trigger(1); 1) @ (92,32--92,48)"; - "member get_StaticProperty(unitVar0) = (sev.Trigger(1); 1) @ (93,35--93,52)"; - "member get_InstanceEvent(x) (unitVar1) = x.ev.get_Publish(()) @ (94,29--94,39)"; - "member get_StaticEvent(x) (unitVar1) = sev.get_Publish(()) @ (95,27--95,38)"; - "let c = new ClassWithEventsAndProperties(()) @ (97,8--97,38)"; - "let v = M.c ().get_InstanceProperty(()) @ (98,8--98,26)"; - "do Console.WriteLine (\"777\")"; - "let functionWithSubmsumption(x) = IntrinsicFunctions.UnboxGeneric (x) @ (102,40--102,52)"; + "member TestCallinToString(this) (unitVar1) = this.ToString() @ (60,39--60,54)"; + "type Error"; "let err = {Data0 = 3; Data1 = 4} @ (64,10--64,20)"; + "let matchOnException(err) = match (if err :? M.Error then $0 else $1) targets ... @ (66,33--66,36)"; + "let upwardForLoop(unitVar0) = let mutable a: Microsoft.FSharp.Core.int = 1 in (for-loop; a) @ (69,16--69,17)"; + "let upwardForLoop2(unitVar0) = let mutable a: Microsoft.FSharp.Core.int = 1 in (for-loop; a) @ (74,16--74,17)"; + "let downwardForLoop(unitVar0) = let mutable a: Microsoft.FSharp.Core.int = 1 in (for-loop; a) @ (79,16--79,17)"; + "let quotationTest1(unitVar0) = quote(Operators.op_Addition (1,1)) @ (83,24--83,35)"; + "let quotationTest2(v) = quote(Operators.op_Addition (ExtraTopLevelOperators.SpliceExpression (v),1)) @ (84,24--84,36)"; + "type RecdType"; "type UnionType"; "type ClassWithEventsAndProperties"; + "member .ctor(unitVar0) = (new Object(); (this.ev <- new FSharpEvent`1(()); ())) @ (89,5--89,33)"; + "member .cctor(unitVar) = (sev <- new FSharpEvent`1(()); ()) @ (91,11--91,35)"; + "member get_InstanceProperty(x) (unitVar1) = (x.ev.Trigger(1); 1) @ (92,32--92,48)"; + "member get_StaticProperty(unitVar0) = (sev.Trigger(1); 1) @ (93,35--93,52)"; + "member get_InstanceEvent(x) (unitVar1) = x.ev.get_Publish(()) @ (94,29--94,39)"; + "member get_StaticEvent(x) (unitVar1) = sev.get_Publish(()) @ (95,27--95,38)"; + "let c = new ClassWithEventsAndProperties(()) @ (97,8--97,38)"; + "let v = M.c ().get_InstanceProperty(()) @ (98,8--98,26)"; + "do Console.WriteLine (\"777\")"; + "let functionWithSubmsumption(x) = IntrinsicFunctions.UnboxGeneric (x) @ (102,40--102,52)"; #if NO_PROJECTCRACKER // proxy for COMPILER - "let functionWithCoercion(x) = let arg: Microsoft.FSharp.Core.string = let arg: Microsoft.FSharp.Core.string = IntrinsicFunctions.UnboxGeneric (x :> Microsoft.FSharp.Core.obj) in M.functionWithSubmsumption (arg :> Microsoft.FSharp.Core.obj) in M.functionWithSubmsumption (arg :> Microsoft.FSharp.Core.obj) @ (103,39--103,116)"; + "let functionWithCoercion(x) = let arg: Microsoft.FSharp.Core.string = let arg: Microsoft.FSharp.Core.string = IntrinsicFunctions.UnboxGeneric (x :> Microsoft.FSharp.Core.obj) in M.functionWithSubmsumption (arg :> Microsoft.FSharp.Core.obj) in M.functionWithSubmsumption (arg :> Microsoft.FSharp.Core.obj) @ (103,39--103,116)"; #else - "let functionWithCoercion(x) = let x: Microsoft.FSharp.Core.string = let x: Microsoft.FSharp.Core.string = IntrinsicFunctions.UnboxGeneric (x :> Microsoft.FSharp.Core.obj) in M.functionWithSubmsumption (x :> Microsoft.FSharp.Core.obj) in M.functionWithSubmsumption (x :> Microsoft.FSharp.Core.obj) @ (103,39--103,116)"; + "let functionWithCoercion(x) = let x: Microsoft.FSharp.Core.string = let x: Microsoft.FSharp.Core.string = IntrinsicFunctions.UnboxGeneric (x :> Microsoft.FSharp.Core.obj) in M.functionWithSubmsumption (x :> Microsoft.FSharp.Core.obj) in M.functionWithSubmsumption (x :> Microsoft.FSharp.Core.obj) @ (103,39--103,116)"; #endif - "type MultiArgMethods"; - "member .ctor(c,d) = (new Object(); ()) @ (105,5--105,20)"; - "member Method(x) (a,b) = 1 @ (106,37--106,38)"; - "member CurriedMethod(x) (a1,b1) (a2,b2) = 1 @ (107,63--107,64)"; - "let testFunctionThatCallsMultiArgMethods(unitVar0) = let m: M.MultiArgMethods = new MultiArgMethods(3,4) in Operators.op_Addition (m.Method(7,8),let arg00: Microsoft.FSharp.Core.int = 9 in let arg01: Microsoft.FSharp.Core.int = 10 in let arg10: Microsoft.FSharp.Core.int = 11 in let arg11: Microsoft.FSharp.Core.int = 12 in m.CurriedMethod(arg00,arg01,arg10,arg11)) @ (110,8--110,9)"; + "type MultiArgMethods"; + "member .ctor(c,d) = (new Object(); ()) @ (105,5--105,20)"; + "member Method(x) (a,b) = 1 @ (106,37--106,38)"; + "member CurriedMethod(x) (a1,b1) (a2,b2) = 1 @ (107,63--107,64)"; + "let testFunctionThatCallsMultiArgMethods(unitVar0) = let m: M.MultiArgMethods = new MultiArgMethods(3,4) in Operators.op_Addition (m.Method(7,8),let arg00: Microsoft.FSharp.Core.int = 9 in let arg01: Microsoft.FSharp.Core.int = 10 in let arg10: Microsoft.FSharp.Core.int = 11 in let arg11: Microsoft.FSharp.Core.int = 12 in m.CurriedMethod(arg00,arg01,arg10,arg11)) @ (110,8--110,9)"; #if NO_PROJECTCRACKER // proxy for COMPILER - "let functionThatUsesObjectExpression(unitVar0) = { new Object() with member x.ToString(unitVar1) = let value: Microsoft.FSharp.Core.int = 888 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (value) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... } @ (114,3--114,55)"; - "let functionThatUsesObjectExpressionWithInterfaceImpl(unitVar0) = { new Object() with member x.ToString(unitVar1) = let value: Microsoft.FSharp.Core.int = 888 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (value) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... interface System.IComparable with member x.CompareTo(y) = 0 } :> System.IComparable @ (117,3--120,38)"; + "let functionThatUsesObjectExpression(unitVar0) = { new Object() with member x.ToString(unitVar1) = let value: Microsoft.FSharp.Core.int = 888 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (value) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... } @ (114,3--114,55)"; + "let functionThatUsesObjectExpressionWithInterfaceImpl(unitVar0) = { new Object() with member x.ToString(unitVar1) = let value: Microsoft.FSharp.Core.int = 888 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (value) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... interface System.IComparable with member x.CompareTo(y) = 0 } :> System.IComparable @ (117,3--120,38)"; #else - "let functionThatUsesObjectExpression(unitVar0) = { new Object() with member x.ToString(unitVar1) = let x: Microsoft.FSharp.Core.int = 888 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... } @ (114,3--114,55)"; - "let functionThatUsesObjectExpressionWithInterfaceImpl(unitVar0) = { new Object() with member x.ToString(unitVar1) = let x: Microsoft.FSharp.Core.int = 888 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... interface System.IComparable with member x.CompareTo(y) = 0 } :> System.IComparable @ (117,3--120,38)"; + "let functionThatUsesObjectExpression(unitVar0) = { new Object() with member x.ToString(unitVar1) = let x: Microsoft.FSharp.Core.int = 888 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... } @ (114,3--114,55)"; + "let functionThatUsesObjectExpressionWithInterfaceImpl(unitVar0) = { new Object() with member x.ToString(unitVar1) = let x: Microsoft.FSharp.Core.int = 888 in let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... interface System.IComparable with member x.CompareTo(y) = 0 } :> System.IComparable @ (117,3--120,38)"; #endif - "let testFunctionThatUsesUnitsOfMeasure(x) (y) = Operators.op_Addition,Microsoft.FSharp.Core.float<'u>,Microsoft.FSharp.Core.float<'u>> (x,y) @ (122,70--122,75)"; - "let testFunctionThatUsesAddressesAndByrefs(x) = let mutable w: Microsoft.FSharp.Core.int = 4 in let y1: Microsoft.FSharp.Core.byref = x in let y2: Microsoft.FSharp.Core.byref = &w in let arr: Microsoft.FSharp.Core.int Microsoft.FSharp.Core.[] = [|3; 4|] in let r: Microsoft.FSharp.Core.int Microsoft.FSharp.Core.ref = Operators.Ref (3) in let y3: Microsoft.FSharp.Core.byref = [I_ldelema (NormalAddress,false,ILArrayShapeFIX,TypeVar 0us)](arr,0) in let y4: Microsoft.FSharp.Core.byref = &r.contents in let z: Microsoft.FSharp.Core.int = Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (x,y1),y2),y3) in (w <- 3; (x <- 4; (y2 <- 4; (y3 <- 5; Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (z,x),y1),y2),y3),y4),IntrinsicFunctions.GetArray (arr,0)),r.contents))))) @ (125,16--125,17)"; - "let testFunctionThatUsesStructs1(dt) = dt.AddDays(3) @ (139,57--139,72)"; - "let testFunctionThatUsesStructs2(unitVar0) = let dt1: System.DateTime = DateTime.get_Now () in let mutable dt2: System.DateTime = DateTime.get_Now () in let dt3: System.TimeSpan = DateTime.op_Subtraction (dt1,dt2) in let dt4: System.DateTime = dt1.AddDays(3) in let dt5: Microsoft.FSharp.Core.int = dt1.get_Millisecond() in let dt6: Microsoft.FSharp.Core.byref = &dt2 in let dt7: System.TimeSpan = DateTime.op_Subtraction (dt6,dt4) in dt7 @ (142,7--142,10)"; - "let testFunctionThatUsesWhileLoop(unitVar0) = let mutable x: Microsoft.FSharp.Core.int = 1 in (while Operators.op_LessThan (x,100) do x <- Operators.op_Addition (x,1) done; x) @ (152,15--152,16)"; - "let testFunctionThatUsesTryWith(unitVar0) = try M.testFunctionThatUsesWhileLoop (()) with matchValue -> match (if matchValue :? System.ArgumentException then $0 else $1) targets ... @ (158,3--160,60)"; - "let testFunctionThatUsesTryFinally(unitVar0) = try M.testFunctionThatUsesWhileLoop (()) finally Console.WriteLine (\"8888\") @ (164,3--167,37)"; - "member Console.WriteTwoLines.Static(unitVar0) = (Console.WriteLine (); Console.WriteLine ()) @ (170,36--170,90)"; - "member DateTime.get_TwoMinute(x) (unitVar1) = Operators.op_Addition (x.get_Minute(),x.get_Minute()) @ (173,25--173,44)"; - "let testFunctionThatUsesExtensionMembers(unitVar0) = (M.Console.WriteTwoLines.Static (()); let v: Microsoft.FSharp.Core.int = DateTime.get_Now ().DateTime.get_TwoMinute(()) in M.Console.WriteTwoLines.Static (())) @ (176,3--178,33)"; - "let testFunctionThatUsesOptionMembers(unitVar0) = let x: Microsoft.FSharp.Core.int Microsoft.FSharp.Core.option = Some(3) in (x.get_IsSome() (),x.get_IsNone() ()) @ (181,7--181,8)"; - "let testFunctionThatUsesOverAppliedFunction(unitVar0) = Operators.Identity Microsoft.FSharp.Core.int> (fun x -> Operators.Identity (x)) 3 @ (185,3--185,10)"; - "let testFunctionThatUsesPatternMatchingOnLists(x) = match (if x.Isop_ColonColon then (if x.Tail.Isop_ColonColon then (if x.Tail.Tail.Isop_Nil then $2 else $3) else $1) else $0) targets ... @ (188,10--188,11)"; - "let testFunctionThatUsesPatternMatchingOnOptions(x) = match (if x.IsSome then $1 else $0) targets ... @ (195,10--195,11)"; - "let testFunctionThatUsesPatternMatchingOnOptions2(x) = match (if x.IsSome then $1 else $0) targets ... @ (200,10--200,11)"; - "let testFunctionThatUsesConditionalOnOptions2(x) = (if x.get_IsSome() () then 1 else 2) @ (205,4--205,29)"; - "let f(x) (y) = Operators.op_Addition (x,y) @ (207,12--207,15)"; - "let g = let x: Microsoft.FSharp.Core.int = 1 in fun y -> M.f (x,y) @ (208,8--208,11)"; - "let h = Operators.op_Addition (M.g () 2,3) @ (209,8--209,17)"; - "type TestFuncProp"; - "member .ctor(unitVar0) = (new Object(); ()) @ (211,5--211,17)"; - "member get_Id(this) (unitVar1) = fun x -> x @ (212,21--212,31)"; - "let wrong = Operators.op_Equality (new TestFuncProp(()).get_Id(()) 0,0) @ (214,12--214,35)"; - "let start(name) = (name,name) @ (217,4--217,14)"; - "let last(name,values) = Operators.Identity ((name,values)) @ (220,4--220,21)"; - "let last2(name) = Operators.Identity (name) @ (223,4--223,11)"; - "let test7(s) = let tupledArg: Microsoft.FSharp.Core.string * Microsoft.FSharp.Core.string = M.start (s) in let name: Microsoft.FSharp.Core.string = tupledArg.Item0 in let values: Microsoft.FSharp.Core.string = tupledArg.Item1 in M.last (name,values) @ (226,4--226,19)"; - "let test8(unitVar0) = fun tupledArg -> let name: Microsoft.FSharp.Core.string = tupledArg.Item0 in let values: Microsoft.FSharp.Core.string = tupledArg.Item1 in M.last (name,values) @ (229,4--229,8)"; - "let test9(s) = M.last (s,s) @ (232,4--232,17)"; - "let test10(unitVar0) = fun name -> M.last2 (name) @ (235,4--235,9)"; - "let test11(s) = M.last2 (s) @ (238,4--238,14)"; - "let badLoop = badLoop@240.Force Microsoft.FSharp.Core.int>(()) @ (240,8--240,15)"; - "type LetLambda"; - "let f = fun a -> fun b -> Operators.op_Addition (a,b) @ (247,8--247,24)"; - "let letLambdaRes = ListModule.Map (fun tupledArg -> let a: Microsoft.FSharp.Core.int = tupledArg.Item0 in let b: Microsoft.FSharp.Core.int = tupledArg.Item1 in (LetLambda.f () a) b,Cons((1,2),Empty())) @ (249,19--249,71)"] - - let expected2 = - [ "type N"; "type IntAbbrev"; "let bool2 = False @ (6,12--6,17)"; + "let testFunctionThatUsesUnitsOfMeasure(x) (y) = Operators.op_Addition,Microsoft.FSharp.Core.float<'u>,Microsoft.FSharp.Core.float<'u>> (x,y) @ (122,70--122,75)"; + "let testFunctionThatUsesAddressesAndByrefs(x) = let mutable w: Microsoft.FSharp.Core.int = 4 in let y1: Microsoft.FSharp.Core.byref = x in let y2: Microsoft.FSharp.Core.byref = &w in let arr: Microsoft.FSharp.Core.int Microsoft.FSharp.Core.[] = [|3; 4|] in let r: Microsoft.FSharp.Core.int Microsoft.FSharp.Core.ref = Operators.Ref (3) in let y3: Microsoft.FSharp.Core.byref = [I_ldelema (NormalAddress,false,ILArrayShapeFIX,TypeVar 0us)](arr,0) in let y4: Microsoft.FSharp.Core.byref = &r.contents in let z: Microsoft.FSharp.Core.int = Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (x,y1),y2),y3) in (w <- 3; (x <- 4; (y2 <- 4; (y3 <- 5; Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (Operators.op_Addition (z,x),y1),y2),y3),y4),IntrinsicFunctions.GetArray (arr,0)),r.contents))))) @ (125,16--125,17)"; + "let testFunctionThatUsesStructs1(dt) = dt.AddDays(3) @ (139,57--139,72)"; + "let testFunctionThatUsesStructs2(unitVar0) = let dt1: System.DateTime = DateTime.get_Now () in let mutable dt2: System.DateTime = DateTime.get_Now () in let dt3: System.TimeSpan = DateTime.op_Subtraction (dt1,dt2) in let dt4: System.DateTime = dt1.AddDays(3) in let dt5: Microsoft.FSharp.Core.int = dt1.get_Millisecond() in let dt6: Microsoft.FSharp.Core.byref = &dt2 in let dt7: System.TimeSpan = DateTime.op_Subtraction (dt6,dt4) in dt7 @ (142,7--142,10)"; + "let testFunctionThatUsesWhileLoop(unitVar0) = let mutable x: Microsoft.FSharp.Core.int = 1 in (while Operators.op_LessThan (x,100) do x <- Operators.op_Addition (x,1) done; x) @ (152,15--152,16)"; + "let testFunctionThatUsesTryWith(unitVar0) = try M.testFunctionThatUsesWhileLoop (()) with matchValue -> match (if matchValue :? System.ArgumentException then $0 else $1) targets ... @ (158,3--160,60)"; + "let testFunctionThatUsesTryFinally(unitVar0) = try M.testFunctionThatUsesWhileLoop (()) finally Console.WriteLine (\"8888\") @ (164,3--167,37)"; + "member Console.WriteTwoLines.Static(unitVar0) = (Console.WriteLine (); Console.WriteLine ()) @ (170,36--170,90)"; + "member DateTime.get_TwoMinute(x) (unitVar1) = Operators.op_Addition (x.get_Minute(),x.get_Minute()) @ (173,25--173,44)"; + "let testFunctionThatUsesExtensionMembers(unitVar0) = (M.Console.WriteTwoLines.Static (()); let v: Microsoft.FSharp.Core.int = DateTime.get_Now ().DateTime.get_TwoMinute(()) in M.Console.WriteTwoLines.Static (())) @ (176,3--178,33)"; + "let testFunctionThatUsesOptionMembers(unitVar0) = let x: Microsoft.FSharp.Core.int Microsoft.FSharp.Core.option = Some(3) in (x.get_IsSome() (),x.get_IsNone() ()) @ (181,7--181,8)"; + "let testFunctionThatUsesOverAppliedFunction(unitVar0) = Operators.Identity Microsoft.FSharp.Core.int> (fun x -> Operators.Identity (x)) 3 @ (185,3--185,10)"; + "let testFunctionThatUsesPatternMatchingOnLists(x) = match (if x.Isop_ColonColon then (if x.Tail.Isop_ColonColon then (if x.Tail.Tail.Isop_Nil then $2 else $3) else $1) else $0) targets ... @ (188,10--188,11)"; + "let testFunctionThatUsesPatternMatchingOnOptions(x) = match (if x.IsSome then $1 else $0) targets ... @ (195,10--195,11)"; + "let testFunctionThatUsesPatternMatchingOnOptions2(x) = match (if x.IsSome then $1 else $0) targets ... @ (200,10--200,11)"; + "let testFunctionThatUsesConditionalOnOptions2(x) = (if x.get_IsSome() () then 1 else 2) @ (205,4--205,29)"; + "let f(x) (y) = Operators.op_Addition (x,y) @ (207,12--207,15)"; + "let g = let x: Microsoft.FSharp.Core.int = 1 in fun y -> M.f (x,y) @ (208,8--208,11)"; + "let h = Operators.op_Addition (M.g () 2,3) @ (209,8--209,17)"; + "type TestFuncProp"; + "member .ctor(unitVar0) = (new Object(); ()) @ (211,5--211,17)"; + "member get_Id(this) (unitVar1) = fun x -> x @ (212,21--212,31)"; + "let wrong = Operators.op_Equality (new TestFuncProp(()).get_Id(()) 0,0) @ (214,12--214,35)"; + "let start(name) = (name,name) @ (217,4--217,14)"; + "let last(name,values) = Operators.Identity ((name,values)) @ (220,4--220,21)"; + "let last2(name) = Operators.Identity (name) @ (223,4--223,11)"; + "let test7(s) = let tupledArg: Microsoft.FSharp.Core.string * Microsoft.FSharp.Core.string = M.start (s) in let name: Microsoft.FSharp.Core.string = tupledArg.Item0 in let values: Microsoft.FSharp.Core.string = tupledArg.Item1 in M.last (name,values) @ (226,4--226,19)"; + "let test8(unitVar0) = fun tupledArg -> let name: Microsoft.FSharp.Core.string = tupledArg.Item0 in let values: Microsoft.FSharp.Core.string = tupledArg.Item1 in M.last (name,values) @ (229,4--229,8)"; + "let test9(s) = M.last (s,s) @ (232,4--232,17)"; + "let test10(unitVar0) = fun name -> M.last2 (name) @ (235,4--235,9)"; + "let test11(s) = M.last2 (s) @ (238,4--238,14)"; + "let badLoop = badLoop@240.Force Microsoft.FSharp.Core.int>(()) @ (240,8--240,15)"; + "type LetLambda"; + "let f = fun a -> fun b -> Operators.op_Addition (a,b) @ (247,8--247,24)"; + "let letLambdaRes = ListModule.Map (fun tupledArg -> let a: Microsoft.FSharp.Core.int = tupledArg.Item0 in let b: Microsoft.FSharp.Core.int = tupledArg.Item1 in (LetLambda.f () a) b,Cons((1,2),Empty())) @ (249,19--249,71)"; + ] + + let expected2 = [ + "type N"; "type IntAbbrev"; "let bool2 = False @ (6,12--6,17)"; "let testHashChar(x) = Operators.op_BitwiseOr (Operators.op_LeftShift (x,16),x) @ (8,28--8,34)"; "let testHashSByte(x) = Operators.op_ExclusiveOr (Operators.op_LeftShift (x,8),x) @ (9,30--9,36)"; "let testHashInt16(x) = Operators.op_BitwiseOr (Operators.ToUInt16 (x),Operators.op_LeftShift (x,16)) @ (10,30--10,36)"; @@ -1397,276 +901,7 @@ let ``Test Optimized Declarations Project1`` () = "let testHashUIntPtr(x) = Operators.op_BitwiseAnd (Operators.ToInt32 (Operators.ToUInt64 (x)),2147483647) @ (14,37--14,43)"; "let testHashString(x) = (if Operators.op_Equality (x,dflt) then 0 else Operators.Hash (x)) @ (16,32--16,38)"; "let testTypeOf(x) = Operators.TypeOf<'T> () @ (17,24--17,30)"; - "let testEqualsOperator(e1) (e2) = HashCompare.GenericEqualityIntrinsic<'a> (e1,e2) @ (19,46--19,54)"; - "let testNotEqualsOperator(e1) (e2) = Operators.op_Equality (HashCompare.GenericEqualityIntrinsic<'a> (e1,e2),False) @ (20,46--20,55)"; - "let testLessThanOperator(e1) (e2) = HashCompare.GenericLessThanIntrinsic<'a> (e1,e2) @ (21,46--21,54)"; - "let testLessThanOrEqualsOperator(e1) (e2) = HashCompare.GenericLessOrEqualIntrinsic<'a> (e1,e2) @ (22,46--22,55)"; - "let testGreaterThanOperator(e1) (e2) = HashCompare.GenericGreaterThanIntrinsic<'a> (e1,e2) @ (23,46--23,54)"; - "let testGreaterThanOrEqualsOperator(e1) (e2) = HashCompare.GenericGreaterOrEqualIntrinsic<'a> (e1,e2) @ (24,46--24,55)"; - "let testAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (26,38--26,46)"; - "let testSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (27,38--27,46)"; - "let testMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (28,37--28,46)"; - "let testDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (29,38--29,46)"; - "let testModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (30,38--30,46)"; - "let testBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (31,38--31,48)"; - "let testBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (32,38--32,48)"; - "let testBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (33,38--33,48)"; - "let testShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,Operators.op_BitwiseAnd (e2,31)) @ (34,38--34,48)"; - "let testShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,Operators.op_BitwiseAnd (e2,31)) @ (35,38--35,48)"; - "let testUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (37,33--37,39)"; - "let testUnaryNotOperator(e1) = Operators.op_Equality (e1,False) @ (38,32--38,35)"; - "let testAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (40,35--40,52)"; - "let testSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (41,35--41,52)"; - "let testMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (42,35--42,52)"; - "let testUnaryNegChecked(e1) = Checked.op_Subtraction (0,e1) @ (43,32--43,47)"; - "let testToByteChecked(e1) = Checked.ToByte (e1) @ (45,32--45,47)"; - "let testToSByteChecked(e1) = Checked.ToSByte (e1) @ (46,32--46,48)"; - "let testToInt16Checked(e1) = Checked.ToInt16 (e1) @ (47,32--47,48)"; - "let testToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (48,32--48,49)"; - "let testToIntChecked(e1) = Checked.ToInt32 (e1) @ (49,32--49,46)"; - "let testToInt32Checked(e1) = Checked.ToInt32 (e1) @ (50,32--50,48)"; - "let testToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (51,32--51,49)"; - "let testToInt64Checked(e1) = Checked.ToInt64 (e1) @ (52,32--52,48)"; - "let testToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (53,32--53,49)"; - "let testToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (54,32--54,52)"; - "let testToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (55,32--55,53)"; - "let testToByteOperator(e1) = Operators.ToByte (e1) @ (57,32--57,39)"; - "let testToSByteOperator(e1) = Operators.ToSByte (e1) @ (58,32--58,40)"; - "let testToInt16Operator(e1) = Operators.ToInt16 (e1) @ (59,32--59,40)"; - "let testToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (60,32--60,41)"; - "let testToIntOperator(e1) = e1 @ (61,36--61,38)"; - "let testToInt32Operator(e1) = e1 @ (62,38--62,40)"; - "let testToUInt32Operator(e1) = e1 @ (63,32--63,41)"; - "let testToInt64Operator(e1) = Operators.ToInt64 (e1) @ (64,32--64,40)"; - "let testToUInt64Operator(e1) = Operators.ToInt64 (e1) @ (65,32--65,41)"; - "let testToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (66,32--66,44)"; - "let testToUIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (67,32--67,45)"; - "let testToSingleOperator(e1) = Operators.ToSingle (e1) @ (68,32--68,42)"; - "let testToDoubleOperator(e1) = Operators.ToDouble (e1) @ (69,32--69,40)"; - "let testToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (70,32--70,42)"; - "let testToCharOperator(e1) = Operators.ToUInt16 (e1) @ (71,32--71,39)"; - "let testToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (72,32--72,41)"; - "let testByteToByte(x) = Operators.ToByte (x) @ (74,33--74,39)"; - "let testByteToSByte(x) = Operators.ToSByte (x) @ (75,33--75,40)"; - "let testByteToInt16(x) = Operators.ToInt16 (x) @ (76,33--76,40)"; - "let testByteToUInt16(x) = Operators.ToUInt16 (x) @ (77,33--77,41)"; - "let testByteToInt32(x) = Operators.ToInt32 (x) @ (78,33--78,38)"; - "let testByteToUInt32(x) = Operators.ToUInt32 (x) @ (79,33--79,41)"; - "let testByteToInt64(x) = Operators.ToUInt64 (x) @ (80,33--80,40)"; - "let testByteToUInt64(x) = Operators.ToUInt64 (x) @ (81,33--81,41)"; - "let testByteToIntPtr(x) = Operators.ToIntPtr (x) @ (82,33--82,44)"; - "let testByteToUIntPtr(x) = Operators.ToUIntPtr (x) @ (83,33--83,45)"; - "let testByteToSingle(x) = Operators.ToSingle (Operators.ToDouble (x)) @ (84,33--84,42)"; - "let testByteToDouble(x) = Operators.ToDouble (Operators.ToDouble (x)) @ (85,33--85,40)"; - "let testByteToDecimal(x) = Convert.ToDecimal (x) @ (86,33--86,42)"; - "let testByteToChar(x) = Operators.ToUInt16 (x) @ (87,33--87,39)"; - "let testByteToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (88,33--88,41)"; - "let testSByteToByte(x) = Operators.ToByte (x) @ (90,35--90,41)"; - "let testSByteToSByte(x) = Operators.ToSByte (x) @ (91,35--91,42)"; - "let testSByteToInt16(x) = Operators.ToInt16 (x) @ (92,35--92,42)"; - "let testSByteToUInt16(x) = Operators.ToUInt16 (x) @ (93,35--93,43)"; - "let testSByteToInt32(x) = x @ (94,35--94,40)"; - "let testSByteToUInt32(x) = x @ (95,35--95,43)"; - "let testSByteToInt64(x) = Operators.ToInt64 (x) @ (96,35--96,42)"; - "let testSByteToUInt64(x) = Operators.ToInt64 (x) @ (97,35--97,43)"; - "let testSByteToIntPtr(x) = Operators.ToIntPtr (x) @ (98,35--98,46)"; - "let testSByteToUIntPtr(x) = Operators.ToIntPtr (x) @ (99,35--99,47)"; - "let testSByteToSingle(x) = Operators.ToSingle (x) @ (100,35--100,44)"; - "let testSByteToDouble(x) = Operators.ToDouble (x) @ (101,35--101,42)"; - "let testSByteToDecimal(x) = Convert.ToDecimal (x) @ (102,35--102,44)"; - "let testSByteToChar(x) = Operators.ToUInt16 (x) @ (103,35--103,41)"; - "let testSByteToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (104,35--104,43)"; - "let testInt16ToByte(x) = Operators.ToByte (x) @ (106,35--106,41)"; - "let testInt16ToSByte(x) = Operators.ToSByte (x) @ (107,35--107,42)"; - "let testInt16ToInt16(x) = Operators.ToInt16 (x) @ (108,35--108,42)"; - "let testInt16ToUInt16(x) = Operators.ToUInt16 (x) @ (109,35--109,43)"; - "let testInt16ToInt32(x) = x @ (110,35--110,40)"; - "let testInt16ToUInt32(x) = x @ (111,35--111,43)"; - "let testInt16ToInt64(x) = Operators.ToInt64 (x) @ (112,35--112,42)"; - "let testInt16ToUInt64(x) = Operators.ToInt64 (x) @ (113,35--113,43)"; - "let testInt16ToIntPtr(x) = Operators.ToIntPtr (x) @ (114,35--114,46)"; - "let testInt16ToUIntPtr(x) = Operators.ToIntPtr (x) @ (115,35--115,47)"; - "let testInt16ToSingle(x) = Operators.ToSingle (x) @ (116,35--116,44)"; - "let testInt16ToDouble(x) = Operators.ToDouble (x) @ (117,35--117,42)"; - "let testInt16ToDecimal(x) = Convert.ToDecimal (x) @ (118,35--118,44)"; - "let testInt16ToChar(x) = Operators.ToUInt16 (x) @ (119,35--119,41)"; - "let testInt16ToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (120,35--120,43)"; - "let testUInt16ToByte(x) = Operators.ToByte (x) @ (122,37--122,43)"; - "let testUInt16ToSByte(x) = Operators.ToSByte (x) @ (123,37--123,44)"; - "let testUInt16ToInt16(x) = Operators.ToInt16 (x) @ (124,37--124,44)"; - "let testUInt16ToUInt16(x) = Operators.ToUInt16 (x) @ (125,37--125,45)"; - "let testUInt16ToInt32(x) = Operators.ToInt32 (x) @ (126,37--126,42)"; - "let testUInt16ToUInt32(x) = Operators.ToUInt32 (x) @ (127,37--127,45)"; - "let testUInt16ToInt64(x) = Operators.ToUInt64 (x) @ (128,37--128,44)"; - "let testUInt16ToUInt64(x) = Operators.ToUInt64 (x) @ (129,37--129,45)"; - "let testUInt16ToIntPtr(x) = Operators.ToUIntPtr (x) @ (130,37--130,48)"; - "let testUInt16ToUIntPtr(x) = Operators.ToUIntPtr (x) @ (131,37--131,49)"; - "let testUInt16ToSingle(x) = Operators.ToSingle (Operators.ToDouble (x)) @ (132,37--132,46)"; - "let testUInt16ToDouble(x) = Operators.ToDouble (Operators.ToDouble (x)) @ (133,37--133,44)"; - "let testUInt16ToDecimal(x) = Convert.ToDecimal (x) @ (134,37--134,46)"; - "let testUInt16ToChar(x) = Operators.ToUInt16 (x) @ (135,37--135,43)"; - "let testUInt16ToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (136,37--136,45)"; - "let testInt32ToByte(x) = Operators.ToByte (x) @ (138,33--138,39)"; - "let testInt32ToSByte(x) = Operators.ToSByte (x) @ (139,33--139,40)"; - "let testInt32ToInt16(x) = Operators.ToInt16 (x) @ (140,33--140,40)"; - "let testInt32ToUInt16(x) = Operators.ToUInt16 (x) @ (141,33--141,41)"; - "let testInt32ToInt32(x) = x @ (142,37--142,38)"; - "let testInt32ToUInt32(x) = x @ (143,33--143,41)"; - "let testInt32ToInt64(x) = Operators.ToInt64 (x) @ (144,33--144,40)"; - "let testInt32ToUInt64(x) = Operators.ToInt64 (x) @ (145,33--145,41)"; - "let testInt32ToIntPtr(x) = Operators.ToIntPtr (x) @ (146,33--146,44)"; - "let testInt32ToUIntPtr(x) = Operators.ToIntPtr (x) @ (147,33--147,45)"; - "let testInt32ToSingle(x) = Operators.ToSingle (x) @ (148,33--148,42)"; - "let testInt32ToDouble(x) = Operators.ToDouble (x) @ (149,33--149,40)"; - "let testInt32ToDecimal(x) = Convert.ToDecimal (x) @ (150,33--150,42)"; - "let testInt32ToChar(x) = Operators.ToUInt16 (x) @ (151,33--151,39)"; - "let testInt32ToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (152,33--152,41)"; - "let testUInt32ToByte(x) = Operators.ToByte (x) @ (154,37--154,43)"; - "let testUInt32ToSByte(x) = Operators.ToSByte (x) @ (155,37--155,44)"; - "let testUInt32ToInt16(x) = Operators.ToInt16 (x) @ (156,37--156,44)"; - "let testUInt32ToUInt16(x) = Operators.ToUInt16 (x) @ (157,37--157,45)"; - "let testUInt32ToInt32(x) = x @ (158,37--158,42)"; - "let testUInt32ToUInt32(x) = Operators.ToUInt32 (x) @ (159,37--159,45)"; - "let testUInt32ToInt64(x) = Operators.ToUInt64 (x) @ (160,37--160,44)"; - "let testUInt32ToUInt64(x) = Operators.ToUInt64 (x) @ (161,37--161,45)"; - "let testUInt32ToIntPtr(x) = Operators.ToUIntPtr (x) @ (162,37--162,48)"; - "let testUInt32ToUIntPtr(x) = Operators.ToUIntPtr (x) @ (163,37--163,49)"; - "let testUInt32ToSingle(x) = Operators.ToSingle (Operators.ToDouble (x)) @ (164,37--164,46)"; - "let testUInt32ToDouble(x) = Operators.ToDouble (Operators.ToDouble (x)) @ (165,37--165,44)"; - "let testUInt32ToDecimal(x) = Convert.ToDecimal (x) @ (166,37--166,46)"; - "let testUInt32ToChar(x) = Operators.ToUInt16 (x) @ (167,37--167,43)"; - "let testUInt32ToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (168,37--168,45)"; - "let testInt64ToByte(x) = Operators.ToByte (x) @ (170,35--170,41)"; - "let testInt64ToSByte(x) = Operators.ToSByte (x) @ (171,35--171,42)"; - "let testInt64ToInt16(x) = Operators.ToInt16 (x) @ (172,35--172,42)"; - "let testInt64ToUInt16(x) = Operators.ToUInt16 (x) @ (173,35--173,43)"; - "let testInt64ToInt32(x) = Operators.ToInt32 (x) @ (174,35--174,40)"; - "let testInt64ToUInt32(x) = Operators.ToUInt32 (x) @ (175,35--175,43)"; - "let testInt64ToInt64(x) = Operators.ToInt64 (x) @ (176,35--176,42)"; - "let testInt64ToUInt64(x) = x @ (177,35--177,43)"; - "let testInt64ToIntPtr(x) = Operators.ToIntPtr (x) @ (178,35--178,46)"; - "let testInt64ToUIntPtr(x) = Operators.ToIntPtr (x) @ (179,35--179,47)"; - "let testInt64ToSingle(x) = Operators.ToSingle (x) @ (180,35--180,44)"; - "let testInt64ToDouble(x) = Operators.ToDouble (x) @ (181,35--181,42)"; - "let testInt64ToDecimal(x) = Convert.ToDecimal (x) @ (182,35--182,44)"; - "let testInt64ToChar(x) = Operators.ToUInt16 (x) @ (183,35--183,41)"; - "let testInt64ToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (184,35--184,43)"; - "let testUInt64ToByte(x) = Operators.ToByte (x) @ (186,37--186,43)"; - "let testUInt64ToSByte(x) = Operators.ToSByte (x) @ (187,37--187,44)"; - "let testUInt64ToInt16(x) = Operators.ToInt16 (x) @ (188,37--188,44)"; - "let testUInt64ToUInt16(x) = Operators.ToUInt16 (x) @ (189,37--189,45)"; - "let testUInt64ToInt32(x) = Operators.ToInt32 (x) @ (190,37--190,42)"; - "let testUInt64ToUInt32(x) = Operators.ToUInt32 (x) @ (191,37--191,45)"; - "let testUInt64ToInt64(x) = x @ (192,37--192,44)"; - "let testUInt64ToUInt64(x) = x @ (193,44--193,45)"; - "let testUInt64ToIntPtr(x) = Operators.ToUIntPtr (x) @ (194,37--194,48)"; - "let testUInt64ToUIntPtr(x) = Operators.ToUIntPtr (x) @ (195,37--195,49)"; - "let testUInt64ToSingle(x) = Operators.ToSingle (Operators.ToDouble (x)) @ (196,37--196,46)"; - "let testUInt64ToDouble(x) = Operators.ToDouble (Operators.ToDouble (x)) @ (197,37--197,44)"; - "let testUInt64ToDecimal(x) = Convert.ToDecimal (x) @ (198,37--198,46)"; - "let testUInt64ToChar(x) = Operators.ToUInt16 (x) @ (199,37--199,43)"; - "let testUInt64ToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (200,37--200,45)"; - "let testIntPtrToByte(x) = Operators.ToByte (x) @ (202,40--202,46)"; - "let testIntPtrToSByte(x) = Operators.ToSByte (x) @ (203,40--203,47)"; - "let testIntPtrToInt16(x) = Operators.ToInt16 (x) @ (204,40--204,47)"; - "let testIntPtrToUInt16(x) = Operators.ToUInt16 (x) @ (205,40--205,48)"; - "let testIntPtrToInt32(x) = Operators.ToInt32 (x) @ (206,40--206,45)"; - "let testIntPtrToUInt32(x) = Operators.ToUInt32 (x) @ (207,40--207,48)"; - "let testIntPtrToInt64(x) = Operators.ToInt64 (x) @ (208,40--208,47)"; - "let testIntPtrToUInt64(x) = Operators.ToInt64 (x) @ (209,40--209,48)"; - "let testIntPtrToIntPtr(x) = Operators.ToIntPtr (x) @ (210,40--210,51)"; - "let testIntPtrToUIntPtr(x) = x @ (211,40--211,52)"; - "let testIntPtrToSingle(x) = Operators.ToSingle (x) @ (212,40--212,49)"; - "let testIntPtrToDouble(x) = Operators.ToDouble (x) @ (213,40--213,47)"; - "let testIntPtrToDecimal(x) = Convert.ToDecimal (Operators.ToInt64 (x)) @ (214,40--214,49)"; - "let testIntPtrToChar(x) = Operators.ToUInt16 (x) @ (215,40--215,46)"; - "let testIntPtrToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (216,40--216,48)"; - "let testUIntPtrToByte(x) = Operators.ToByte (x) @ (218,42--218,48)"; - "let testUIntPtrToSByte(x) = Operators.ToSByte (x) @ (219,42--219,49)"; - "let testUIntPtrToInt16(x) = Operators.ToInt16 (x) @ (220,42--220,49)"; - "let testUIntPtrToUInt16(x) = Operators.ToUInt16 (x) @ (221,42--221,50)"; - "let testUIntPtrToInt32(x) = Operators.ToInt32 (x) @ (222,42--222,47)"; - "let testUIntPtrToUInt32(x) = Operators.ToUInt32 (x) @ (223,42--223,50)"; - "let testUIntPtrToInt64(x) = Operators.ToUInt64 (x) @ (224,42--224,49)"; - "let testUIntPtrToUInt64(x) = Operators.ToUInt64 (x) @ (225,42--225,50)"; - "let testUIntPtrToIntPtr(x) = x @ (226,42--226,53)"; - "let testUIntPtrToUIntPtr(x) = x @ (227,53--227,54)"; - "let testUIntPtrToSingle(x) = Operators.ToSingle (Operators.ToDouble (x)) @ (228,42--228,51)"; - "let testUIntPtrToDouble(x) = Operators.ToDouble (Operators.ToDouble (x)) @ (229,42--229,49)"; - "let testUIntPtrToDecimal(x) = Convert.ToDecimal (Operators.ToUInt64 (x)) @ (230,42--230,51)"; - "let testUIntPtrToChar(x) = Operators.ToUInt16 (x) @ (231,42--231,48)"; - "let testUIntPtrToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (232,42--232,50)"; - "let testSingleToByte(x) = Operators.ToByte (x) @ (234,38--234,44)"; - "let testSingleToSByte(x) = Operators.ToSByte (x) @ (235,38--235,45)"; - "let testSingleToInt16(x) = Operators.ToInt16 (x) @ (236,38--236,45)"; - "let testSingleToUInt16(x) = Operators.ToUInt16 (x) @ (237,38--237,46)"; - "let testSingleToInt32(x) = Operators.ToInt32 (x) @ (238,38--238,43)"; - "let testSingleToUInt32(x) = Operators.ToUInt32 (x) @ (239,38--239,46)"; - "let testSingleToInt64(x) = Operators.ToInt64 (x) @ (240,38--240,45)"; - "let testSingleToUInt64(x) = Operators.ToUInt64 (x) @ (241,38--241,46)"; - "let testSingleToIntPtr(x) = Operators.ToIntPtr (x) @ (242,38--242,49)"; - "let testSingleToUIntPtr(x) = Operators.ToUIntPtr (x) @ (243,38--243,50)"; - "let testSingleToSingle(x) = Operators.ToSingle (x) @ (244,38--244,47)"; - "let testSingleToDouble(x) = Operators.ToDouble (x) @ (245,38--245,45)"; - "let testSingleToDecimal(x) = Convert.ToDecimal (x) @ (246,38--246,47)"; - "let testSingleToChar(x) = Operators.ToUInt16 (x) @ (247,38--247,44)"; - "let testSingleToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (248,38--248,46)"; - "let testDoubleToByte(x) = Operators.ToByte (x) @ (250,36--250,42)"; - "let testDoubleToSByte(x) = Operators.ToSByte (x) @ (251,36--251,43)"; - "let testDoubleToInt16(x) = Operators.ToInt16 (x) @ (252,36--252,43)"; - "let testDoubleToUInt16(x) = Operators.ToUInt16 (x) @ (253,36--253,44)"; - "let testDoubleToInt32(x) = Operators.ToInt32 (x) @ (254,36--254,41)"; - "let testDoubleToUInt32(x) = Operators.ToUInt32 (x) @ (255,36--255,44)"; - "let testDoubleToInt64(x) = Operators.ToInt64 (x) @ (256,36--256,43)"; - "let testDoubleToUInt64(x) = Operators.ToUInt64 (x) @ (257,36--257,44)"; - "let testDoubleToIntPtr(x) = Operators.ToIntPtr (x) @ (258,36--258,47)"; - "let testDoubleToUIntPtr(x) = Operators.ToUIntPtr (x) @ (259,36--259,48)"; - "let testDoubleToSingle(x) = Operators.ToSingle (x) @ (260,36--260,45)"; - "let testDoubleToDouble(x) = Operators.ToDouble (x) @ (261,36--261,43)"; - "let testDoubleToDecimal(x) = Convert.ToDecimal (x) @ (262,36--262,45)"; - "let testDoubleToChar(x) = Operators.ToUInt16 (x) @ (263,36--263,42)"; - "let testDoubleToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (264,36--264,44)"; - "let testDecimalToByte(x) = Decimal.op_Explicit (x) @ (266,39--266,45)"; - "let testDecimalToSByte(x) = Decimal.op_Explicit (x) @ (267,39--267,46)"; - "let testDecimalToInt16(x) = Decimal.op_Explicit (x) @ (268,39--268,46)"; - "let testDecimalToUInt16(x) = Decimal.op_Explicit (x) @ (269,39--269,47)"; - "let testDecimalToInt32(x) = Decimal.op_Explicit (x) @ (270,39--270,44)"; - "let testDecimalToUInt32(x) = Decimal.op_Explicit (x) @ (271,39--271,47)"; - "let testDecimalToInt64(x) = Decimal.op_Explicit (x) @ (272,39--272,46)"; - "let testDecimalToUInt64(x) = Decimal.op_Explicit (x) @ (273,39--273,47)"; - "let testDecimalToSingle(x) = Decimal.op_Explicit (x) @ (274,39--274,48)"; - "let testDecimalToDouble(x) = Convert.ToDouble (x) @ (275,39--275,46)"; - "let testDecimalToDecimal(x) = x @ (276,47--276,48)"; - "let testDecimalToChar(x) = Decimal.op_Explicit (x) @ (277,39--277,45)"; - "let testDecimalToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (278,39--278,47)"; - "let testCharToByte(x) = Operators.ToByte (x) @ (280,33--280,39)"; - "let testCharToSByte(x) = Operators.ToSByte (x) @ (281,33--281,40)"; - "let testCharToInt16(x) = Operators.ToInt16 (x) @ (282,33--282,40)"; - "let testCharToUInt16(x) = Operators.ToUInt16 (x) @ (283,33--283,41)"; - "let testCharToInt32(x) = Operators.ToInt32 (x) @ (284,33--284,38)"; - "let testCharToUInt32(x) = Operators.ToUInt32 (x) @ (285,33--285,41)"; - "let testCharToInt64(x) = Operators.ToUInt64 (x) @ (286,33--286,40)"; - "let testCharToUInt64(x) = Operators.ToUInt64 (x) @ (287,33--287,41)"; - "let testCharToIntPtr(x) = Operators.ToUIntPtr (x) @ (288,33--288,44)"; - "let testCharToUIntPtr(x) = Operators.ToUIntPtr (x) @ (289,33--289,45)"; - "let testCharToSingle(x) = Operators.ToSingle (Operators.ToDouble (x)) @ (290,33--290,42)"; - "let testCharToDouble(x) = Operators.ToDouble (Operators.ToDouble (x)) @ (291,33--291,40)"; - "let testCharToChar(x) = Operators.ToUInt16 (x) @ (292,33--292,39)"; - "let testCharToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (293,33--293,41)"; - "let testStringToByte(x) = Checked.ToByte (LanguagePrimitives.ParseUInt32 (x)) @ (295,37--295,43)"; - "let testStringToSByte(x) = Checked.ToSByte (LanguagePrimitives.ParseInt32 (x)) @ (296,37--296,44)"; - "let testStringToInt16(x) = Checked.ToInt16 (LanguagePrimitives.ParseInt32 (x)) @ (297,37--297,44)"; - "let testStringToUInt16(x) = Checked.ToUInt16 (LanguagePrimitives.ParseUInt32 (x)) @ (298,37--298,45)"; - "let testStringToInt32(x) = LanguagePrimitives.ParseInt32 (x) @ (299,37--299,42)"; - "let testStringToUInt32(x) = LanguagePrimitives.ParseUInt32 (x) @ (300,37--300,45)"; - "let testStringToInt64(x) = LanguagePrimitives.ParseInt64 (x) @ (301,37--301,44)"; - "let testStringToUInt64(x) = LanguagePrimitives.ParseUInt64 (x) @ (302,37--302,45)"; - "let testStringToSingle(x) = Single.Parse ((if Operators.op_Equality (x,dflt) then dflt else x.Replace(\"_\",\"\")),167,CultureInfo.get_InvariantCulture () :> System.IFormatProvider) @ (303,37--303,46)"; - "let testStringToDouble(x) = Double.Parse ((if Operators.op_Equality (x,dflt) then dflt else x.Replace(\"_\",\"\")),167,CultureInfo.get_InvariantCulture () :> System.IFormatProvider) @ (304,37--304,44)"; - "let testStringToDecimal(x) = Decimal.Parse (x,167,CultureInfo.get_InvariantCulture () :> System.IFormatProvider) @ (305,37--305,46)"; - "let testStringToChar(x) = Char.Parse (x) @ (306,37--306,43)"; - "let testStringToString(x) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (x) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (307,37--307,45)" ] - + ] // printFSharpDecls "" file2.Declarations |> Seq.iter (printfn "%s") @@ -1683,6 +918,1743 @@ let ``Test Optimized Declarations Project1`` () = () +let testOperators dnName fsName excludedTests expectedUnoptimized expectedOptimized = + let basePath = Path.GetTempFileName() + let fileName = Path.ChangeExtension(basePath, ".fs") + let dllName = Path.ChangeExtension(basePath, ".dll") + let projFileName = Path.ChangeExtension(basePath, ".fsproj") + let source = System.String.Format(Project1.operatorTests, dnName, fsName) + let replace (s:string) r = s.Replace("let " + r, "// let " + r) + let fileSource = excludedTests |> List.fold replace source + File.WriteAllText(fileName, fileSource) + + let args = mkProjectCommandLineArgsSilent (dllName, [fileName]) + let options = checker.GetProjectOptionsFromCommandLineArgs (projFileName, args) + let wholeProjectResults = exprChecker.ParseAndCheckProject(options) |> Async.RunSynchronously + + for e in wholeProjectResults.Errors do + printfn "%s Operator Tests error: <<<%s>>>" dnName e.Message + + wholeProjectResults.Errors.Length |> shouldEqual 0 + + let fileUnoptimized = wholeProjectResults.AssemblyContents.ImplementationFiles.[0] + let fileOptimized = wholeProjectResults.GetOptimizedAssemblyContents().ImplementationFiles.[0] + + printDeclarations None (List.ofSeq fileUnoptimized.Declarations) + |> Seq.toList |> shouldEqual expectedUnoptimized + + printDeclarations None (List.ofSeq fileOptimized.Declarations) + |> Seq.toList |> shouldEqual expectedOptimized + + () + +[] +let ``Test Operator Declarations for Byte`` () = + let excludedTests = [ + "testByteUnaryNegOperator"; + "testByteUnaryNegChecked"; + ] + + let expectedUnoptimized = [ + "type OperatorTestsByte"; + "let testByteEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,64--4,72)"; + "let testByteNotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,64--5,73)"; + "let testByteLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,64--6,72)"; + "let testByteLessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,64--7,73)"; + "let testByteGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,64--8,72)"; + "let testByteGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,64--9,73)"; + "let testByteAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,56--11,64)"; + "let testByteSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,56--12,64)"; + "let testByteMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,55--13,64)"; + "let testByteDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,56--14,64)"; + "let testByteModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,56--15,64)"; + "let testByteBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,56--16,66)"; + "let testByteBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,56--17,66)"; + "let testByteBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,56--18,66)"; + "let testByteShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (19,55--19,65)"; + "let testByteShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (20,55--20,65)"; + "let testByteAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,53--24,70)"; + "let testByteSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,53--25,70)"; + "let testByteMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,53--26,70)"; + "let testByteToByteChecked(e1) = Checked.ToByte (e1) @ (29,43--29,58)"; + "let testByteToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,43--30,59)"; + "let testByteToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,43--31,59)"; + "let testByteToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,43--32,60)"; + "let testByteToIntChecked(e1) = Checked.ToInt (e1) @ (33,43--33,57)"; + "let testByteToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,43--34,59)"; + "let testByteToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,43--35,60)"; + "let testByteToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,43--36,59)"; + "let testByteToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,43--37,60)"; + "let testByteToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,43--38,63)"; + "let testByteToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,43--39,64)"; + "let testByteToByteOperator(e1) = Operators.ToByte (e1) @ (41,43--41,50)"; + "let testByteToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,43--42,51)"; + "let testByteToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,43--43,51)"; + "let testByteToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,43--44,52)"; + "let testByteToIntOperator(e1) = Operators.ToInt (e1) @ (45,43--45,49)"; + "let testByteToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,43--46,51)"; + "let testByteToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,43--47,52)"; + "let testByteToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,43--48,51)"; + "let testByteToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,43--49,52)"; + "let testByteToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,43--50,55)"; + "let testByteToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,43--51,56)"; + "let testByteToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,43--52,53)"; + "let testByteToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,43--53,51)"; + "let testByteToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,43--54,53)"; + "let testByteToCharOperator(e1) = Operators.ToChar (e1) @ (55,43--55,50)"; + "let testByteToStringOperator(e1) = Operators.ToString (e1) @ (56,43--56,52)"; + ] + + let expectedOptimized = [ + "type OperatorTestsByte"; + "let testByteEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,64--4,72)"; + "let testByteNotEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_Equality (e1,e2),False) @ (5,64--5,73)"; + "let testByteLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,64--6,72)"; + "let testByteLessThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_GreaterThan (e1,e2),False) @ (7,64--7,73)"; + "let testByteGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,64--8,72)"; + "let testByteGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_LessThan (e1,e2),False) @ (9,64--9,73)"; + "let testByteAdditionOperator(e1) (e2) = Operators.ToByte (Operators.op_Addition (e1,e2)) @ (11,56--11,64)"; + "let testByteSubtractionOperator(e1) (e2) = Operators.ToByte (Operators.op_Subtraction (e1,e2)) @ (12,56--12,64)"; + "let testByteMultiplyOperator(e1) (e2) = Operators.ToByte (Operators.op_Multiply (e1,e2)) @ (13,55--13,64)"; + "let testByteDivisionOperator(e1) (e2) = Operators.ToByte (Operators.op_Division (e1,e2)) @ (14,56--14,64)"; + "let testByteModulusOperator(e1) (e2) = Operators.ToByte (Operators.op_Modulus (e1,e2)) @ (15,56--15,64)"; + "let testByteBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,56--16,66)"; + "let testByteBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,56--17,66)"; + "let testByteBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,56--18,66)"; + "let testByteShiftLeftOperator(e1) (e2) = Operators.ToByte (Operators.op_LeftShift (e1,Operators.op_BitwiseAnd (e2,7))) @ (19,55--19,65)"; + "let testByteShiftRightOperator(e1) (e2) = Operators.ToByte (Operators.op_RightShift (e1,Operators.op_BitwiseAnd (e2,7))) @ (20,55--20,65)"; + "let testByteAdditionChecked(e1) (e2) = Checked.ToByte (Checked.op_Addition (e1,e2)) @ (24,53--24,70)"; + "let testByteSubtractionChecked(e1) (e2) = Checked.ToByte (Checked.op_Subtraction (e1,e2)) @ (25,53--25,70)"; + "let testByteMultiplyChecked(e1) (e2) = Checked.ToByte (Checked.op_Multiply (e1,e2)) @ (26,53--26,70)"; + "let testByteToByteChecked(e1) = Checked.ToByte (e1) @ (29,43--29,58)"; + "let testByteToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,43--30,59)"; + "let testByteToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,43--31,59)"; + "let testByteToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,43--32,60)"; + "let testByteToIntChecked(e1) = Checked.ToInt32 (e1) @ (33,43--33,57)"; + "let testByteToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,43--34,59)"; + "let testByteToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,43--35,60)"; + "let testByteToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,43--36,59)"; + "let testByteToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,43--37,60)"; + "let testByteToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,43--38,63)"; + "let testByteToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,43--39,64)"; + "let testByteToByteOperator(e1) = Operators.ToByte (e1) @ (41,43--41,50)"; + "let testByteToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,43--42,51)"; + "let testByteToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,43--43,51)"; + "let testByteToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,43--44,52)"; + "let testByteToIntOperator(e1) = Operators.ToInt32 (e1) @ (45,43--45,49)"; + "let testByteToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,43--46,51)"; + "let testByteToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,43--47,52)"; + "let testByteToInt64Operator(e1) = Operators.ToUInt64 (e1) @ (48,43--48,51)"; + "let testByteToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,43--49,52)"; + "let testByteToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,43--50,55)"; + "let testByteToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,43--51,56)"; + "let testByteToSingleOperator(e1) = Operators.ToSingle (Operators.ToDouble (e1)) @ (52,43--52,53)"; + "let testByteToDoubleOperator(e1) = Operators.ToDouble (Operators.ToDouble (e1)) @ (53,43--53,51)"; + "let testByteToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,43--54,53)"; + "let testByteToCharOperator(e1) = Operators.ToUInt16 (e1) @ (55,43--55,50)"; + "let testByteToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,43--56,52)"; + ] + + testOperators "Byte" "byte" excludedTests expectedUnoptimized expectedOptimized + + +[] +let ``Test Operator Declarations for SByte`` () = + let excludedTests = [ ] + + let expectedUnoptimized = [ + "type OperatorTestsSByte"; + "let testSByteEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,67--4,75)"; + "let testSByteNotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,67--5,76)"; + "let testSByteLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,67--6,75)"; + "let testSByteLessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,67--7,76)"; + "let testSByteGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,67--8,75)"; + "let testSByteGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,67--9,76)"; + "let testSByteAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,59--11,67)"; "let testSByteSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,59--12,67)"; + "let testSByteMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,58--13,67)"; + "let testSByteDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,59--14,67)"; + "let testSByteModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,59--15,67)"; + "let testSByteBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,59--16,69)"; + "let testSByteBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,59--17,69)"; + "let testSByteBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,59--18,69)"; + "let testSByteShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (19,57--19,67)"; + "let testSByteShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (20,57--20,67)"; + "let testSByteUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,46--22,52)"; + "let testSByteAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,56--24,73)"; + "let testSByteSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,56--25,73)"; + "let testSByteMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,56--26,73)"; + "let testSByteUnaryNegChecked(e1) = Checked.op_UnaryNegation (e1) @ (27,45--27,60)"; + "let testSByteToByteChecked(e1) = Checked.ToByte (e1) @ (29,45--29,60)"; + "let testSByteToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,45--30,61)"; + "let testSByteToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,45--31,61)"; + "let testSByteToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,45--32,62)"; + "let testSByteToIntChecked(e1) = Checked.ToInt (e1) @ (33,45--33,59)"; + "let testSByteToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,45--34,61)"; + "let testSByteToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,45--35,62)"; + "let testSByteToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,45--36,61)"; + "let testSByteToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,45--37,62)"; + "let testSByteToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,45--38,65)"; + "let testSByteToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,45--39,66)"; + "let testSByteToByteOperator(e1) = Operators.ToByte (e1) @ (41,45--41,52)"; + "let testSByteToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,45--42,53)"; + "let testSByteToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,45--43,53)"; + "let testSByteToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,45--44,54)"; + "let testSByteToIntOperator(e1) = Operators.ToInt (e1) @ (45,45--45,51)"; + "let testSByteToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,45--46,53)"; + "let testSByteToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,45--47,54)"; + "let testSByteToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,45--48,53)"; + "let testSByteToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,45--49,54)"; + "let testSByteToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,45--50,57)"; + "let testSByteToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,45--51,58)"; + "let testSByteToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,45--52,55)"; + "let testSByteToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,45--53,53)"; + "let testSByteToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,45--54,55)"; + "let testSByteToCharOperator(e1) = Operators.ToChar (e1) @ (55,45--55,52)"; + "let testSByteToStringOperator(e1) = Operators.ToString (e1) @ (56,45--56,54)"; + ] + + let expectedOptimized = [ + "type OperatorTestsSByte"; + "let testSByteEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,67--4,75)"; + "let testSByteNotEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_Equality (e1,e2),False) @ (5,67--5,76)"; + "let testSByteLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,67--6,75)"; + "let testSByteLessThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_GreaterThan (e1,e2),False) @ (7,67--7,76)"; + "let testSByteGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,67--8,75)"; + "let testSByteGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_LessThan (e1,e2),False) @ (9,67--9,76)"; + "let testSByteAdditionOperator(e1) (e2) = Operators.ToSByte (Operators.op_Addition (e1,e2)) @ (11,59--11,67)"; + "let testSByteSubtractionOperator(e1) (e2) = Operators.ToSByte (Operators.op_Subtraction (e1,e2)) @ (12,59--12,67)"; + "let testSByteMultiplyOperator(e1) (e2) = Operators.ToSByte (Operators.op_Multiply (e1,e2)) @ (13,58--13,67)"; + "let testSByteDivisionOperator(e1) (e2) = Operators.ToSByte (Operators.op_Division (e1,e2)) @ (14,59--14,67)"; + "let testSByteModulusOperator(e1) (e2) = Operators.ToSByte (Operators.op_Modulus (e1,e2)) @ (15,59--15,67)"; + "let testSByteBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,59--16,69)"; + "let testSByteBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,59--17,69)"; + "let testSByteBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,59--18,69)"; + "let testSByteShiftLeftOperator(e1) (e2) = Operators.ToSByte (Operators.op_LeftShift (e1,Operators.op_BitwiseAnd (e2,7))) @ (19,57--19,67)"; + "let testSByteShiftRightOperator(e1) (e2) = Operators.ToSByte (Operators.op_RightShift (e1,Operators.op_BitwiseAnd (e2,7))) @ (20,57--20,67)"; + "let testSByteUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,46--22,52)"; + "let testSByteAdditionChecked(e1) (e2) = Checked.ToSByte (Checked.op_Addition (e1,e2)) @ (24,56--24,73)"; + "let testSByteSubtractionChecked(e1) (e2) = Checked.ToSByte (Checked.op_Subtraction (e1,e2)) @ (25,56--25,73)"; + "let testSByteMultiplyChecked(e1) (e2) = Checked.ToSByte (Checked.op_Multiply (e1,e2)) @ (26,56--26,73)"; + "let testSByteUnaryNegChecked(e1) = Checked.op_Subtraction (0,e1) @ (27,45--27,60)"; + "let testSByteToByteChecked(e1) = Checked.ToByte (e1) @ (29,45--29,60)"; + "let testSByteToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,45--30,61)"; + "let testSByteToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,45--31,61)"; + "let testSByteToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,45--32,62)"; + "let testSByteToIntChecked(e1) = Checked.ToInt32 (e1) @ (33,45--33,59)"; + "let testSByteToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,45--34,61)"; + "let testSByteToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,45--35,62)"; + "let testSByteToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,45--36,61)"; + "let testSByteToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,45--37,62)"; + "let testSByteToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,45--38,65)"; + "let testSByteToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,45--39,66)"; + "let testSByteToByteOperator(e1) = Operators.ToByte (e1) @ (41,45--41,52)"; + "let testSByteToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,45--42,53)"; + "let testSByteToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,45--43,53)"; + "let testSByteToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,45--44,54)"; + "let testSByteToIntOperator(e1) = e1 @ (45,45--45,51)"; + "let testSByteToInt32Operator(e1) = e1 @ (46,45--46,53)"; + "let testSByteToUInt32Operator(e1) = e1 @ (47,45--47,54)"; + "let testSByteToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,45--48,53)"; + "let testSByteToUInt64Operator(e1) = Operators.ToInt64 (e1) @ (49,45--49,54)"; + "let testSByteToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,45--50,57)"; + "let testSByteToUIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (51,45--51,58)"; + "let testSByteToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,45--52,55)"; + "let testSByteToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,45--53,53)"; + "let testSByteToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,45--54,55)"; + "let testSByteToCharOperator(e1) = Operators.ToUInt16 (e1) @ (55,45--55,52)"; + "let testSByteToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,45--56,54)"; + ] + + testOperators "SByte" "sbyte" excludedTests expectedUnoptimized expectedOptimized + +[] +let ``Test Operator Declarations for Int16`` () = + let excludedTests = [ ] + + let expectedUnoptimized = [ + "type OperatorTestsInt16"; + "let testInt16EqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,67--4,75)"; + "let testInt16NotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,67--5,76)"; + "let testInt16LessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,67--6,75)"; + "let testInt16LessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,67--7,76)"; + "let testInt16GreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,67--8,75)"; + "let testInt16GreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,67--9,76)"; + "let testInt16AdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,59--11,67)"; + "let testInt16SubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,59--12,67)"; + "let testInt16MultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,58--13,67)"; + "let testInt16DivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,59--14,67)"; + "let testInt16ModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,59--15,67)"; + "let testInt16BitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,59--16,69)"; + "let testInt16BitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,59--17,69)"; + "let testInt16BitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,59--18,69)"; + "let testInt16ShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (19,57--19,67)"; + "let testInt16ShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (20,57--20,67)"; + "let testInt16UnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,46--22,52)"; + "let testInt16AdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,56--24,73)"; + "let testInt16SubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,56--25,73)"; + "let testInt16MultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,56--26,73)"; + "let testInt16UnaryNegChecked(e1) = Checked.op_UnaryNegation (e1) @ (27,45--27,60)"; + "let testInt16ToByteChecked(e1) = Checked.ToByte (e1) @ (29,45--29,60)"; + "let testInt16ToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,45--30,61)"; + "let testInt16ToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,45--31,61)"; + "let testInt16ToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,45--32,62)"; + "let testInt16ToIntChecked(e1) = Checked.ToInt (e1) @ (33,45--33,59)"; + "let testInt16ToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,45--34,61)"; + "let testInt16ToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,45--35,62)"; + "let testInt16ToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,45--36,61)"; + "let testInt16ToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,45--37,62)"; + "let testInt16ToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,45--38,65)"; + "let testInt16ToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,45--39,66)"; + "let testInt16ToByteOperator(e1) = Operators.ToByte (e1) @ (41,45--41,52)"; + "let testInt16ToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,45--42,53)"; + "let testInt16ToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,45--43,53)"; + "let testInt16ToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,45--44,54)"; + "let testInt16ToIntOperator(e1) = Operators.ToInt (e1) @ (45,45--45,51)"; + "let testInt16ToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,45--46,53)"; + "let testInt16ToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,45--47,54)"; + "let testInt16ToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,45--48,53)"; + "let testInt16ToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,45--49,54)"; + "let testInt16ToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,45--50,57)"; + "let testInt16ToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,45--51,58)"; + "let testInt16ToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,45--52,55)"; + "let testInt16ToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,45--53,53)"; + "let testInt16ToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,45--54,55)"; + "let testInt16ToCharOperator(e1) = Operators.ToChar (e1) @ (55,45--55,52)"; + "let testInt16ToStringOperator(e1) = Operators.ToString (e1) @ (56,45--56,54)"; + ] + + let expectedOptimized = [ + "type OperatorTestsInt16"; + "let testInt16EqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,67--4,75)"; + "let testInt16NotEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_Equality (e1,e2),False) @ (5,67--5,76)"; + "let testInt16LessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,67--6,75)"; + "let testInt16LessThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_GreaterThan (e1,e2),False) @ (7,67--7,76)"; + "let testInt16GreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,67--8,75)"; + "let testInt16GreaterThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_LessThan (e1,e2),False) @ (9,67--9,76)"; + "let testInt16AdditionOperator(e1) (e2) = Operators.ToInt16 (Operators.op_Addition (e1,e2)) @ (11,59--11,67)"; + "let testInt16SubtractionOperator(e1) (e2) = Operators.ToInt16 (Operators.op_Subtraction (e1,e2)) @ (12,59--12,67)"; + "let testInt16MultiplyOperator(e1) (e2) = Operators.ToInt16 (Operators.op_Multiply (e1,e2)) @ (13,58--13,67)"; + "let testInt16DivisionOperator(e1) (e2) = Operators.ToInt16 (Operators.op_Division (e1,e2)) @ (14,59--14,67)"; + "let testInt16ModulusOperator(e1) (e2) = Operators.ToInt16 (Operators.op_Modulus (e1,e2)) @ (15,59--15,67)"; + "let testInt16BitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,59--16,69)"; + "let testInt16BitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,59--17,69)"; + "let testInt16BitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,59--18,69)"; + "let testInt16ShiftLeftOperator(e1) (e2) = Operators.ToInt16 (Operators.op_LeftShift (e1,Operators.op_BitwiseAnd (e2,15))) @ (19,57--19,67)"; + "let testInt16ShiftRightOperator(e1) (e2) = Operators.ToInt16 (Operators.op_RightShift (e1,Operators.op_BitwiseAnd (e2,15))) @ (20,57--20,67)"; + "let testInt16UnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,46--22,52)"; + "let testInt16AdditionChecked(e1) (e2) = Checked.ToInt16 (Checked.op_Addition (e1,e2)) @ (24,56--24,73)"; + "let testInt16SubtractionChecked(e1) (e2) = Checked.ToInt16 (Checked.op_Subtraction (e1,e2)) @ (25,56--25,73)"; + "let testInt16MultiplyChecked(e1) (e2) = Checked.ToInt16 (Checked.op_Multiply (e1,e2)) @ (26,56--26,73)"; + "let testInt16UnaryNegChecked(e1) = Checked.op_Subtraction (0,e1) @ (27,45--27,60)"; + "let testInt16ToByteChecked(e1) = Checked.ToByte (e1) @ (29,45--29,60)"; + "let testInt16ToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,45--30,61)"; + "let testInt16ToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,45--31,61)"; + "let testInt16ToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,45--32,62)"; + "let testInt16ToIntChecked(e1) = Checked.ToInt32 (e1) @ (33,45--33,59)"; + "let testInt16ToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,45--34,61)"; + "let testInt16ToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,45--35,62)"; + "let testInt16ToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,45--36,61)"; + "let testInt16ToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,45--37,62)"; + "let testInt16ToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,45--38,65)"; + "let testInt16ToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,45--39,66)"; + "let testInt16ToByteOperator(e1) = Operators.ToByte (e1) @ (41,45--41,52)"; + "let testInt16ToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,45--42,53)"; + "let testInt16ToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,45--43,53)"; + "let testInt16ToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,45--44,54)"; + "let testInt16ToIntOperator(e1) = e1 @ (45,45--45,51)"; + "let testInt16ToInt32Operator(e1) = e1 @ (46,45--46,53)"; + "let testInt16ToUInt32Operator(e1) = e1 @ (47,45--47,54)"; + "let testInt16ToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,45--48,53)"; + "let testInt16ToUInt64Operator(e1) = Operators.ToInt64 (e1) @ (49,45--49,54)"; + "let testInt16ToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,45--50,57)"; + "let testInt16ToUIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (51,45--51,58)"; + "let testInt16ToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,45--52,55)"; + "let testInt16ToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,45--53,53)"; + "let testInt16ToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,45--54,55)"; + "let testInt16ToCharOperator(e1) = Operators.ToUInt16 (e1) @ (55,45--55,52)"; + "let testInt16ToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,45--56,54)"; + ] + + testOperators "Int16" "int16" excludedTests expectedUnoptimized expectedOptimized + +[] +let ``Test Operator Declarations for UInt16`` () = + let excludedTests = [ + "testUInt16UnaryNegOperator"; + "testUInt16UnaryNegChecked"; + ] + + let expectedUnoptimized = [ + "type OperatorTestsUInt16"; + "let testUInt16EqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,70--4,78)"; + "let testUInt16NotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,70--5,79)"; + "let testUInt16LessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,70--6,78)"; + "let testUInt16LessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,70--7,79)"; + "let testUInt16GreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,70--8,78)"; + "let testUInt16GreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,70--9,79)"; + "let testUInt16AdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,62--11,70)"; + "let testUInt16SubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,62--12,70)"; + "let testUInt16MultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,61--13,70)"; + "let testUInt16DivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,62--14,70)"; + "let testUInt16ModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,62--15,70)"; + "let testUInt16BitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,62--16,72)"; + "let testUInt16BitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,62--17,72)"; + "let testUInt16BitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,62--18,72)"; + "let testUInt16ShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (19,59--19,69)"; + "let testUInt16ShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (20,59--20,69)"; + "let testUInt16AdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,59--24,76)"; + "let testUInt16SubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,59--25,76)"; + "let testUInt16MultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,59--26,76)"; + "let testUInt16ToByteChecked(e1) = Checked.ToByte (e1) @ (29,47--29,62)"; + "let testUInt16ToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,47--30,63)"; + "let testUInt16ToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,47--31,63)"; + "let testUInt16ToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,47--32,64)"; + "let testUInt16ToIntChecked(e1) = Checked.ToInt (e1) @ (33,47--33,61)"; + "let testUInt16ToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,47--34,63)"; + "let testUInt16ToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,47--35,64)"; + "let testUInt16ToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,47--36,63)"; + "let testUInt16ToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,47--37,64)"; + "let testUInt16ToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,47--38,67)"; + "let testUInt16ToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,47--39,68)"; + "let testUInt16ToByteOperator(e1) = Operators.ToByte (e1) @ (41,47--41,54)"; + "let testUInt16ToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,47--42,55)"; + "let testUInt16ToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,47--43,55)"; + "let testUInt16ToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,47--44,56)"; + "let testUInt16ToIntOperator(e1) = Operators.ToInt (e1) @ (45,47--45,53)"; + "let testUInt16ToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,47--46,55)"; + "let testUInt16ToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,47--47,56)"; + "let testUInt16ToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,47--48,55)"; + "let testUInt16ToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,47--49,56)"; + "let testUInt16ToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,47--50,59)"; + "let testUInt16ToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,47--51,60)"; + "let testUInt16ToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,47--52,57)"; + "let testUInt16ToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,47--53,55)"; + "let testUInt16ToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,47--54,57)"; + "let testUInt16ToCharOperator(e1) = Operators.ToChar (e1) @ (55,47--55,54)"; + "let testUInt16ToStringOperator(e1) = Operators.ToString (e1) @ (56,47--56,56)"; + ] + + let expectedOptimized = [ + "type OperatorTestsUInt16"; + "let testUInt16EqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,70--4,78)"; + "let testUInt16NotEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_Equality (e1,e2),False) @ (5,70--5,79)"; + "let testUInt16LessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,70--6,78)"; + "let testUInt16LessThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_GreaterThan (e1,e2),False) @ (7,70--7,79)"; + "let testUInt16GreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,70--8,78)"; + "let testUInt16GreaterThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_LessThan (e1,e2),False) @ (9,70--9,79)"; + "let testUInt16AdditionOperator(e1) (e2) = Operators.ToUInt16 (Operators.op_Addition (e1,e2)) @ (11,62--11,70)"; + "let testUInt16SubtractionOperator(e1) (e2) = Operators.ToUInt16 (Operators.op_Subtraction (e1,e2)) @ (12,62--12,70)"; + "let testUInt16MultiplyOperator(e1) (e2) = Operators.ToUInt16 (Operators.op_Multiply (e1,e2)) @ (13,61--13,70)"; + "let testUInt16DivisionOperator(e1) (e2) = Operators.ToUInt16 (Operators.op_Division (e1,e2)) @ (14,62--14,70)"; + "let testUInt16ModulusOperator(e1) (e2) = Operators.ToUInt16 (Operators.op_Modulus (e1,e2)) @ (15,62--15,70)"; + "let testUInt16BitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,62--16,72)"; + "let testUInt16BitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,62--17,72)"; + "let testUInt16BitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,62--18,72)"; + "let testUInt16ShiftLeftOperator(e1) (e2) = Operators.ToUInt16 (Operators.op_LeftShift (e1,Operators.op_BitwiseAnd (e2,15))) @ (19,59--19,69)"; + "let testUInt16ShiftRightOperator(e1) (e2) = Operators.ToUInt16 (Operators.op_RightShift (e1,Operators.op_BitwiseAnd (e2,15))) @ (20,59--20,69)"; + "let testUInt16AdditionChecked(e1) (e2) = Checked.ToUInt16 (Checked.op_Addition (e1,e2)) @ (24,59--24,76)"; + "let testUInt16SubtractionChecked(e1) (e2) = Checked.ToUInt16 (Checked.op_Subtraction (e1,e2)) @ (25,59--25,76)"; + "let testUInt16MultiplyChecked(e1) (e2) = Checked.ToUInt16 (Checked.op_Multiply (e1,e2)) @ (26,59--26,76)"; + "let testUInt16ToByteChecked(e1) = Checked.ToByte (e1) @ (29,47--29,62)"; + "let testUInt16ToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,47--30,63)"; + "let testUInt16ToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,47--31,63)"; + "let testUInt16ToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,47--32,64)"; + "let testUInt16ToIntChecked(e1) = Checked.ToInt32 (e1) @ (33,47--33,61)"; + "let testUInt16ToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,47--34,63)"; + "let testUInt16ToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,47--35,64)"; + "let testUInt16ToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,47--36,63)"; + "let testUInt16ToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,47--37,64)"; + "let testUInt16ToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,47--38,67)"; + "let testUInt16ToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,47--39,68)"; + "let testUInt16ToByteOperator(e1) = Operators.ToByte (e1) @ (41,47--41,54)"; + "let testUInt16ToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,47--42,55)"; + "let testUInt16ToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,47--43,55)"; + "let testUInt16ToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,47--44,56)"; + "let testUInt16ToIntOperator(e1) = Operators.ToInt32 (e1) @ (45,47--45,53)"; + "let testUInt16ToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,47--46,55)"; + "let testUInt16ToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,47--47,56)"; + "let testUInt16ToInt64Operator(e1) = Operators.ToUInt64 (e1) @ (48,47--48,55)"; + "let testUInt16ToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,47--49,56)"; + "let testUInt16ToIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (50,47--50,59)"; + "let testUInt16ToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,47--51,60)"; + "let testUInt16ToSingleOperator(e1) = Operators.ToSingle (Operators.ToDouble (e1)) @ (52,47--52,57)"; + "let testUInt16ToDoubleOperator(e1) = Operators.ToDouble (Operators.ToDouble (e1)) @ (53,47--53,55)"; + "let testUInt16ToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,47--54,57)"; + "let testUInt16ToCharOperator(e1) = Operators.ToUInt16 (e1) @ (55,47--55,54)"; + "let testUInt16ToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,47--56,56)"; + ] + + testOperators "UInt16" "uint16" excludedTests expectedUnoptimized expectedOptimized + +[] +let ``Test Operator Declarations for Int`` () = + let excludedTests = [ ] + + let expectedUnoptimized = [ + "type OperatorTestsInt"; + "let testIntEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,61--4,69)"; + "let testIntNotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,61--5,70)"; + "let testIntLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,61--6,69)"; + "let testIntLessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,61--7,70)"; + "let testIntGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,61--8,69)"; + "let testIntGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,61--9,70)"; + "let testIntAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,53--11,61)"; + "let testIntSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,53--12,61)"; + "let testIntMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,52--13,61)"; + "let testIntDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,53--14,61)"; + "let testIntModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,53--15,61)"; + "let testIntBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,53--16,63)"; + "let testIntBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,53--17,63)"; + "let testIntBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,53--18,63)"; + "let testIntShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (19,53--19,63)"; + "let testIntShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (20,53--20,63)"; + "let testIntUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,42--22,48)"; + "let testIntAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,50--24,67)"; + "let testIntSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,50--25,67)"; + "let testIntMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,50--26,67)"; + "let testIntUnaryNegChecked(e1) = Checked.op_UnaryNegation (e1) @ (27,41--27,56)"; + "let testIntToByteChecked(e1) = Checked.ToByte (e1) @ (29,41--29,56)"; + "let testIntToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,41--30,57)"; + "let testIntToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,41--31,57)"; + "let testIntToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,41--32,58)"; + "let testIntToIntChecked(e1) = Checked.ToInt (e1) @ (33,41--33,55)"; + "let testIntToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,41--34,57)"; + "let testIntToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,41--35,58)"; + "let testIntToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,41--36,57)"; + "let testIntToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,41--37,58)"; + "let testIntToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,41--38,61)"; + "let testIntToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,41--39,62)"; + "let testIntToByteOperator(e1) = Operators.ToByte (e1) @ (41,41--41,48)"; + "let testIntToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,41--42,49)"; + "let testIntToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,41--43,49)"; + "let testIntToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,41--44,50)"; + "let testIntToIntOperator(e1) = Operators.ToInt (e1) @ (45,41--45,47)"; + "let testIntToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,41--46,49)"; + "let testIntToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,41--47,50)"; + "let testIntToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,41--48,49)"; + "let testIntToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,41--49,50)"; + "let testIntToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,41--50,53)"; + "let testIntToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,41--51,54)"; + "let testIntToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,41--52,51)"; + "let testIntToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,41--53,49)"; + "let testIntToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,41--54,51)"; + "let testIntToCharOperator(e1) = Operators.ToChar (e1) @ (55,41--55,48)"; + "let testIntToStringOperator(e1) = Operators.ToString (e1) @ (56,41--56,50)"; + ] + + let expectedOptimized = [ + "type OperatorTestsInt"; + "let testIntEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,61--4,69)"; + "let testIntNotEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_Equality (e1,e2),False) @ (5,61--5,70)"; + "let testIntLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,61--6,69)"; + "let testIntLessThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_GreaterThan (e1,e2),False) @ (7,61--7,70)"; + "let testIntGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,61--8,69)"; + "let testIntGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_LessThan (e1,e2),False) @ (9,61--9,70)"; + "let testIntAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,53--11,61)"; + "let testIntSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,53--12,61)"; + "let testIntMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,52--13,61)"; + "let testIntDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,53--14,61)"; + "let testIntModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,53--15,61)"; + "let testIntBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,53--16,63)"; + "let testIntBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,53--17,63)"; + "let testIntBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,53--18,63)"; + "let testIntShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,Operators.op_BitwiseAnd (e2,31)) @ (19,53--19,63)"; + "let testIntShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,Operators.op_BitwiseAnd (e2,31)) @ (20,53--20,63)"; + "let testIntUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,42--22,48)"; + "let testIntAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,50--24,67)"; + "let testIntSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,50--25,67)"; + "let testIntMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,50--26,67)"; + "let testIntUnaryNegChecked(e1) = Checked.op_Subtraction (0,e1) @ (27,41--27,56)"; + "let testIntToByteChecked(e1) = Checked.ToByte (e1) @ (29,41--29,56)"; + "let testIntToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,41--30,57)"; + "let testIntToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,41--31,57)"; + "let testIntToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,41--32,58)"; + "let testIntToIntChecked(e1) = Checked.ToInt32 (e1) @ (33,41--33,55)"; + "let testIntToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,41--34,57)"; + "let testIntToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,41--35,58)"; + "let testIntToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,41--36,57)"; + "let testIntToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,41--37,58)"; + "let testIntToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,41--38,61)"; + "let testIntToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,41--39,62)"; + "let testIntToByteOperator(e1) = Operators.ToByte (e1) @ (41,41--41,48)"; + "let testIntToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,41--42,49)"; + "let testIntToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,41--43,49)"; + "let testIntToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,41--44,50)"; + "let testIntToIntOperator(e1) = e1 @ (45,45--45,47)"; + "let testIntToInt32Operator(e1) = e1 @ (46,47--46,49)"; + "let testIntToUInt32Operator(e1) = e1 @ (47,41--47,50)"; + "let testIntToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,41--48,49)"; + "let testIntToUInt64Operator(e1) = Operators.ToInt64 (e1) @ (49,41--49,50)"; + "let testIntToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,41--50,53)"; + "let testIntToUIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (51,41--51,54)"; + "let testIntToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,41--52,51)"; + "let testIntToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,41--53,49)"; + "let testIntToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,41--54,51)"; + "let testIntToCharOperator(e1) = Operators.ToUInt16 (e1) @ (55,41--55,48)"; + "let testIntToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,41--56,50)"; + ] + + testOperators "Int" "int" excludedTests expectedUnoptimized expectedOptimized + +[] +let ``Test Operator Declarations for Int32`` () = + let excludedTests = [ ] + + let expectedUnoptimized = [ + "type OperatorTestsInt32"; + "let testInt32EqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,67--4,75)"; + "let testInt32NotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,67--5,76)"; + "let testInt32LessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,67--6,75)"; + "let testInt32LessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,67--7,76)"; + "let testInt32GreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,67--8,75)"; + "let testInt32GreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,67--9,76)"; + "let testInt32AdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,59--11,67)"; + "let testInt32SubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,59--12,67)"; + "let testInt32MultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,58--13,67)"; + "let testInt32DivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,59--14,67)"; + "let testInt32ModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,59--15,67)"; + "let testInt32BitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,59--16,69)"; + "let testInt32BitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,59--17,69)"; + "let testInt32BitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,59--18,69)"; + "let testInt32ShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (19,57--19,67)"; + "let testInt32ShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (20,57--20,67)"; + "let testInt32UnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,46--22,52)"; + "let testInt32AdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,56--24,73)"; + "let testInt32SubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,56--25,73)"; + "let testInt32MultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,56--26,73)"; + "let testInt32UnaryNegChecked(e1) = Checked.op_UnaryNegation (e1) @ (27,45--27,60)"; + "let testInt32ToByteChecked(e1) = Checked.ToByte (e1) @ (29,45--29,60)"; + "let testInt32ToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,45--30,61)"; + "let testInt32ToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,45--31,61)"; + "let testInt32ToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,45--32,62)"; + "let testInt32ToIntChecked(e1) = Checked.ToInt (e1) @ (33,45--33,59)"; + "let testInt32ToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,45--34,61)"; + "let testInt32ToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,45--35,62)"; + "let testInt32ToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,45--36,61)"; + "let testInt32ToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,45--37,62)"; + "let testInt32ToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,45--38,65)"; + "let testInt32ToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,45--39,66)"; + "let testInt32ToByteOperator(e1) = Operators.ToByte (e1) @ (41,45--41,52)"; + "let testInt32ToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,45--42,53)"; + "let testInt32ToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,45--43,53)"; + "let testInt32ToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,45--44,54)"; + "let testInt32ToIntOperator(e1) = Operators.ToInt (e1) @ (45,45--45,51)"; + "let testInt32ToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,45--46,53)"; + "let testInt32ToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,45--47,54)"; + "let testInt32ToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,45--48,53)"; + "let testInt32ToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,45--49,54)"; + "let testInt32ToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,45--50,57)"; + "let testInt32ToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,45--51,58)"; + "let testInt32ToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,45--52,55)"; + "let testInt32ToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,45--53,53)"; + "let testInt32ToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,45--54,55)"; + "let testInt32ToCharOperator(e1) = Operators.ToChar (e1) @ (55,45--55,52)"; + "let testInt32ToStringOperator(e1) = Operators.ToString (e1) @ (56,45--56,54)"; + ] + + let expectedOptimized = [ + "type OperatorTestsInt32"; + "let testInt32EqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,67--4,75)"; + "let testInt32NotEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_Equality (e1,e2),False) @ (5,67--5,76)"; + "let testInt32LessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,67--6,75)"; + "let testInt32LessThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_GreaterThan (e1,e2),False) @ (7,67--7,76)"; + "let testInt32GreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,67--8,75)"; + "let testInt32GreaterThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_LessThan (e1,e2),False) @ (9,67--9,76)"; + "let testInt32AdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,59--11,67)"; + "let testInt32SubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,59--12,67)"; + "let testInt32MultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,58--13,67)"; + "let testInt32DivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,59--14,67)"; + "let testInt32ModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,59--15,67)"; + "let testInt32BitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,59--16,69)"; + "let testInt32BitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,59--17,69)"; + "let testInt32BitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,59--18,69)"; + "let testInt32ShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,Operators.op_BitwiseAnd (e2,31)) @ (19,57--19,67)"; + "let testInt32ShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,Operators.op_BitwiseAnd (e2,31)) @ (20,57--20,67)"; + "let testInt32UnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,46--22,52)"; + "let testInt32AdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,56--24,73)"; + "let testInt32SubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,56--25,73)"; + "let testInt32MultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,56--26,73)"; + "let testInt32UnaryNegChecked(e1) = Checked.op_Subtraction (0,e1) @ (27,45--27,60)"; + "let testInt32ToByteChecked(e1) = Checked.ToByte (e1) @ (29,45--29,60)"; + "let testInt32ToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,45--30,61)"; + "let testInt32ToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,45--31,61)"; + "let testInt32ToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,45--32,62)"; + "let testInt32ToIntChecked(e1) = Checked.ToInt32 (e1) @ (33,45--33,59)"; + "let testInt32ToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,45--34,61)"; + "let testInt32ToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,45--35,62)"; + "let testInt32ToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,45--36,61)"; + "let testInt32ToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,45--37,62)"; + "let testInt32ToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,45--38,65)"; + "let testInt32ToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,45--39,66)"; + "let testInt32ToByteOperator(e1) = Operators.ToByte (e1) @ (41,45--41,52)"; + "let testInt32ToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,45--42,53)"; + "let testInt32ToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,45--43,53)"; + "let testInt32ToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,45--44,54)"; + "let testInt32ToIntOperator(e1) = e1 @ (45,49--45,51)"; + "let testInt32ToInt32Operator(e1) = e1 @ (46,51--46,53)"; + "let testInt32ToUInt32Operator(e1) = e1 @ (47,45--47,54)"; + "let testInt32ToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,45--48,53)"; + "let testInt32ToUInt64Operator(e1) = Operators.ToInt64 (e1) @ (49,45--49,54)"; + "let testInt32ToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,45--50,57)"; + "let testInt32ToUIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (51,45--51,58)"; + "let testInt32ToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,45--52,55)"; + "let testInt32ToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,45--53,53)"; + "let testInt32ToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,45--54,55)"; + "let testInt32ToCharOperator(e1) = Operators.ToUInt16 (e1) @ (55,45--55,52)"; + "let testInt32ToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,45--56,54)"; + ] + + testOperators "Int32" "int32" excludedTests expectedUnoptimized expectedOptimized + +[] +let ``Test Operator Declarations for UInt32`` () = + let excludedTests = [ + "testUInt32UnaryNegOperator"; + "testUInt32UnaryNegChecked"; + ] + + let expectedUnoptimized = [ + "type OperatorTestsUInt32"; + "let testUInt32EqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,70--4,78)"; + "let testUInt32NotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,70--5,79)"; + "let testUInt32LessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,70--6,78)"; + "let testUInt32LessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,70--7,79)"; + "let testUInt32GreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,70--8,78)"; + "let testUInt32GreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,70--9,79)"; + "let testUInt32AdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,62--11,70)"; + "let testUInt32SubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,62--12,70)"; + "let testUInt32MultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,61--13,70)"; + "let testUInt32DivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,62--14,70)"; + "let testUInt32ModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,62--15,70)"; + "let testUInt32BitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,62--16,72)"; + "let testUInt32BitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,62--17,72)"; + "let testUInt32BitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,62--18,72)"; + "let testUInt32ShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (19,59--19,69)"; + "let testUInt32ShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (20,59--20,69)"; + "let testUInt32AdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,59--24,76)"; + "let testUInt32SubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,59--25,76)"; + "let testUInt32MultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,59--26,76)"; + "let testUInt32ToByteChecked(e1) = Checked.ToByte (e1) @ (29,47--29,62)"; + "let testUInt32ToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,47--30,63)"; + "let testUInt32ToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,47--31,63)"; + "let testUInt32ToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,47--32,64)"; + "let testUInt32ToIntChecked(e1) = Checked.ToInt (e1) @ (33,47--33,61)"; + "let testUInt32ToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,47--34,63)"; + "let testUInt32ToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,47--35,64)"; + "let testUInt32ToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,47--36,63)"; + "let testUInt32ToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,47--37,64)"; + "let testUInt32ToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,47--38,67)"; + "let testUInt32ToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,47--39,68)"; + "let testUInt32ToByteOperator(e1) = Operators.ToByte (e1) @ (41,47--41,54)"; + "let testUInt32ToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,47--42,55)"; + "let testUInt32ToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,47--43,55)"; + "let testUInt32ToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,47--44,56)"; + "let testUInt32ToIntOperator(e1) = Operators.ToInt (e1) @ (45,47--45,53)"; + "let testUInt32ToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,47--46,55)"; + "let testUInt32ToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,47--47,56)"; + "let testUInt32ToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,47--48,55)"; + "let testUInt32ToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,47--49,56)"; + "let testUInt32ToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,47--50,59)"; + "let testUInt32ToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,47--51,60)"; + "let testUInt32ToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,47--52,57)"; + "let testUInt32ToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,47--53,55)"; + "let testUInt32ToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,47--54,57)"; + "let testUInt32ToCharOperator(e1) = Operators.ToChar (e1) @ (55,47--55,54)"; + "let testUInt32ToStringOperator(e1) = Operators.ToString (e1) @ (56,47--56,56)"; + ] + + let expectedOptimized = [ + "type OperatorTestsUInt32"; + "let testUInt32EqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,70--4,78)"; + "let testUInt32NotEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_Equality (e1,e2),False) @ (5,70--5,79)"; + "let testUInt32LessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,70--6,78)"; + "let testUInt32LessThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_GreaterThan (e1,e2),False) @ (7,70--7,79)"; + "let testUInt32GreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,70--8,78)"; + "let testUInt32GreaterThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_LessThan (e1,e2),False) @ (9,70--9,79)"; + "let testUInt32AdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,62--11,70)"; + "let testUInt32SubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,62--12,70)"; + "let testUInt32MultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,61--13,70)"; + "let testUInt32DivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,62--14,70)"; + "let testUInt32ModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,62--15,70)"; + "let testUInt32BitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,62--16,72)"; + "let testUInt32BitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,62--17,72)"; + "let testUInt32BitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,62--18,72)"; + "let testUInt32ShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,Operators.op_BitwiseAnd (e2,31)) @ (19,59--19,69)"; + "let testUInt32ShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,Operators.op_BitwiseAnd (e2,31)) @ (20,59--20,69)"; + "let testUInt32AdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,59--24,76)"; + "let testUInt32SubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,59--25,76)"; + "let testUInt32MultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,59--26,76)"; + "let testUInt32ToByteChecked(e1) = Checked.ToByte (e1) @ (29,47--29,62)"; + "let testUInt32ToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,47--30,63)"; + "let testUInt32ToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,47--31,63)"; + "let testUInt32ToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,47--32,64)"; + "let testUInt32ToIntChecked(e1) = Checked.ToInt32 (e1) @ (33,47--33,61)"; + "let testUInt32ToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,47--34,63)"; + "let testUInt32ToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,47--35,64)"; + "let testUInt32ToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,47--36,63)"; + "let testUInt32ToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,47--37,64)"; + "let testUInt32ToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,47--38,67)"; + "let testUInt32ToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,47--39,68)"; + "let testUInt32ToByteOperator(e1) = Operators.ToByte (e1) @ (41,47--41,54)"; + "let testUInt32ToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,47--42,55)"; + "let testUInt32ToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,47--43,55)"; + "let testUInt32ToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,47--44,56)"; + "let testUInt32ToIntOperator(e1) = e1 @ (45,47--45,53)"; + "let testUInt32ToInt32Operator(e1) = e1 @ (46,47--46,55)"; + "let testUInt32ToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,47--47,56)"; + "let testUInt32ToInt64Operator(e1) = Operators.ToUInt64 (e1) @ (48,47--48,55)"; + "let testUInt32ToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,47--49,56)"; + "let testUInt32ToIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (50,47--50,59)"; + "let testUInt32ToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,47--51,60)"; + "let testUInt32ToSingleOperator(e1) = Operators.ToSingle (Operators.ToDouble (e1)) @ (52,47--52,57)"; + "let testUInt32ToDoubleOperator(e1) = Operators.ToDouble (Operators.ToDouble (e1)) @ (53,47--53,55)"; + "let testUInt32ToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,47--54,57)"; + "let testUInt32ToCharOperator(e1) = Operators.ToUInt16 (e1) @ (55,47--55,54)"; + "let testUInt32ToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,47--56,56)"; + ] + + testOperators "UInt32" "uint32" excludedTests expectedUnoptimized expectedOptimized + +[] +let ``Test Operator Declarations for Int64`` () = + let excludedTests = [ ] + + let expectedUnoptimized = [ + "type OperatorTestsInt64"; + "let testInt64EqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,67--4,75)"; + "let testInt64NotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,67--5,76)"; + "let testInt64LessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,67--6,75)"; + "let testInt64LessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,67--7,76)"; + "let testInt64GreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,67--8,75)"; + "let testInt64GreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,67--9,76)"; + "let testInt64AdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,59--11,67)"; + "let testInt64SubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,59--12,67)"; + "let testInt64MultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,58--13,67)"; + "let testInt64DivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,59--14,67)"; + "let testInt64ModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,59--15,67)"; + "let testInt64BitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,59--16,69)"; + "let testInt64BitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,59--17,69)"; + "let testInt64BitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,59--18,69)"; + "let testInt64ShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (19,57--19,67)"; + "let testInt64ShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (20,57--20,67)"; + "let testInt64UnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,46--22,52)"; + "let testInt64AdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,56--24,73)"; + "let testInt64SubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,56--25,73)"; + "let testInt64MultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,56--26,73)"; + "let testInt64UnaryNegChecked(e1) = Checked.op_UnaryNegation (e1) @ (27,45--27,60)"; + "let testInt64ToByteChecked(e1) = Checked.ToByte (e1) @ (29,45--29,60)"; + "let testInt64ToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,45--30,61)"; + "let testInt64ToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,45--31,61)"; + "let testInt64ToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,45--32,62)"; + "let testInt64ToIntChecked(e1) = Checked.ToInt (e1) @ (33,45--33,59)"; + "let testInt64ToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,45--34,61)"; + "let testInt64ToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,45--35,62)"; + "let testInt64ToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,45--36,61)"; + "let testInt64ToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,45--37,62)"; + "let testInt64ToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,45--38,65)"; + "let testInt64ToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,45--39,66)"; + "let testInt64ToByteOperator(e1) = Operators.ToByte (e1) @ (41,45--41,52)"; + "let testInt64ToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,45--42,53)"; + "let testInt64ToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,45--43,53)"; + "let testInt64ToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,45--44,54)"; + "let testInt64ToIntOperator(e1) = Operators.ToInt (e1) @ (45,45--45,51)"; + "let testInt64ToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,45--46,53)"; + "let testInt64ToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,45--47,54)"; + "let testInt64ToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,45--48,53)"; + "let testInt64ToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,45--49,54)"; + "let testInt64ToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,45--50,57)"; + "let testInt64ToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,45--51,58)"; + "let testInt64ToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,45--52,55)"; + "let testInt64ToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,45--53,53)"; + "let testInt64ToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,45--54,55)"; + "let testInt64ToCharOperator(e1) = Operators.ToChar (e1) @ (55,45--55,52)"; + "let testInt64ToStringOperator(e1) = Operators.ToString (e1) @ (56,45--56,54)"; + ] + + let expectedOptimized = [ + "type OperatorTestsInt64"; + "let testInt64EqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,67--4,75)"; + "let testInt64NotEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_Equality (e1,e2),False) @ (5,67--5,76)"; + "let testInt64LessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,67--6,75)"; + "let testInt64LessThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_GreaterThan (e1,e2),False) @ (7,67--7,76)"; + "let testInt64GreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,67--8,75)"; + "let testInt64GreaterThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_LessThan (e1,e2),False) @ (9,67--9,76)"; + "let testInt64AdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,59--11,67)"; + "let testInt64SubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,59--12,67)"; + "let testInt64MultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,58--13,67)"; + "let testInt64DivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,59--14,67)"; + "let testInt64ModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,59--15,67)"; + "let testInt64BitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,59--16,69)"; + "let testInt64BitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,59--17,69)"; + "let testInt64BitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,59--18,69)"; + "let testInt64ShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,Operators.op_BitwiseAnd (e2,63)) @ (19,57--19,67)"; + "let testInt64ShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,Operators.op_BitwiseAnd (e2,63)) @ (20,57--20,67)"; + "let testInt64UnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,46--22,52)"; + "let testInt64AdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,56--24,73)"; + "let testInt64SubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,56--25,73)"; + "let testInt64MultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,56--26,73)"; + "let testInt64UnaryNegChecked(e1) = Checked.op_Subtraction (0,e1) @ (27,45--27,60)"; + "let testInt64ToByteChecked(e1) = Checked.ToByte (e1) @ (29,45--29,60)"; + "let testInt64ToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,45--30,61)"; + "let testInt64ToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,45--31,61)"; + "let testInt64ToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,45--32,62)"; + "let testInt64ToIntChecked(e1) = Checked.ToInt32 (e1) @ (33,45--33,59)"; + "let testInt64ToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,45--34,61)"; + "let testInt64ToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,45--35,62)"; + "let testInt64ToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,45--36,61)"; + "let testInt64ToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,45--37,62)"; + "let testInt64ToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,45--38,65)"; + "let testInt64ToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,45--39,66)"; + "let testInt64ToByteOperator(e1) = Operators.ToByte (e1) @ (41,45--41,52)"; + "let testInt64ToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,45--42,53)"; + "let testInt64ToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,45--43,53)"; + "let testInt64ToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,45--44,54)"; + "let testInt64ToIntOperator(e1) = Operators.ToInt32 (e1) @ (45,45--45,51)"; + "let testInt64ToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,45--46,53)"; + "let testInt64ToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,45--47,54)"; + "let testInt64ToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,45--48,53)"; + "let testInt64ToUInt64Operator(e1) = e1 @ (49,45--49,54)"; + "let testInt64ToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,45--50,57)"; + "let testInt64ToUIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (51,45--51,58)"; + "let testInt64ToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,45--52,55)"; + "let testInt64ToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,45--53,53)"; + "let testInt64ToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,45--54,55)"; + "let testInt64ToCharOperator(e1) = Operators.ToUInt16 (e1) @ (55,45--55,52)"; + "let testInt64ToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,45--56,54)"; + ] + + testOperators "Int64" "int64" excludedTests expectedUnoptimized expectedOptimized + +[] +let ``Test Operator Declarations for UInt64`` () = + let excludedTests = [ + "testUInt64UnaryNegOperator"; + "testUInt64UnaryNegChecked"; + ] + + let expectedUnoptimized = [ + "type OperatorTestsUInt64"; + "let testUInt64EqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,70--4,78)"; + "let testUInt64NotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,70--5,79)"; + "let testUInt64LessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,70--6,78)"; + "let testUInt64LessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,70--7,79)"; + "let testUInt64GreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,70--8,78)"; + "let testUInt64GreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,70--9,79)"; + "let testUInt64AdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,62--11,70)"; + "let testUInt64SubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,62--12,70)"; + "let testUInt64MultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,61--13,70)"; + "let testUInt64DivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,62--14,70)"; + "let testUInt64ModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,62--15,70)"; + "let testUInt64BitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,62--16,72)"; + "let testUInt64BitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,62--17,72)"; + "let testUInt64BitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,62--18,72)"; + "let testUInt64ShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (19,59--19,69)"; + "let testUInt64ShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (20,59--20,69)"; + "let testUInt64AdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,59--24,76)"; + "let testUInt64SubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,59--25,76)"; + "let testUInt64MultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,59--26,76)"; + "let testUInt64ToByteChecked(e1) = Checked.ToByte (e1) @ (29,47--29,62)"; + "let testUInt64ToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,47--30,63)"; + "let testUInt64ToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,47--31,63)"; + "let testUInt64ToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,47--32,64)"; + "let testUInt64ToIntChecked(e1) = Checked.ToInt (e1) @ (33,47--33,61)"; + "let testUInt64ToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,47--34,63)"; + "let testUInt64ToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,47--35,64)"; + "let testUInt64ToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,47--36,63)"; + "let testUInt64ToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,47--37,64)"; + "let testUInt64ToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,47--38,67)"; + "let testUInt64ToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,47--39,68)"; + "let testUInt64ToByteOperator(e1) = Operators.ToByte (e1) @ (41,47--41,54)"; + "let testUInt64ToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,47--42,55)"; + "let testUInt64ToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,47--43,55)"; + "let testUInt64ToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,47--44,56)"; + "let testUInt64ToIntOperator(e1) = Operators.ToInt (e1) @ (45,47--45,53)"; + "let testUInt64ToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,47--46,55)"; + "let testUInt64ToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,47--47,56)"; + "let testUInt64ToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,47--48,55)"; + "let testUInt64ToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,47--49,56)"; + "let testUInt64ToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,47--50,59)"; + "let testUInt64ToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,47--51,60)"; + "let testUInt64ToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,47--52,57)"; + "let testUInt64ToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,47--53,55)"; + "let testUInt64ToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,47--54,57)"; + "let testUInt64ToCharOperator(e1) = Operators.ToChar (e1) @ (55,47--55,54)"; + "let testUInt64ToStringOperator(e1) = Operators.ToString (e1) @ (56,47--56,56)"; + ] + + let expectedOptimized = [ + "type OperatorTestsUInt64"; + "let testUInt64EqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,70--4,78)"; + "let testUInt64NotEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_Equality (e1,e2),False) @ (5,70--5,79)"; + "let testUInt64LessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,70--6,78)"; + "let testUInt64LessThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_GreaterThan (e1,e2),False) @ (7,70--7,79)"; + "let testUInt64GreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,70--8,78)"; + "let testUInt64GreaterThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_LessThan (e1,e2),False) @ (9,70--9,79)"; + "let testUInt64AdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,62--11,70)"; + "let testUInt64SubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,62--12,70)"; + "let testUInt64MultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,61--13,70)"; + "let testUInt64DivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,62--14,70)"; + "let testUInt64ModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,62--15,70)"; + "let testUInt64BitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,62--16,72)"; + "let testUInt64BitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,62--17,72)"; + "let testUInt64BitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,62--18,72)"; + "let testUInt64ShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,Operators.op_BitwiseAnd (e2,63)) @ (19,59--19,69)"; + "let testUInt64ShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,Operators.op_BitwiseAnd (e2,63)) @ (20,59--20,69)"; + "let testUInt64AdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,59--24,76)"; + "let testUInt64SubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,59--25,76)"; + "let testUInt64MultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,59--26,76)"; + "let testUInt64ToByteChecked(e1) = Checked.ToByte (e1) @ (29,47--29,62)"; + "let testUInt64ToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,47--30,63)"; + "let testUInt64ToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,47--31,63)"; + "let testUInt64ToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,47--32,64)"; + "let testUInt64ToIntChecked(e1) = Checked.ToInt32 (e1) @ (33,47--33,61)"; + "let testUInt64ToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,47--34,63)"; + "let testUInt64ToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,47--35,64)"; + "let testUInt64ToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,47--36,63)"; + "let testUInt64ToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,47--37,64)"; + "let testUInt64ToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,47--38,67)"; + "let testUInt64ToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,47--39,68)"; + "let testUInt64ToByteOperator(e1) = Operators.ToByte (e1) @ (41,47--41,54)"; + "let testUInt64ToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,47--42,55)"; + "let testUInt64ToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,47--43,55)"; + "let testUInt64ToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,47--44,56)"; + "let testUInt64ToIntOperator(e1) = Operators.ToInt32 (e1) @ (45,47--45,53)"; + "let testUInt64ToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,47--46,55)"; + "let testUInt64ToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,47--47,56)"; + "let testUInt64ToInt64Operator(e1) = e1 @ (48,47--48,55)"; + "let testUInt64ToUInt64Operator(e1) = e1 @ (49,54--49,56)"; + "let testUInt64ToIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (50,47--50,59)"; + "let testUInt64ToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,47--51,60)"; + "let testUInt64ToSingleOperator(e1) = Operators.ToSingle (Operators.ToDouble (e1)) @ (52,47--52,57)"; + "let testUInt64ToDoubleOperator(e1) = Operators.ToDouble (Operators.ToDouble (e1)) @ (53,47--53,55)"; + "let testUInt64ToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,47--54,57)"; + "let testUInt64ToCharOperator(e1) = Operators.ToUInt16 (e1) @ (55,47--55,54)"; + "let testUInt64ToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,47--56,56)"; + ] + + testOperators "UInt64" "uint64" excludedTests expectedUnoptimized expectedOptimized + +[] +let ``Test Operator Declarations for IntPtr`` () = + let excludedTests = [ ] + + let expectedUnoptimized = [ + "type OperatorTestsIntPtr"; + "let testIntPtrEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,76--4,84)"; + "let testIntPtrNotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,76--5,85)"; + "let testIntPtrLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,76--6,84)"; + "let testIntPtrLessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,76--7,85)"; + "let testIntPtrGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,76--8,84)"; + "let testIntPtrGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,76--9,85)"; + "let testIntPtrAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,68--11,76)"; + "let testIntPtrSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,68--12,76)"; + "let testIntPtrMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,67--13,76)"; + "let testIntPtrDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,68--14,76)"; + "let testIntPtrModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,68--15,76)"; + "let testIntPtrBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,68--16,78)"; + "let testIntPtrBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,68--17,78)"; + "let testIntPtrBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,68--18,78)"; + "let testIntPtrShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (19,62--19,72)"; + "let testIntPtrShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (20,62--20,72)"; + "let testIntPtrUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,51--22,57)"; + "let testIntPtrAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,65--24,82)"; + "let testIntPtrSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,65--25,82)"; + "let testIntPtrMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,65--26,82)"; + "let testIntPtrUnaryNegChecked(e1) = Checked.op_UnaryNegation (e1) @ (27,50--27,65)"; + "let testIntPtrToByteChecked(e1) = Checked.ToByte (e1) @ (29,50--29,65)"; + "let testIntPtrToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,50--30,66)"; + "let testIntPtrToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,50--31,66)"; + "let testIntPtrToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,50--32,67)"; + "let testIntPtrToIntChecked(e1) = Checked.ToInt (e1) @ (33,50--33,64)"; + "let testIntPtrToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,50--34,66)"; + "let testIntPtrToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,50--35,67)"; + "let testIntPtrToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,50--36,66)"; + "let testIntPtrToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,50--37,67)"; + "let testIntPtrToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,50--38,70)"; + "let testIntPtrToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,50--39,71)"; + "let testIntPtrToByteOperator(e1) = Operators.ToByte (e1) @ (41,50--41,57)"; + "let testIntPtrToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,50--42,58)"; + "let testIntPtrToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,50--43,58)"; + "let testIntPtrToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,50--44,59)"; + "let testIntPtrToIntOperator(e1) = Operators.ToInt (e1) @ (45,50--45,56)"; + "let testIntPtrToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,50--46,58)"; + "let testIntPtrToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,50--47,59)"; + "let testIntPtrToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,50--48,58)"; + "let testIntPtrToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,50--49,59)"; + "let testIntPtrToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,50--50,62)"; + "let testIntPtrToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,50--51,63)"; + "let testIntPtrToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,50--52,60)"; + "let testIntPtrToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,50--53,58)"; + "let testIntPtrToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,50--54,60)"; + "let testIntPtrToCharOperator(e1) = Operators.ToChar (e1) @ (55,50--55,57)"; + "let testIntPtrToStringOperator(e1) = Operators.ToString (e1) @ (56,50--56,59)"; + ] + + let expectedOptimized = [ + "type OperatorTestsIntPtr"; + "let testIntPtrEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,76--4,84)"; + "let testIntPtrNotEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_Equality (e1,e2),False) @ (5,76--5,85)"; + "let testIntPtrLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,76--6,84)"; + "let testIntPtrLessThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_GreaterThan (e1,e2),False) @ (7,76--7,85)"; + "let testIntPtrGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,76--8,84)"; + "let testIntPtrGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_LessThan (e1,e2),False) @ (9,76--9,85)"; + "let testIntPtrAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,68--11,76)"; + "let testIntPtrSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,68--12,76)"; + "let testIntPtrMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,67--13,76)"; + "let testIntPtrDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,68--14,76)"; + "let testIntPtrModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,68--15,76)"; + "let testIntPtrBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,68--16,78)"; + "let testIntPtrBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,68--17,78)"; + "let testIntPtrBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,68--18,78)"; + "let testIntPtrShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (19,62--19,72)"; + "let testIntPtrShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (20,62--20,72)"; + "let testIntPtrUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,51--22,57)"; + "let testIntPtrAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,65--24,82)"; + "let testIntPtrSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,65--25,82)"; + "let testIntPtrMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,65--26,82)"; + "let testIntPtrUnaryNegChecked(e1) = Checked.op_Subtraction (0,e1) @ (27,50--27,65)"; + "let testIntPtrToByteChecked(e1) = Checked.ToByte (e1) @ (29,50--29,65)"; + "let testIntPtrToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,50--30,66)"; + "let testIntPtrToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,50--31,66)"; + "let testIntPtrToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,50--32,67)"; + "let testIntPtrToIntChecked(e1) = Checked.ToInt32 (e1) @ (33,50--33,64)"; + "let testIntPtrToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,50--34,66)"; + "let testIntPtrToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,50--35,67)"; + "let testIntPtrToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,50--36,66)"; + "let testIntPtrToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,50--37,67)"; + "let testIntPtrToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,50--38,70)"; + "let testIntPtrToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,50--39,71)"; + "let testIntPtrToByteOperator(e1) = Operators.ToByte (e1) @ (41,50--41,57)"; + "let testIntPtrToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,50--42,58)"; + "let testIntPtrToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,50--43,58)"; + "let testIntPtrToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,50--44,59)"; + "let testIntPtrToIntOperator(e1) = Operators.ToInt32 (e1) @ (45,50--45,56)"; + "let testIntPtrToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,50--46,58)"; + "let testIntPtrToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,50--47,59)"; + "let testIntPtrToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,50--48,58)"; + "let testIntPtrToUInt64Operator(e1) = Operators.ToInt64 (e1) @ (49,50--49,59)"; + "let testIntPtrToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,50--50,62)"; + "let testIntPtrToUIntPtrOperator(e1) = e1 @ (51,50--51,63)"; + "let testIntPtrToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,50--52,60)"; + "let testIntPtrToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,50--53,58)"; + "let testIntPtrToDecimalOperator(e1) = Convert.ToDecimal (Operators.ToInt64 (e1)) @ (54,50--54,60)"; + "let testIntPtrToCharOperator(e1) = Operators.ToUInt16 (e1) @ (55,50--55,57)"; + "let testIntPtrToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,50--56,59)"; + ] + + testOperators "IntPtr" "nativeint" excludedTests expectedUnoptimized expectedOptimized + +[] +let ``Test Operator Declarations for UIntPtr`` () = + let excludedTests = [ + "testUIntPtrUnaryNegOperator"; + "testUIntPtrUnaryNegChecked"; + ] + + let expectedUnoptimized = [ + "type OperatorTestsUIntPtr"; + "let testUIntPtrEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,79--4,87)"; + "let testUIntPtrNotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,79--5,88)"; + "let testUIntPtrLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,79--6,87)"; + "let testUIntPtrLessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,79--7,88)"; + "let testUIntPtrGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,79--8,87)"; + "let testUIntPtrGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,79--9,88)"; + "let testUIntPtrAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,71--11,79)"; + "let testUIntPtrSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,71--12,79)"; + "let testUIntPtrMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,70--13,79)"; + "let testUIntPtrDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,71--14,79)"; + "let testUIntPtrModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,71--15,79)"; + "let testUIntPtrBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,71--16,81)"; + "let testUIntPtrBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,71--17,81)"; + "let testUIntPtrBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,71--18,81)"; + "let testUIntPtrShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (19,64--19,74)"; + "let testUIntPtrShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (20,64--20,74)"; + "let testUIntPtrAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,68--24,85)"; + "let testUIntPtrSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,68--25,85)"; + "let testUIntPtrMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,68--26,85)"; + "let testUIntPtrToByteChecked(e1) = Checked.ToByte (e1) @ (29,52--29,67)"; + "let testUIntPtrToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,52--30,68)"; + "let testUIntPtrToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,52--31,68)"; + "let testUIntPtrToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,52--32,69)"; + "let testUIntPtrToIntChecked(e1) = Checked.ToInt (e1) @ (33,52--33,66)"; + "let testUIntPtrToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,52--34,68)"; + "let testUIntPtrToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,52--35,69)"; + "let testUIntPtrToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,52--36,68)"; + "let testUIntPtrToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,52--37,69)"; + "let testUIntPtrToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,52--38,72)"; + "let testUIntPtrToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,52--39,73)"; + "let testUIntPtrToByteOperator(e1) = Operators.ToByte (e1) @ (41,52--41,59)"; + "let testUIntPtrToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,52--42,60)"; + "let testUIntPtrToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,52--43,60)"; + "let testUIntPtrToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,52--44,61)"; + "let testUIntPtrToIntOperator(e1) = Operators.ToInt (e1) @ (45,52--45,58)"; + "let testUIntPtrToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,52--46,60)"; + "let testUIntPtrToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,52--47,61)"; + "let testUIntPtrToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,52--48,60)"; + "let testUIntPtrToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,52--49,61)"; + "let testUIntPtrToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,52--50,64)"; + "let testUIntPtrToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,52--51,65)"; + "let testUIntPtrToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,52--52,62)"; + "let testUIntPtrToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,52--53,60)"; + "let testUIntPtrToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,52--54,62)"; + "let testUIntPtrToCharOperator(e1) = Operators.ToChar (e1) @ (55,52--55,59)"; + "let testUIntPtrToStringOperator(e1) = Operators.ToString (e1) @ (56,52--56,61)"; + ] + + let expectedOptimized = [ + "type OperatorTestsUIntPtr"; + "let testUIntPtrEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,79--4,87)"; + "let testUIntPtrNotEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_Equality (e1,e2),False) @ (5,79--5,88)"; + "let testUIntPtrLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,79--6,87)"; + "let testUIntPtrLessThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_GreaterThan (e1,e2),False) @ (7,79--7,88)"; + "let testUIntPtrGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,79--8,87)"; + "let testUIntPtrGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_LessThan (e1,e2),False) @ (9,79--9,88)"; + "let testUIntPtrAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,71--11,79)"; + "let testUIntPtrSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,71--12,79)"; + "let testUIntPtrMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,70--13,79)"; + "let testUIntPtrDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,71--14,79)"; + "let testUIntPtrModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,71--15,79)"; + "let testUIntPtrBitwiseAndOperator(e1) (e2) = Operators.op_BitwiseAnd (e1,e2) @ (16,71--16,81)"; + "let testUIntPtrBitwiseOrOperator(e1) (e2) = Operators.op_BitwiseOr (e1,e2) @ (17,71--17,81)"; + "let testUIntPtrBitwiseXorOperator(e1) (e2) = Operators.op_ExclusiveOr (e1,e2) @ (18,71--18,81)"; + "let testUIntPtrShiftLeftOperator(e1) (e2) = Operators.op_LeftShift (e1,e2) @ (19,64--19,74)"; + "let testUIntPtrShiftRightOperator(e1) (e2) = Operators.op_RightShift (e1,e2) @ (20,64--20,74)"; + "let testUIntPtrAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,68--24,85)"; + "let testUIntPtrSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,68--25,85)"; + "let testUIntPtrMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,68--26,85)"; + "let testUIntPtrToByteChecked(e1) = Checked.ToByte (e1) @ (29,52--29,67)"; + "let testUIntPtrToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,52--30,68)"; + "let testUIntPtrToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,52--31,68)"; + "let testUIntPtrToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,52--32,69)"; + "let testUIntPtrToIntChecked(e1) = Checked.ToInt32 (e1) @ (33,52--33,66)"; + "let testUIntPtrToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,52--34,68)"; + "let testUIntPtrToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,52--35,69)"; + "let testUIntPtrToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,52--36,68)"; + "let testUIntPtrToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,52--37,69)"; + "let testUIntPtrToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,52--38,72)"; + "let testUIntPtrToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,52--39,73)"; + "let testUIntPtrToByteOperator(e1) = Operators.ToByte (e1) @ (41,52--41,59)"; + "let testUIntPtrToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,52--42,60)"; + "let testUIntPtrToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,52--43,60)"; + "let testUIntPtrToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,52--44,61)"; + "let testUIntPtrToIntOperator(e1) = Operators.ToInt32 (e1) @ (45,52--45,58)"; + "let testUIntPtrToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,52--46,60)"; + "let testUIntPtrToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,52--47,61)"; + "let testUIntPtrToInt64Operator(e1) = Operators.ToUInt64 (e1) @ (48,52--48,60)"; + "let testUIntPtrToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,52--49,61)"; + "let testUIntPtrToIntPtrOperator(e1) = e1 @ (50,52--50,64)"; + "let testUIntPtrToUIntPtrOperator(e1) = e1 @ (51,63--51,65)"; + "let testUIntPtrToSingleOperator(e1) = Operators.ToSingle (Operators.ToDouble (e1)) @ (52,52--52,62)"; + "let testUIntPtrToDoubleOperator(e1) = Operators.ToDouble (Operators.ToDouble (e1)) @ (53,52--53,60)"; + "let testUIntPtrToDecimalOperator(e1) = Convert.ToDecimal (Operators.ToUInt64 (e1)) @ (54,52--54,62)"; + "let testUIntPtrToCharOperator(e1) = Operators.ToUInt16 (e1) @ (55,52--55,59)"; + "let testUIntPtrToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,52--56,61)"; + ] + + testOperators "UIntPtr" "unativeint" excludedTests expectedUnoptimized expectedOptimized + +[] +let ``Test Operator Declarations for Single`` () = + let excludedTests = [ + "testSingleBitwiseAndOperator"; + "testSingleBitwiseOrOperator"; + "testSingleBitwiseXorOperator"; + "testSingleShiftLeftOperator"; + "testSingleShiftRightOperator"; + ] + + let expectedUnoptimized = [ + "type OperatorTestsSingle"; + "let testSingleEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,72--4,80)"; + "let testSingleNotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,72--5,81)"; + "let testSingleLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,72--6,80)"; + "let testSingleLessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,72--7,81)"; + "let testSingleGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,72--8,80)"; + "let testSingleGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,72--9,81)"; + "let testSingleAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,64--11,72)"; + "let testSingleSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,64--12,72)"; + "let testSingleMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,63--13,72)"; + "let testSingleDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,64--14,72)"; + "let testSingleModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,64--15,72)"; + "let testSingleUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,49--22,55)"; + "let testSingleAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,61--24,78)"; + "let testSingleSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,61--25,78)"; + "let testSingleMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,61--26,78)"; + "let testSingleUnaryNegChecked(e1) = Checked.op_UnaryNegation (e1) @ (27,48--27,63)"; + "let testSingleToByteChecked(e1) = Checked.ToByte (e1) @ (29,48--29,63)"; + "let testSingleToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,48--30,64)"; + "let testSingleToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,48--31,64)"; + "let testSingleToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,48--32,65)"; + "let testSingleToIntChecked(e1) = Checked.ToInt (e1) @ (33,48--33,62)"; + "let testSingleToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,48--34,64)"; + "let testSingleToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,48--35,65)"; + "let testSingleToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,48--36,64)"; + "let testSingleToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,48--37,65)"; + "let testSingleToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,48--38,68)"; + "let testSingleToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,48--39,69)"; + "let testSingleToByteOperator(e1) = Operators.ToByte (e1) @ (41,48--41,55)"; + "let testSingleToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,48--42,56)"; + "let testSingleToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,48--43,56)"; + "let testSingleToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,48--44,57)"; + "let testSingleToIntOperator(e1) = Operators.ToInt (e1) @ (45,48--45,54)"; + "let testSingleToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,48--46,56)"; + "let testSingleToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,48--47,57)"; + "let testSingleToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,48--48,56)"; + "let testSingleToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,48--49,57)"; + "let testSingleToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,48--50,60)"; + "let testSingleToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,48--51,61)"; + "let testSingleToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,48--52,58)"; + "let testSingleToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,48--53,56)"; + "let testSingleToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,48--54,58)"; + "let testSingleToCharOperator(e1) = Operators.ToChar (e1) @ (55,48--55,55)"; + "let testSingleToStringOperator(e1) = Operators.ToString (e1) @ (56,48--56,57)"; + ] + + let expectedOptimized = [ + "type OperatorTestsSingle"; + "let testSingleEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,72--4,80)"; + "let testSingleNotEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_Equality (e1,e2),False) @ (5,72--5,81)"; + "let testSingleLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,72--6,80)"; + "let testSingleLessThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_GreaterThan (e1,e2),False) @ (7,72--7,81)"; + "let testSingleGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,72--8,80)"; + "let testSingleGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_LessThan (e1,e2),False) @ (9,72--9,81)"; + "let testSingleAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,64--11,72)"; + "let testSingleSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,64--12,72)"; + "let testSingleMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,63--13,72)"; + "let testSingleDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,64--14,72)"; + "let testSingleModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,64--15,72)"; + "let testSingleUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,49--22,55)"; + "let testSingleAdditionChecked(e1) (e2) = Operators.op_Addition (e1,e2) @ (24,61--24,78)"; + "let testSingleSubtractionChecked(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (25,61--25,78)"; + "let testSingleMultiplyChecked(e1) (e2) = Operators.op_Multiply (e1,e2) @ (26,61--26,78)"; + "let testSingleUnaryNegChecked(e1) = Operators.op_UnaryNegation (e1) @ (27,48--27,63)"; + "let testSingleToByteChecked(e1) = Checked.ToByte (e1) @ (29,48--29,63)"; + "let testSingleToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,48--30,64)"; + "let testSingleToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,48--31,64)"; + "let testSingleToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,48--32,65)"; + "let testSingleToIntChecked(e1) = Checked.ToInt32 (e1) @ (33,48--33,62)"; + "let testSingleToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,48--34,64)"; + "let testSingleToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,48--35,65)"; + "let testSingleToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,48--36,64)"; + "let testSingleToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,48--37,65)"; + "let testSingleToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,48--38,68)"; + "let testSingleToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,48--39,69)"; + "let testSingleToByteOperator(e1) = Operators.ToByte (e1) @ (41,48--41,55)"; + "let testSingleToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,48--42,56)"; + "let testSingleToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,48--43,56)"; + "let testSingleToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,48--44,57)"; + "let testSingleToIntOperator(e1) = Operators.ToInt32 (e1) @ (45,48--45,54)"; + "let testSingleToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,48--46,56)"; + "let testSingleToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,48--47,57)"; + "let testSingleToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,48--48,56)"; + "let testSingleToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,48--49,57)"; + "let testSingleToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,48--50,60)"; + "let testSingleToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,48--51,61)"; + "let testSingleToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,48--52,58)"; + "let testSingleToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,48--53,56)"; + "let testSingleToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,48--54,58)"; + "let testSingleToCharOperator(e1) = Operators.ToUInt16 (e1) @ (55,48--55,55)"; + "let testSingleToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,48--56,57)"; + ] + + testOperators "Single" "float32" excludedTests expectedUnoptimized expectedOptimized + +[] +let ``Test Operator Declarations for Double`` () = + let excludedTests = [ + "testDoubleBitwiseAndOperator"; + "testDoubleBitwiseOrOperator"; + "testDoubleBitwiseXorOperator"; + "testDoubleShiftLeftOperator"; + "testDoubleShiftRightOperator"; + ] + + let expectedUnoptimized = [ + "type OperatorTestsDouble"; + "let testDoubleEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,68--4,76)"; + "let testDoubleNotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,68--5,77)"; + "let testDoubleLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,68--6,76)"; + "let testDoubleLessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,68--7,77)"; + "let testDoubleGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,68--8,76)"; + "let testDoubleGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,68--9,77)"; + "let testDoubleAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,60--11,68)"; + "let testDoubleSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,60--12,68)"; + "let testDoubleMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,59--13,68)"; + "let testDoubleDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,60--14,68)"; + "let testDoubleModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,60--15,68)"; + "let testDoubleUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,47--22,53)"; + "let testDoubleAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,57--24,74)"; + "let testDoubleSubtractionChecked(e1) (e2) = Checked.op_Subtraction (e1,e2) @ (25,57--25,74)"; + "let testDoubleMultiplyChecked(e1) (e2) = Checked.op_Multiply (e1,e2) @ (26,57--26,74)"; + "let testDoubleUnaryNegChecked(e1) = Checked.op_UnaryNegation (e1) @ (27,46--27,61)"; + "let testDoubleToByteChecked(e1) = Checked.ToByte (e1) @ (29,46--29,61)"; + "let testDoubleToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,46--30,62)"; + "let testDoubleToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,46--31,62)"; + "let testDoubleToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,46--32,63)"; + "let testDoubleToIntChecked(e1) = Checked.ToInt (e1) @ (33,46--33,60)"; + "let testDoubleToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,46--34,62)"; + "let testDoubleToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,46--35,63)"; + "let testDoubleToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,46--36,62)"; + "let testDoubleToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,46--37,63)"; + "let testDoubleToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,46--38,66)"; + "let testDoubleToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,46--39,67)"; + "let testDoubleToByteOperator(e1) = Operators.ToByte (e1) @ (41,46--41,53)"; + "let testDoubleToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,46--42,54)"; + "let testDoubleToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,46--43,54)"; + "let testDoubleToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,46--44,55)"; + "let testDoubleToIntOperator(e1) = Operators.ToInt (e1) @ (45,46--45,52)"; + "let testDoubleToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,46--46,54)"; + "let testDoubleToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,46--47,55)"; + "let testDoubleToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,46--48,54)"; + "let testDoubleToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,46--49,55)"; + "let testDoubleToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,46--50,58)"; + "let testDoubleToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,46--51,59)"; + "let testDoubleToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,46--52,56)"; + "let testDoubleToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,46--53,54)"; + "let testDoubleToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,46--54,56)"; + "let testDoubleToCharOperator(e1) = Operators.ToChar (e1) @ (55,46--55,53)"; + "let testDoubleToStringOperator(e1) = Operators.ToString (e1) @ (56,46--56,55)"; + ] + + let expectedOptimized = [ + "type OperatorTestsDouble"; + "let testDoubleEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,68--4,76)"; + "let testDoubleNotEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_Equality (e1,e2),False) @ (5,68--5,77)"; + "let testDoubleLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,68--6,76)"; + "let testDoubleLessThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_GreaterThan (e1,e2),False) @ (7,68--7,77)"; + "let testDoubleGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,68--8,76)"; + "let testDoubleGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_LessThan (e1,e2),False) @ (9,68--9,77)"; + "let testDoubleAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,60--11,68)"; + "let testDoubleSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,60--12,68)"; + "let testDoubleMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,59--13,68)"; + "let testDoubleDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,60--14,68)"; + "let testDoubleModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,60--15,68)"; + "let testDoubleUnaryNegOperator(e1) = Operators.op_UnaryNegation (e1) @ (22,47--22,53)"; + "let testDoubleAdditionChecked(e1) (e2) = Operators.op_Addition (e1,e2) @ (24,57--24,74)"; + "let testDoubleSubtractionChecked(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (25,57--25,74)"; + "let testDoubleMultiplyChecked(e1) (e2) = Operators.op_Multiply (e1,e2) @ (26,57--26,74)"; + "let testDoubleUnaryNegChecked(e1) = Operators.op_UnaryNegation (e1) @ (27,46--27,61)"; + "let testDoubleToByteChecked(e1) = Checked.ToByte (e1) @ (29,46--29,61)"; + "let testDoubleToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,46--30,62)"; + "let testDoubleToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,46--31,62)"; + "let testDoubleToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,46--32,63)"; + "let testDoubleToIntChecked(e1) = Checked.ToInt32 (e1) @ (33,46--33,60)"; + "let testDoubleToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,46--34,62)"; + "let testDoubleToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,46--35,63)"; + "let testDoubleToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,46--36,62)"; + "let testDoubleToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,46--37,63)"; + "let testDoubleToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,46--38,66)"; + "let testDoubleToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,46--39,67)"; + "let testDoubleToByteOperator(e1) = Operators.ToByte (e1) @ (41,46--41,53)"; + "let testDoubleToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,46--42,54)"; + "let testDoubleToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,46--43,54)"; + "let testDoubleToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,46--44,55)"; + "let testDoubleToIntOperator(e1) = Operators.ToInt32 (e1) @ (45,46--45,52)"; + "let testDoubleToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,46--46,54)"; + "let testDoubleToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,46--47,55)"; + "let testDoubleToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,46--48,54)"; + "let testDoubleToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,46--49,55)"; + "let testDoubleToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,46--50,58)"; + "let testDoubleToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,46--51,59)"; + "let testDoubleToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,46--52,56)"; + "let testDoubleToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,46--53,54)"; + "let testDoubleToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,46--54,56)"; + "let testDoubleToCharOperator(e1) = Operators.ToUInt16 (e1) @ (55,46--55,53)"; + "let testDoubleToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,46--56,55)"; + ] + + testOperators "Double" "float" excludedTests expectedUnoptimized expectedOptimized + +[] +let ``Test Operator Declarations for Decimal`` () = + let excludedTests = [ + "testDecimalBitwiseAndOperator"; + "testDecimalBitwiseOrOperator"; + "testDecimalBitwiseXorOperator"; + "testDecimalShiftLeftOperator"; + "testDecimalShiftRightOperator"; + "testDecimalUnaryNegOperator"; + "testDecimalSubtractionChecked"; + "testDecimalMultiplyChecked"; + "testDecimalUnaryNegChecked"; + "testDecimalToIntPtrChecked"; + "testDecimalToUIntPtrChecked"; + "testDecimalToIntPtrOperator"; + "testDecimalToUIntPtrOperator"; + ] + + let expectedUnoptimized = [ + "type OperatorTestsDecimal"; + "let testDecimalEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,73--4,81)"; + "let testDecimalNotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,73--5,82)"; + "let testDecimalLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,73--6,81)"; + "let testDecimalLessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,73--7,82)"; + "let testDecimalGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,73--8,81)"; + "let testDecimalGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,73--9,82)"; + "let testDecimalAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,65--11,73)"; + "let testDecimalSubtractionOperator(e1) (e2) = Operators.op_Subtraction (e1,e2) @ (12,65--12,73)"; + "let testDecimalMultiplyOperator(e1) (e2) = Operators.op_Multiply (e1,e2) @ (13,64--13,73)"; + "let testDecimalDivisionOperator(e1) (e2) = Operators.op_Division (e1,e2) @ (14,65--14,73)"; + "let testDecimalModulusOperator(e1) (e2) = Operators.op_Modulus (e1,e2) @ (15,65--15,73)"; + "let testDecimalAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,62--24,79)"; + "let testDecimalToByteChecked(e1) = Checked.ToByte (e1) @ (29,49--29,64)"; + "let testDecimalToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,49--30,65)"; + "let testDecimalToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,49--31,65)"; + "let testDecimalToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,49--32,66)"; + "let testDecimalToIntChecked(e1) = Checked.ToInt (e1) @ (33,49--33,63)"; + "let testDecimalToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,49--34,65)"; + "let testDecimalToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,49--35,66)"; + "let testDecimalToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,49--36,65)"; + "let testDecimalToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,49--37,66)"; + "let testDecimalToByteOperator(e1) = Operators.ToByte (e1) @ (41,49--41,56)"; + "let testDecimalToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,49--42,57)"; + "let testDecimalToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,49--43,57)"; + "let testDecimalToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,49--44,58)"; + "let testDecimalToIntOperator(e1) = Operators.ToInt (e1) @ (45,49--45,55)"; + "let testDecimalToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,49--46,57)"; + "let testDecimalToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,49--47,58)"; + "let testDecimalToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,49--48,57)"; + "let testDecimalToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,49--49,58)"; + "let testDecimalToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,49--52,59)"; + "let testDecimalToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,49--53,57)"; + "let testDecimalToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,49--54,59)"; + "let testDecimalToCharOperator(e1) = Operators.ToChar (e1) @ (55,49--55,56)"; + "let testDecimalToStringOperator(e1) = Operators.ToString (e1) @ (56,49--56,58)"; + ] + + let expectedOptimized = [ + "type OperatorTestsDecimal"; + "let testDecimalEqualsOperator(e1) (e2) = Decimal.op_Equality (e1,e2) @ (4,73--4,81)"; + "let testDecimalNotEqualsOperator(e1) (e2) = Operators.op_Equality (Decimal.op_Equality (e1,e2),False) @ (5,73--5,82)"; + "let testDecimalLessThanOperator(e1) (e2) = Decimal.op_LessThan (e1,e2) @ (6,73--6,81)"; + "let testDecimalLessThanOrEqualsOperator(e1) (e2) = Decimal.op_LessThanOrEqual (e1,e2) @ (7,73--7,82)"; + "let testDecimalGreaterThanOperator(e1) (e2) = Decimal.op_GreaterThan (e1,e2) @ (8,73--8,81)"; + "let testDecimalGreaterThanOrEqualsOperator(e1) (e2) = Decimal.op_GreaterThanOrEqual (e1,e2) @ (9,73--9,82)"; + "let testDecimalAdditionOperator(e1) (e2) = Decimal.op_Addition (e1,e2) @ (11,65--11,73)"; + "let testDecimalSubtractionOperator(e1) (e2) = Decimal.op_Subtraction (e1,e2) @ (12,65--12,73)"; + "let testDecimalMultiplyOperator(e1) (e2) = Decimal.op_Multiply (e1,e2) @ (13,64--13,73)"; + "let testDecimalDivisionOperator(e1) (e2) = Decimal.op_Division (e1,e2) @ (14,65--14,73)"; + "let testDecimalModulusOperator(e1) (e2) = Decimal.op_Modulus (e1,e2) @ (15,65--15,73)"; + "let testDecimalAdditionChecked(e1) (e2) = Decimal.op_Addition (e1,e2) @ (24,62--24,79)"; + "let testDecimalToByteChecked(e1) = Decimal.op_Explicit (e1) @ (29,49--29,64)"; + "let testDecimalToSByteChecked(e1) = Decimal.op_Explicit (e1) @ (30,49--30,65)"; + "let testDecimalToInt16Checked(e1) = Decimal.op_Explicit (e1) @ (31,49--31,65)"; + "let testDecimalToUInt16Checked(e1) = Decimal.op_Explicit (e1) @ (32,49--32,66)"; + "let testDecimalToIntChecked(e1) = Decimal.op_Explicit (e1) @ (33,49--33,63)"; + "let testDecimalToInt32Checked(e1) = Decimal.op_Explicit (e1) @ (34,49--34,65)"; + "let testDecimalToUInt32Checked(e1) = Decimal.op_Explicit (e1) @ (35,49--35,66)"; + "let testDecimalToInt64Checked(e1) = Decimal.op_Explicit (e1) @ (36,49--36,65)"; + "let testDecimalToUInt64Checked(e1) = Decimal.op_Explicit (e1) @ (37,49--37,66)"; + "let testDecimalToByteOperator(e1) = Decimal.op_Explicit (e1) @ (41,49--41,56)"; + "let testDecimalToSByteOperator(e1) = Decimal.op_Explicit (e1) @ (42,49--42,57)"; + "let testDecimalToInt16Operator(e1) = Decimal.op_Explicit (e1) @ (43,49--43,57)"; + "let testDecimalToUInt16Operator(e1) = Decimal.op_Explicit (e1) @ (44,49--44,58)"; + "let testDecimalToIntOperator(e1) = Decimal.op_Explicit (e1) @ (45,49--45,55)"; + "let testDecimalToInt32Operator(e1) = Decimal.op_Explicit (e1) @ (46,49--46,57)"; + "let testDecimalToUInt32Operator(e1) = Decimal.op_Explicit (e1) @ (47,49--47,58)"; + "let testDecimalToInt64Operator(e1) = Decimal.op_Explicit (e1) @ (48,49--48,57)"; + "let testDecimalToUInt64Operator(e1) = Decimal.op_Explicit (e1) @ (49,49--49,58)"; + "let testDecimalToSingleOperator(e1) = Decimal.op_Explicit (e1) @ (52,49--52,59)"; + "let testDecimalToDoubleOperator(e1) = Convert.ToDouble (e1) @ (53,49--53,57)"; + "let testDecimalToDecimalOperator(e1) = e1 @ (54,57--54,59)"; + "let testDecimalToCharOperator(e1) = Decimal.op_Explicit (e1) @ (55,49--55,56)"; + "let testDecimalToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,49--56,58)"; + ] + + testOperators "Decimal" "decimal" excludedTests expectedUnoptimized expectedOptimized + +[] +let ``Test Operator Declarations for Char`` () = + let excludedTests = [ + "testCharSubtractionOperator"; + "testCharMultiplyOperator"; + "testCharDivisionOperator"; + "testCharModulusOperator"; + "testCharBitwiseAndOperator"; + "testCharBitwiseOrOperator"; + "testCharBitwiseXorOperator"; + "testCharShiftLeftOperator"; + "testCharShiftRightOperator"; + "testCharUnaryNegOperator"; + "testCharSubtractionChecked"; + "testCharMultiplyChecked"; + "testCharUnaryNegChecked"; + "testCharToDecimalOperator"; + ] + + let expectedUnoptimized = [ + "type OperatorTestsChar"; + "let testCharEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,64--4,72)"; + "let testCharNotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,64--5,73)"; + "let testCharLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,64--6,72)"; + "let testCharLessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,64--7,73)"; + "let testCharGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,64--8,72)"; + "let testCharGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,64--9,73)"; + "let testCharAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,56--11,64)"; + "let testCharAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,53--24,70)"; + "let testCharToByteChecked(e1) = Checked.ToByte (e1) @ (29,43--29,58)"; + "let testCharToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,43--30,59)"; + "let testCharToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,43--31,59)"; + "let testCharToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,43--32,60)"; + "let testCharToIntChecked(e1) = Checked.ToInt (e1) @ (33,43--33,57)"; + "let testCharToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,43--34,59)"; + "let testCharToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,43--35,60)"; + "let testCharToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,43--36,59)"; + "let testCharToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,43--37,60)"; + "let testCharToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,43--38,63)"; + "let testCharToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,43--39,64)"; + "let testCharToByteOperator(e1) = Operators.ToByte (e1) @ (41,43--41,50)"; + "let testCharToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,43--42,51)"; + "let testCharToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,43--43,51)"; + "let testCharToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,43--44,52)"; + "let testCharToIntOperator(e1) = Operators.ToInt (e1) @ (45,43--45,49)"; + "let testCharToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,43--46,51)"; + "let testCharToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,43--47,52)"; + "let testCharToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,43--48,51)"; + "let testCharToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,43--49,52)"; + "let testCharToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,43--50,55)"; + "let testCharToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,43--51,56)"; + "let testCharToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,43--52,53)"; + "let testCharToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,43--53,51)"; + "let testCharToCharOperator(e1) = Operators.ToChar (e1) @ (55,43--55,50)"; + "let testCharToStringOperator(e1) = Operators.ToString (e1) @ (56,43--56,52)"; + ] + + let expectedOptimized = [ + "type OperatorTestsChar"; + "let testCharEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,64--4,72)"; + "let testCharNotEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_Equality (e1,e2),False) @ (5,64--5,73)"; + "let testCharLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,64--6,72)"; + "let testCharLessThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_GreaterThan (e1,e2),False) @ (7,64--7,73)"; + "let testCharGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,64--8,72)"; + "let testCharGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_LessThan (e1,e2),False) @ (9,64--9,73)"; + "let testCharAdditionOperator(e1) (e2) = Operators.ToUInt16 (Operators.op_Addition (e1,e2)) @ (11,56--11,64)"; + "let testCharAdditionChecked(e1) (e2) = Checked.ToUInt16 (Checked.op_Addition (e1,e2)) @ (24,53--24,70)"; + "let testCharToByteChecked(e1) = Checked.ToByte (e1) @ (29,43--29,58)"; + "let testCharToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,43--30,59)"; + "let testCharToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,43--31,59)"; + "let testCharToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,43--32,60)"; + "let testCharToIntChecked(e1) = Checked.ToInt32 (e1) @ (33,43--33,57)"; + "let testCharToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,43--34,59)"; + "let testCharToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,43--35,60)"; + "let testCharToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,43--36,59)"; + "let testCharToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,43--37,60)"; + "let testCharToIntPtrChecked(e1) = Checked.ToIntPtr (e1) @ (38,43--38,63)"; + "let testCharToUIntPtrChecked(e1) = Checked.ToUIntPtr (e1) @ (39,43--39,64)"; + "let testCharToByteOperator(e1) = Operators.ToByte (e1) @ (41,43--41,50)"; + "let testCharToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,43--42,51)"; + "let testCharToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,43--43,51)"; + "let testCharToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,43--44,52)"; + "let testCharToIntOperator(e1) = Operators.ToInt32 (e1) @ (45,43--45,49)"; + "let testCharToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,43--46,51)"; + "let testCharToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,43--47,52)"; + "let testCharToInt64Operator(e1) = Operators.ToUInt64 (e1) @ (48,43--48,51)"; + "let testCharToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,43--49,52)"; + "let testCharToIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (50,43--50,55)"; + "let testCharToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,43--51,56)"; + "let testCharToSingleOperator(e1) = Operators.ToSingle (Operators.ToDouble (e1)) @ (52,43--52,53)"; + "let testCharToDoubleOperator(e1) = Operators.ToDouble (Operators.ToDouble (e1)) @ (53,43--53,51)"; + "let testCharToCharOperator(e1) = Operators.ToUInt16 (e1) @ (55,43--55,50)"; + "let testCharToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,43--56,52)"; + ] + + testOperators "Char" "char" excludedTests expectedUnoptimized expectedOptimized + +[] +let ``Test Operator Declarations for String`` () = + let excludedTests = [ + "testStringSubtractionOperator"; + "testStringMultiplyOperator"; + "testStringDivisionOperator"; + "testStringModulusOperator"; + "testStringBitwiseAndOperator"; + "testStringBitwiseOrOperator"; + "testStringBitwiseXorOperator"; + "testStringShiftLeftOperator"; + "testStringShiftRightOperator"; + "testStringUnaryNegOperator"; + "testStringSubtractionChecked"; + "testStringMultiplyChecked"; + "testStringUnaryNegChecked"; + "testStringToIntPtrChecked"; + "testStringToUIntPtrChecked"; + "testStringToIntPtrOperator"; + "testStringToUIntPtrOperator"; + ] + + let expectedUnoptimized = [ + "type OperatorTestsString"; + "let testStringEqualsOperator(e1) (e2) = Operators.op_Equality (e1,e2) @ (4,70--4,78)"; + "let testStringNotEqualsOperator(e1) (e2) = Operators.op_Inequality (e1,e2) @ (5,70--5,79)"; + "let testStringLessThanOperator(e1) (e2) = Operators.op_LessThan (e1,e2) @ (6,70--6,78)"; + "let testStringLessThanOrEqualsOperator(e1) (e2) = Operators.op_LessThanOrEqual (e1,e2) @ (7,70--7,79)"; + "let testStringGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,70--8,78)"; + "let testStringGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_GreaterThanOrEqual (e1,e2) @ (9,70--9,79)"; + "let testStringAdditionOperator(e1) (e2) = Operators.op_Addition (e1,e2) @ (11,62--11,70)"; + "let testStringAdditionChecked(e1) (e2) = Checked.op_Addition (e1,e2) @ (24,59--24,76)"; + "let testStringToByteChecked(e1) = Checked.ToByte (e1) @ (29,47--29,62)"; + "let testStringToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,47--30,63)"; + "let testStringToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,47--31,63)"; + "let testStringToUInt16Checked(e1) = Checked.ToUInt16 (e1) @ (32,47--32,64)"; + "let testStringToIntChecked(e1) = Checked.ToInt (e1) @ (33,47--33,61)"; + "let testStringToInt32Checked(e1) = Checked.ToInt32 (e1) @ (34,47--34,63)"; + "let testStringToUInt32Checked(e1) = Checked.ToUInt32 (e1) @ (35,47--35,64)"; + "let testStringToInt64Checked(e1) = Checked.ToInt64 (e1) @ (36,47--36,63)"; + "let testStringToUInt64Checked(e1) = Checked.ToUInt64 (e1) @ (37,47--37,64)"; + "let testStringToByteOperator(e1) = Operators.ToByte (e1) @ (41,47--41,54)"; + "let testStringToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,47--42,55)"; + "let testStringToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,47--43,55)"; + "let testStringToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,47--44,56)"; + "let testStringToIntOperator(e1) = Operators.ToInt (e1) @ (45,47--45,53)"; + "let testStringToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,47--46,55)"; + "let testStringToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,47--47,56)"; + "let testStringToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,47--48,55)"; + "let testStringToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,47--49,56)"; + "let testStringToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,47--52,57)"; + "let testStringToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,47--53,55)"; + "let testStringToDecimalOperator(e1) = Operators.ToDecimal (e1) @ (54,47--54,57)"; + "let testStringToCharOperator(e1) = Operators.ToChar (e1) @ (55,47--55,54)"; + "let testStringToStringOperator(e1) = Operators.ToString (e1) @ (56,47--56,56)"; + ] + + let expectedOptimized = [ + "type OperatorTestsString"; + "let testStringEqualsOperator(e1) (e2) = String.Equals (e1,e2) @ (4,70--4,78)"; + "let testStringNotEqualsOperator(e1) (e2) = Operators.op_Equality (String.Equals (e1,e2),False) @ (5,70--5,79)"; + "let testStringLessThanOperator(e1) (e2) = HashCompare.GenericLessThanIntrinsic (e1,e2) @ (6,70--6,78)"; + "let testStringLessThanOrEqualsOperator(e1) (e2) = HashCompare.GenericLessOrEqualIntrinsic (e1,e2) @ (7,70--7,79)"; + "let testStringGreaterThanOperator(e1) (e2) = HashCompare.GenericGreaterThanIntrinsic (e1,e2) @ (8,70--8,78)"; + "let testStringGreaterThanOrEqualsOperator(e1) (e2) = HashCompare.GenericGreaterOrEqualIntrinsic (e1,e2) @ (9,70--9,79)"; + "let testStringAdditionOperator(e1) (e2) = String.Concat (e1,e2) @ (11,62--11,70)"; + "let testStringAdditionChecked(e1) (e2) = String.Concat (e1,e2) @ (24,59--24,76)"; + "let testStringToByteChecked(e1) = Checked.ToByte (LanguagePrimitives.ParseUInt32 (e1)) @ (29,47--29,62)"; + "let testStringToSByteChecked(e1) = Checked.ToSByte (LanguagePrimitives.ParseInt32 (e1)) @ (30,47--30,63)"; + "let testStringToInt16Checked(e1) = Checked.ToInt16 (LanguagePrimitives.ParseInt32 (e1)) @ (31,47--31,63)"; + "let testStringToUInt16Checked(e1) = Checked.ToUInt16 (LanguagePrimitives.ParseUInt32 (e1)) @ (32,47--32,64)"; + "let testStringToIntChecked(e1) = LanguagePrimitives.ParseInt32 (e1) @ (33,47--33,61)"; + "let testStringToInt32Checked(e1) = LanguagePrimitives.ParseInt32 (e1) @ (34,47--34,63)"; + "let testStringToUInt32Checked(e1) = LanguagePrimitives.ParseUInt32 (e1) @ (35,47--35,64)"; + "let testStringToInt64Checked(e1) = LanguagePrimitives.ParseInt64 (e1) @ (36,47--36,63)"; + "let testStringToUInt64Checked(e1) = LanguagePrimitives.ParseUInt64 (e1) @ (37,47--37,64)"; + "let testStringToByteOperator(e1) = Checked.ToByte (LanguagePrimitives.ParseUInt32 (e1)) @ (41,47--41,54)"; + "let testStringToSByteOperator(e1) = Checked.ToSByte (LanguagePrimitives.ParseInt32 (e1)) @ (42,47--42,55)"; + "let testStringToInt16Operator(e1) = Checked.ToInt16 (LanguagePrimitives.ParseInt32 (e1)) @ (43,47--43,55)"; + "let testStringToUInt16Operator(e1) = Checked.ToUInt16 (LanguagePrimitives.ParseUInt32 (e1)) @ (44,47--44,56)"; + "let testStringToIntOperator(e1) = LanguagePrimitives.ParseInt32 (e1) @ (45,47--45,53)"; + "let testStringToInt32Operator(e1) = LanguagePrimitives.ParseInt32 (e1) @ (46,47--46,55)"; + "let testStringToUInt32Operator(e1) = LanguagePrimitives.ParseUInt32 (e1) @ (47,47--47,56)"; + "let testStringToInt64Operator(e1) = LanguagePrimitives.ParseInt64 (e1) @ (48,47--48,55)"; + "let testStringToUInt64Operator(e1) = LanguagePrimitives.ParseUInt64 (e1) @ (49,47--49,56)"; + "let testStringToSingleOperator(e1) = Single.Parse ((if Operators.op_Equality (e1,dflt) then dflt else e1.Replace(\"_\",\"\")),167,CultureInfo.get_InvariantCulture () :> System.IFormatProvider) @ (52,47--52,57)"; + "let testStringToDoubleOperator(e1) = Double.Parse ((if Operators.op_Equality (e1,dflt) then dflt else e1.Replace(\"_\",\"\")),167,CultureInfo.get_InvariantCulture () :> System.IFormatProvider) @ (53,47--53,55)"; + "let testStringToDecimalOperator(e1) = Decimal.Parse (e1,167,CultureInfo.get_InvariantCulture () :> System.IFormatProvider) @ (54,47--54,57)"; + "let testStringToCharOperator(e1) = Char.Parse (e1) @ (55,47--55,54)"; + "let testStringToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,47--56,56)"; + ] + + testOperators "String" "string" excludedTests expectedUnoptimized expectedOptimized + + //--------------------------------------------------------------------------------------------------------- // This big list expression was causing us trouble From ddf74bd3903ff63f6dd69468d33ec5dde034e095 Mon Sep 17 00:00:00 2001 From: ncave <777696+ncave@users.noreply.github.com> Date: Wed, 14 Feb 2018 04:03:37 -0800 Subject: [PATCH 20/21] review fixes --- src/fsharp/TastOps.fs | 4 ++- src/fsharp/TastOps.fsi | 4 ++- src/fsharp/TcGlobals.fs | 12 ++++++-- src/fsharp/symbols/Exprs.fs | 38 ++++++++++++++++++++--- tests/service/ExprTests.fs | 60 ++++++++++++++++++------------------- 5 files changed, 79 insertions(+), 39 deletions(-) diff --git a/src/fsharp/TastOps.fs b/src/fsharp/TastOps.fs index 75716383667..53b92da0fb4 100644 --- a/src/fsharp/TastOps.fs +++ b/src/fsharp/TastOps.fs @@ -6187,7 +6187,6 @@ let mkCallToSByteOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrin let mkCallToInt16Operator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.int16_operator_info, [[ty]], [e1], m) let mkCallToUInt16Operator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.uint16_operator_info, [[ty]], [e1], m) let mkCallToIntOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.int_operator_info, [[ty]], [e1], m) -let mkCallToEnumOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.enum_operator_info, [[ty]], [e1], m) let mkCallToInt32Operator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.int32_operator_info, [[ty]], [e1], m) let mkCallToUInt32Operator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.uint32_operator_info, [[ty]], [e1], m) let mkCallToInt64Operator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.int64_operator_info, [[ty]], [e1], m) @@ -6197,6 +6196,9 @@ let mkCallToDoubleOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrin let mkCallToIntPtrOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.nativeint_operator_info, [[ty]], [e1], m) let mkCallToUIntPtrOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.unativeint_operator_info, [[ty]], [e1], m) +let mkCallToCharOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.char_operator_info, [[ty]], [e1], m) +let mkCallToEnumOperator (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.enum_operator_info, [[ty]], [e1], m) + let mkCallArrayLength (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.array_length_info, [[ty]], [e1], m) let mkCallArrayGet (g:TcGlobals) m ty e1 idx1 = mkApps g (typedExprForIntrinsic g m g.array_get_info, [[ty]], [ e1 ; idx1 ], m) let mkCallArray2DGet (g:TcGlobals) m ty e1 idx1 idx2 = mkApps g (typedExprForIntrinsic g m g.array2D_get_info, [[ty]], [ e1 ; idx1; idx2 ], m) diff --git a/src/fsharp/TastOps.fsi b/src/fsharp/TastOps.fsi index aefe35c8edc..9f23629b25e 100755 --- a/src/fsharp/TastOps.fsi +++ b/src/fsharp/TastOps.fsi @@ -1280,7 +1280,6 @@ val mkCallToSByteOperator : TcGlobals -> range -> TType -> Ex val mkCallToInt16Operator : TcGlobals -> range -> TType -> Expr -> Expr val mkCallToUInt16Operator : TcGlobals -> range -> TType -> Expr -> Expr val mkCallToIntOperator : TcGlobals -> range -> TType -> Expr -> Expr -val mkCallToEnumOperator : TcGlobals -> range -> TType -> Expr -> Expr val mkCallToInt32Operator : TcGlobals -> range -> TType -> Expr -> Expr val mkCallToUInt32Operator : TcGlobals -> range -> TType -> Expr -> Expr val mkCallToInt64Operator : TcGlobals -> range -> TType -> Expr -> Expr @@ -1290,6 +1289,9 @@ val mkCallToDoubleOperator : TcGlobals -> range -> TType -> Ex val mkCallToIntPtrOperator : TcGlobals -> range -> TType -> Expr -> Expr val mkCallToUIntPtrOperator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToCharOperator : TcGlobals -> range -> TType -> Expr -> Expr +val mkCallToEnumOperator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallDeserializeQuotationFSharp20Plus : TcGlobals -> range -> Expr -> Expr -> Expr -> Expr -> Expr val mkCallDeserializeQuotationFSharp40Plus : TcGlobals -> range -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr val mkCallCastQuotation : TcGlobals -> range -> TType -> Expr -> Expr diff --git a/src/fsharp/TcGlobals.fs b/src/fsharp/TcGlobals.fs index 32bb8af8389..72c8fbb0a75 100755 --- a/src/fsharp/TcGlobals.fs +++ b/src/fsharp/TcGlobals.fs @@ -295,7 +295,6 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d let v_int16_ty = mkNonGenericTy v_int16_tcr let v_uint16_ty = mkNonGenericTy v_uint16_tcr let v_int_ty = mkNonGenericTy v_int_tcr - let v_enum_ty = mkNonGenericTy v_int_tcr let v_int32_ty = mkNonGenericTy v_int32_tcr let v_uint32_ty = mkNonGenericTy v_uint32_tcr let v_int64_ty = mkNonGenericTy v_int64_tcr @@ -305,6 +304,7 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d let v_nativeint_ty = mkNonGenericTy v_nativeint_tcr let v_unativeint_ty = mkNonGenericTy v_unativeint_tcr + let v_enum_ty = mkNonGenericTy v_int_tcr let v_bool_ty = mkNonGenericTy v_bool_tcr let v_char_ty = mkNonGenericTy v_char_tcr let v_obj_ty = mkNonGenericTy v_obj_tcr @@ -607,7 +607,6 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d let v_int16_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "int16" , None , Some "ToInt16", [vara], ([[varaTy]], v_int16_ty)) let v_uint16_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "uint16" , None , Some "ToUInt16", [vara], ([[varaTy]], v_uint16_ty)) let v_int_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "int" , None , Some "ToInt", [vara], ([[varaTy]], v_int_ty)) - let v_enum_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "enum" , None , Some "ToEnum", [vara], ([[varaTy]], v_enum_ty)) let v_int32_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "int32" , None , Some "ToInt32", [vara], ([[varaTy]], v_int32_ty)) let v_uint32_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "uint32" , None , Some "ToUInt32", [vara], ([[varaTy]], v_uint32_ty)) let v_int64_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "int64" , None , Some "ToInt64", [vara], ([[varaTy]], v_int64_ty)) @@ -617,6 +616,9 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d let v_nativeint_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "nativeint" , None , Some "ToIntPtr", [vara], ([[varaTy]], v_nativeint_ty)) let v_unativeint_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "unativeint" , None , Some "ToUIntPtr", [vara], ([[varaTy]], v_unativeint_ty)) + let v_char_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "char" , None , Some "ToChar", [vara], ([[varaTy]], v_char_ty)) + let v_enum_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "enum" , None , Some "ToEnum", [vara], ([[varaTy]], v_enum_ty)) + let v_hash_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "hash" , None , Some "Hash" , [vara], ([[varaTy]], v_int_ty)) let v_box_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "box" , None , Some "Box" , [vara], ([[varaTy]], v_obj_ty)) let v_isnull_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "isNull" , None , Some "IsNull" , [vara], ([[varaTy]], v_bool_ty)) @@ -886,6 +888,8 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member __.expr_tcr = v_expr_tcr member __.raw_expr_tcr = v_raw_expr_tcr member __.nativeint_tcr = v_nativeint_tcr + member __.unativeint_tcr = v_unativeint_tcr + member __.int_tcr = v_int_tcr member __.int32_tcr = v_int32_tcr member __.int16_tcr = v_int16_tcr member __.int64_tcr = v_int64_tcr @@ -1227,7 +1231,6 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member __.int16_operator_info = v_int16_operator_info member __.uint16_operator_info = v_uint16_operator_info member __.int_operator_info = v_int_operator_info - member __.enum_operator_info = v_enum_operator_info member __.int32_operator_info = v_int32_operator_info member __.uint32_operator_info = v_uint32_operator_info member __.int64_operator_info = v_int64_operator_info @@ -1237,6 +1240,9 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member __.nativeint_operator_info = v_nativeint_operator_info member __.unativeint_operator_info = v_unativeint_operator_info + member __.char_operator_info = v_char_operator_info + member __.enum_operator_info = v_enum_operator_info + member val compare_operator_vref = ValRefForIntrinsic v_compare_operator_info member val equals_operator_vref = ValRefForIntrinsic v_equals_operator_info member val equals_nullable_operator_vref = ValRefForIntrinsic v_equals_nullable_operator_info diff --git a/src/fsharp/symbols/Exprs.fs b/src/fsharp/symbols/Exprs.fs index ba5c1872438..f75403a4155 100644 --- a/src/fsharp/symbols/Exprs.fs +++ b/src/fsharp/symbols/Exprs.fs @@ -268,6 +268,27 @@ module FSharpExprConvert = | DT_REF -> None | _ -> None + let (|TTypeConvOp|_|) (cenv:Impl.cenv) ty = + let g = cenv.g + match ty with + | TType_app (tcref,_) -> + match tcref with + | x when tyconRefEq g tcref g.sbyte_tcr -> Some mkCallToSByteOperator + | x when tyconRefEq g tcref g.byte_tcr -> Some mkCallToByteOperator + | x when tyconRefEq g tcref g.int16_tcr -> Some mkCallToInt16Operator + | x when tyconRefEq g tcref g.uint16_tcr -> Some mkCallToUInt16Operator + | x when tyconRefEq g tcref g.int_tcr -> Some mkCallToIntOperator + | x when tyconRefEq g tcref g.int32_tcr -> Some mkCallToInt32Operator + | x when tyconRefEq g tcref g.uint32_tcr -> Some mkCallToUInt32Operator + | x when tyconRefEq g tcref g.int64_tcr -> Some mkCallToInt64Operator + | x when tyconRefEq g tcref g.uint64_tcr -> Some mkCallToUInt64Operator + | x when tyconRefEq g tcref g.float32_tcr -> Some mkCallToSingleOperator + | x when tyconRefEq g tcref g.float_tcr -> Some mkCallToDoubleOperator + | x when tyconRefEq g tcref g.nativeint_tcr -> Some mkCallToIntPtrOperator + | x when tyconRefEq g tcref g.unativeint_tcr -> Some mkCallToUIntPtrOperator + | _ -> None + | _ -> None + let ConvType cenv typ = FSharpType(cenv, typ) let ConvTypes cenv typs = List.map (ConvType cenv) typs let ConvILTypeRefApp (cenv:Impl.cenv) m tref tyargs = @@ -601,8 +622,14 @@ module FSharpExprConvert = let argR = ConvExpr cenv env arg E.ILFieldSet(None, typR, fspec.Name, argR) - | TOp.ILAsm([ ], _), _, [arg] -> - ConvExprPrim cenv env arg + | TOp.ILAsm([ ], [tty]), _, [arg] -> + match tty with + | TTypeConvOp cenv convOp -> + let ty = tyOfExpr cenv.g arg + let op = convOp cenv.g m ty arg + ConvExprPrim cenv env op + | _ -> + ConvExprPrim cenv env arg | TOp.ILAsm([ I_box _ ], _), [ty], [arg] -> let op = mkCallBox cenv.g m ty arg @@ -671,9 +698,12 @@ module FSharpExprConvert = let op2 = convertOp2 cenv.g m ty2 op1 ConvExprPrim cenv env op2 - | TOp.ILAsm([ ILConvertOp convertOp ], _), _, [arg] -> + | TOp.ILAsm([ ILConvertOp convertOp ], [TType_app (tcref,_)]), _, [arg] -> let ty = tyOfExpr cenv.g arg - let op = convertOp cenv.g m ty arg + let op = + if tyconRefEq cenv.g tcref cenv.g.char_tcr + then mkCallToCharOperator cenv.g m ty arg + else convertOp cenv.g m ty arg ConvExprPrim cenv env op | TOp.ILAsm([ I_throw ], _), _, [arg1] -> diff --git a/tests/service/ExprTests.fs b/tests/service/ExprTests.fs index b013ee83920..1d3e9675b12 100644 --- a/tests/service/ExprTests.fs +++ b/tests/service/ExprTests.fs @@ -1051,7 +1051,7 @@ let ``Test Operator Declarations for Byte`` () = "let testByteToSingleOperator(e1) = Operators.ToSingle (Operators.ToDouble (e1)) @ (52,43--52,53)"; "let testByteToDoubleOperator(e1) = Operators.ToDouble (Operators.ToDouble (e1)) @ (53,43--53,51)"; "let testByteToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,43--54,53)"; - "let testByteToCharOperator(e1) = Operators.ToUInt16 (e1) @ (55,43--55,50)"; + "let testByteToCharOperator(e1) = Operators.ToChar (e1) @ (55,43--55,50)"; "let testByteToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,43--56,52)"; ] @@ -1151,9 +1151,9 @@ let ``Test Operator Declarations for SByte`` () = "let testSByteToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,45--42,53)"; "let testSByteToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,45--43,53)"; "let testSByteToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,45--44,54)"; - "let testSByteToIntOperator(e1) = e1 @ (45,45--45,51)"; - "let testSByteToInt32Operator(e1) = e1 @ (46,45--46,53)"; - "let testSByteToUInt32Operator(e1) = e1 @ (47,45--47,54)"; + "let testSByteToIntOperator(e1) = Operators.ToInt32 (e1) @ (45,45--45,51)"; + "let testSByteToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,45--46,53)"; + "let testSByteToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,45--47,54)"; "let testSByteToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,45--48,53)"; "let testSByteToUInt64Operator(e1) = Operators.ToInt64 (e1) @ (49,45--49,54)"; "let testSByteToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,45--50,57)"; @@ -1161,7 +1161,7 @@ let ``Test Operator Declarations for SByte`` () = "let testSByteToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,45--52,55)"; "let testSByteToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,45--53,53)"; "let testSByteToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,45--54,55)"; - "let testSByteToCharOperator(e1) = Operators.ToUInt16 (e1) @ (55,45--55,52)"; + "let testSByteToCharOperator(e1) = Operators.ToChar (e1) @ (55,45--55,52)"; "let testSByteToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,45--56,54)"; ] @@ -1261,9 +1261,9 @@ let ``Test Operator Declarations for Int16`` () = "let testInt16ToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,45--42,53)"; "let testInt16ToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,45--43,53)"; "let testInt16ToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,45--44,54)"; - "let testInt16ToIntOperator(e1) = e1 @ (45,45--45,51)"; - "let testInt16ToInt32Operator(e1) = e1 @ (46,45--46,53)"; - "let testInt16ToUInt32Operator(e1) = e1 @ (47,45--47,54)"; + "let testInt16ToIntOperator(e1) = Operators.ToInt32 (e1) @ (45,45--45,51)"; + "let testInt16ToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,45--46,53)"; + "let testInt16ToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,45--47,54)"; "let testInt16ToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,45--48,53)"; "let testInt16ToUInt64Operator(e1) = Operators.ToInt64 (e1) @ (49,45--49,54)"; "let testInt16ToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,45--50,57)"; @@ -1271,7 +1271,7 @@ let ``Test Operator Declarations for Int16`` () = "let testInt16ToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,45--52,55)"; "let testInt16ToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,45--53,53)"; "let testInt16ToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,45--54,55)"; - "let testInt16ToCharOperator(e1) = Operators.ToUInt16 (e1) @ (55,45--55,52)"; + "let testInt16ToCharOperator(e1) = Operators.ToChar (e1) @ (55,45--55,52)"; "let testInt16ToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,45--56,54)"; ] @@ -1380,7 +1380,7 @@ let ``Test Operator Declarations for UInt16`` () = "let testUInt16ToSingleOperator(e1) = Operators.ToSingle (Operators.ToDouble (e1)) @ (52,47--52,57)"; "let testUInt16ToDoubleOperator(e1) = Operators.ToDouble (Operators.ToDouble (e1)) @ (53,47--53,55)"; "let testUInt16ToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,47--54,57)"; - "let testUInt16ToCharOperator(e1) = Operators.ToUInt16 (e1) @ (55,47--55,54)"; + "let testUInt16ToCharOperator(e1) = Operators.ToChar (e1) @ (55,47--55,54)"; "let testUInt16ToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,47--56,56)"; ] @@ -1482,7 +1482,7 @@ let ``Test Operator Declarations for Int`` () = "let testIntToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,41--44,50)"; "let testIntToIntOperator(e1) = e1 @ (45,45--45,47)"; "let testIntToInt32Operator(e1) = e1 @ (46,47--46,49)"; - "let testIntToUInt32Operator(e1) = e1 @ (47,41--47,50)"; + "let testIntToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,41--47,50)"; "let testIntToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,41--48,49)"; "let testIntToUInt64Operator(e1) = Operators.ToInt64 (e1) @ (49,41--49,50)"; "let testIntToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,41--50,53)"; @@ -1490,7 +1490,7 @@ let ``Test Operator Declarations for Int`` () = "let testIntToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,41--52,51)"; "let testIntToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,41--53,49)"; "let testIntToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,41--54,51)"; - "let testIntToCharOperator(e1) = Operators.ToUInt16 (e1) @ (55,41--55,48)"; + "let testIntToCharOperator(e1) = Operators.ToChar (e1) @ (55,41--55,48)"; "let testIntToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,41--56,50)"; ] @@ -1592,7 +1592,7 @@ let ``Test Operator Declarations for Int32`` () = "let testInt32ToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,45--44,54)"; "let testInt32ToIntOperator(e1) = e1 @ (45,49--45,51)"; "let testInt32ToInt32Operator(e1) = e1 @ (46,51--46,53)"; - "let testInt32ToUInt32Operator(e1) = e1 @ (47,45--47,54)"; + "let testInt32ToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,45--47,54)"; "let testInt32ToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,45--48,53)"; "let testInt32ToUInt64Operator(e1) = Operators.ToInt64 (e1) @ (49,45--49,54)"; "let testInt32ToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,45--50,57)"; @@ -1600,7 +1600,7 @@ let ``Test Operator Declarations for Int32`` () = "let testInt32ToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,45--52,55)"; "let testInt32ToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,45--53,53)"; "let testInt32ToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,45--54,55)"; - "let testInt32ToCharOperator(e1) = Operators.ToUInt16 (e1) @ (55,45--55,52)"; + "let testInt32ToCharOperator(e1) = Operators.ToChar (e1) @ (55,45--55,52)"; "let testInt32ToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,45--56,54)"; ] @@ -1699,8 +1699,8 @@ let ``Test Operator Declarations for UInt32`` () = "let testUInt32ToSByteOperator(e1) = Operators.ToSByte (e1) @ (42,47--42,55)"; "let testUInt32ToInt16Operator(e1) = Operators.ToInt16 (e1) @ (43,47--43,55)"; "let testUInt32ToUInt16Operator(e1) = Operators.ToUInt16 (e1) @ (44,47--44,56)"; - "let testUInt32ToIntOperator(e1) = e1 @ (45,47--45,53)"; - "let testUInt32ToInt32Operator(e1) = e1 @ (46,47--46,55)"; + "let testUInt32ToIntOperator(e1) = Operators.ToInt32 (e1) @ (45,47--45,53)"; + "let testUInt32ToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,47--46,55)"; "let testUInt32ToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,47--47,56)"; "let testUInt32ToInt64Operator(e1) = Operators.ToUInt64 (e1) @ (48,47--48,55)"; "let testUInt32ToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,47--49,56)"; @@ -1709,7 +1709,7 @@ let ``Test Operator Declarations for UInt32`` () = "let testUInt32ToSingleOperator(e1) = Operators.ToSingle (Operators.ToDouble (e1)) @ (52,47--52,57)"; "let testUInt32ToDoubleOperator(e1) = Operators.ToDouble (Operators.ToDouble (e1)) @ (53,47--53,55)"; "let testUInt32ToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,47--54,57)"; - "let testUInt32ToCharOperator(e1) = Operators.ToUInt16 (e1) @ (55,47--55,54)"; + "let testUInt32ToCharOperator(e1) = Operators.ToChar (e1) @ (55,47--55,54)"; "let testUInt32ToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,47--56,56)"; ] @@ -1813,13 +1813,13 @@ let ``Test Operator Declarations for Int64`` () = "let testInt64ToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,45--46,53)"; "let testInt64ToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,45--47,54)"; "let testInt64ToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,45--48,53)"; - "let testInt64ToUInt64Operator(e1) = e1 @ (49,45--49,54)"; + "let testInt64ToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,45--49,54)"; "let testInt64ToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,45--50,57)"; "let testInt64ToUIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (51,45--51,58)"; "let testInt64ToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,45--52,55)"; "let testInt64ToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,45--53,53)"; "let testInt64ToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,45--54,55)"; - "let testInt64ToCharOperator(e1) = Operators.ToUInt16 (e1) @ (55,45--55,52)"; + "let testInt64ToCharOperator(e1) = Operators.ToChar (e1) @ (55,45--55,52)"; "let testInt64ToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,45--56,54)"; ] @@ -1921,14 +1921,14 @@ let ``Test Operator Declarations for UInt64`` () = "let testUInt64ToIntOperator(e1) = Operators.ToInt32 (e1) @ (45,47--45,53)"; "let testUInt64ToInt32Operator(e1) = Operators.ToInt32 (e1) @ (46,47--46,55)"; "let testUInt64ToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,47--47,56)"; - "let testUInt64ToInt64Operator(e1) = e1 @ (48,47--48,55)"; + "let testUInt64ToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,47--48,55)"; "let testUInt64ToUInt64Operator(e1) = e1 @ (49,54--49,56)"; "let testUInt64ToIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (50,47--50,59)"; "let testUInt64ToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,47--51,60)"; "let testUInt64ToSingleOperator(e1) = Operators.ToSingle (Operators.ToDouble (e1)) @ (52,47--52,57)"; "let testUInt64ToDoubleOperator(e1) = Operators.ToDouble (Operators.ToDouble (e1)) @ (53,47--53,55)"; "let testUInt64ToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,47--54,57)"; - "let testUInt64ToCharOperator(e1) = Operators.ToUInt16 (e1) @ (55,47--55,54)"; + "let testUInt64ToCharOperator(e1) = Operators.ToChar (e1) @ (55,47--55,54)"; "let testUInt64ToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,47--56,56)"; ] @@ -2034,11 +2034,11 @@ let ``Test Operator Declarations for IntPtr`` () = "let testIntPtrToInt64Operator(e1) = Operators.ToInt64 (e1) @ (48,50--48,58)"; "let testIntPtrToUInt64Operator(e1) = Operators.ToInt64 (e1) @ (49,50--49,59)"; "let testIntPtrToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,50--50,62)"; - "let testIntPtrToUIntPtrOperator(e1) = e1 @ (51,50--51,63)"; + "let testIntPtrToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,50--51,63)"; "let testIntPtrToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,50--52,60)"; "let testIntPtrToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,50--53,58)"; "let testIntPtrToDecimalOperator(e1) = Convert.ToDecimal (Operators.ToInt64 (e1)) @ (54,50--54,60)"; - "let testIntPtrToCharOperator(e1) = Operators.ToUInt16 (e1) @ (55,50--55,57)"; + "let testIntPtrToCharOperator(e1) = Operators.ToChar (e1) @ (55,50--55,57)"; "let testIntPtrToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,50--56,59)"; ] @@ -2142,12 +2142,12 @@ let ``Test Operator Declarations for UIntPtr`` () = "let testUIntPtrToUInt32Operator(e1) = Operators.ToUInt32 (e1) @ (47,52--47,61)"; "let testUIntPtrToInt64Operator(e1) = Operators.ToUInt64 (e1) @ (48,52--48,60)"; "let testUIntPtrToUInt64Operator(e1) = Operators.ToUInt64 (e1) @ (49,52--49,61)"; - "let testUIntPtrToIntPtrOperator(e1) = e1 @ (50,52--50,64)"; + "let testUIntPtrToIntPtrOperator(e1) = Operators.ToIntPtr (e1) @ (50,52--50,64)"; "let testUIntPtrToUIntPtrOperator(e1) = e1 @ (51,63--51,65)"; "let testUIntPtrToSingleOperator(e1) = Operators.ToSingle (Operators.ToDouble (e1)) @ (52,52--52,62)"; "let testUIntPtrToDoubleOperator(e1) = Operators.ToDouble (Operators.ToDouble (e1)) @ (53,52--53,60)"; "let testUIntPtrToDecimalOperator(e1) = Convert.ToDecimal (Operators.ToUInt64 (e1)) @ (54,52--54,62)"; - "let testUIntPtrToCharOperator(e1) = Operators.ToUInt16 (e1) @ (55,52--55,59)"; + "let testUIntPtrToCharOperator(e1) = Operators.ToChar (e1) @ (55,52--55,59)"; "let testUIntPtrToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,52--56,61)"; ] @@ -2253,7 +2253,7 @@ let ``Test Operator Declarations for Single`` () = "let testSingleToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,48--52,58)"; "let testSingleToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,48--53,56)"; "let testSingleToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,48--54,58)"; - "let testSingleToCharOperator(e1) = Operators.ToUInt16 (e1) @ (55,48--55,55)"; + "let testSingleToCharOperator(e1) = Operators.ToChar (e1) @ (55,48--55,55)"; "let testSingleToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,48--56,57)"; ] @@ -2359,7 +2359,7 @@ let ``Test Operator Declarations for Double`` () = "let testDoubleToSingleOperator(e1) = Operators.ToSingle (e1) @ (52,46--52,56)"; "let testDoubleToDoubleOperator(e1) = Operators.ToDouble (e1) @ (53,46--53,54)"; "let testDoubleToDecimalOperator(e1) = Convert.ToDecimal (e1) @ (54,46--54,56)"; - "let testDoubleToCharOperator(e1) = Operators.ToUInt16 (e1) @ (55,46--55,53)"; + "let testDoubleToCharOperator(e1) = Operators.ToChar (e1) @ (55,46--55,53)"; "let testDoubleToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,46--56,55)"; ] @@ -2528,8 +2528,8 @@ let ``Test Operator Declarations for Char`` () = "let testCharLessThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_GreaterThan (e1,e2),False) @ (7,64--7,73)"; "let testCharGreaterThanOperator(e1) (e2) = Operators.op_GreaterThan (e1,e2) @ (8,64--8,72)"; "let testCharGreaterThanOrEqualsOperator(e1) (e2) = Operators.op_Equality (Operators.op_LessThan (e1,e2),False) @ (9,64--9,73)"; - "let testCharAdditionOperator(e1) (e2) = Operators.ToUInt16 (Operators.op_Addition (e1,e2)) @ (11,56--11,64)"; - "let testCharAdditionChecked(e1) (e2) = Checked.ToUInt16 (Checked.op_Addition (e1,e2)) @ (24,53--24,70)"; + "let testCharAdditionOperator(e1) (e2) = Operators.ToChar (Operators.op_Addition (e1,e2)) @ (11,56--11,64)"; + "let testCharAdditionChecked(e1) (e2) = Operators.ToChar (Checked.op_Addition (e1,e2)) @ (24,53--24,70)"; "let testCharToByteChecked(e1) = Checked.ToByte (e1) @ (29,43--29,58)"; "let testCharToSByteChecked(e1) = Checked.ToSByte (e1) @ (30,43--30,59)"; "let testCharToInt16Checked(e1) = Checked.ToInt16 (e1) @ (31,43--31,59)"; @@ -2554,7 +2554,7 @@ let ``Test Operator Declarations for Char`` () = "let testCharToUIntPtrOperator(e1) = Operators.ToUIntPtr (e1) @ (51,43--51,56)"; "let testCharToSingleOperator(e1) = Operators.ToSingle (Operators.ToDouble (e1)) @ (52,43--52,53)"; "let testCharToDoubleOperator(e1) = Operators.ToDouble (Operators.ToDouble (e1)) @ (53,43--53,51)"; - "let testCharToCharOperator(e1) = Operators.ToUInt16 (e1) @ (55,43--55,50)"; + "let testCharToCharOperator(e1) = Operators.ToChar (e1) @ (55,43--55,50)"; "let testCharToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,43--56,52)"; ] From e15be741cd576eda9e770e288c4f97f02feeaaa5 Mon Sep 17 00:00:00 2001 From: ncave <777696+ncave@users.noreply.github.com> Date: Wed, 14 Feb 2018 08:21:11 -0800 Subject: [PATCH 21/21] fixed warnings --- src/fsharp/symbols/Exprs.fs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/fsharp/symbols/Exprs.fs b/src/fsharp/symbols/Exprs.fs index f75403a4155..d818cf956a1 100644 --- a/src/fsharp/symbols/Exprs.fs +++ b/src/fsharp/symbols/Exprs.fs @@ -273,19 +273,19 @@ module FSharpExprConvert = match ty with | TType_app (tcref,_) -> match tcref with - | x when tyconRefEq g tcref g.sbyte_tcr -> Some mkCallToSByteOperator - | x when tyconRefEq g tcref g.byte_tcr -> Some mkCallToByteOperator - | x when tyconRefEq g tcref g.int16_tcr -> Some mkCallToInt16Operator - | x when tyconRefEq g tcref g.uint16_tcr -> Some mkCallToUInt16Operator - | x when tyconRefEq g tcref g.int_tcr -> Some mkCallToIntOperator - | x when tyconRefEq g tcref g.int32_tcr -> Some mkCallToInt32Operator - | x when tyconRefEq g tcref g.uint32_tcr -> Some mkCallToUInt32Operator - | x when tyconRefEq g tcref g.int64_tcr -> Some mkCallToInt64Operator - | x when tyconRefEq g tcref g.uint64_tcr -> Some mkCallToUInt64Operator - | x when tyconRefEq g tcref g.float32_tcr -> Some mkCallToSingleOperator - | x when tyconRefEq g tcref g.float_tcr -> Some mkCallToDoubleOperator - | x when tyconRefEq g tcref g.nativeint_tcr -> Some mkCallToIntPtrOperator - | x when tyconRefEq g tcref g.unativeint_tcr -> Some mkCallToUIntPtrOperator + | _ when tyconRefEq g tcref g.sbyte_tcr -> Some mkCallToSByteOperator + | _ when tyconRefEq g tcref g.byte_tcr -> Some mkCallToByteOperator + | _ when tyconRefEq g tcref g.int16_tcr -> Some mkCallToInt16Operator + | _ when tyconRefEq g tcref g.uint16_tcr -> Some mkCallToUInt16Operator + | _ when tyconRefEq g tcref g.int_tcr -> Some mkCallToIntOperator + | _ when tyconRefEq g tcref g.int32_tcr -> Some mkCallToInt32Operator + | _ when tyconRefEq g tcref g.uint32_tcr -> Some mkCallToUInt32Operator + | _ when tyconRefEq g tcref g.int64_tcr -> Some mkCallToInt64Operator + | _ when tyconRefEq g tcref g.uint64_tcr -> Some mkCallToUInt64Operator + | _ when tyconRefEq g tcref g.float32_tcr -> Some mkCallToSingleOperator + | _ when tyconRefEq g tcref g.float_tcr -> Some mkCallToDoubleOperator + | _ when tyconRefEq g tcref g.nativeint_tcr -> Some mkCallToIntPtrOperator + | _ when tyconRefEq g tcref g.unativeint_tcr -> Some mkCallToUIntPtrOperator | _ -> None | _ -> None