diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 0dd72130c0c5cfa876593d8c7ec9452a904b8659..057b9c816dbe67972d80eaf8e0ea2b5db3fb3622 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "fantomas": { - "version": "5.0.0-alpha-006", + "version": "5.0.0-alpha-008", "commands": [ "fantomas" ] diff --git a/src/Compiler/AbstractIL/il.fs b/src/Compiler/AbstractIL/il.fs index 3afa9326f473f12587f129c598a25e4837a5f64e..30f920524c0fff18f6de41183bd94b47fcb40e3d 100644 --- a/src/Compiler/AbstractIL/il.fs +++ b/src/Compiler/AbstractIL/il.fs @@ -5143,8 +5143,8 @@ let decodeILAttribData (ca: ILAttribute) = try let parser = ILTypeSigParser n parser.ParseTypeSpec(), sigptr - with - | exn -> failwith (sprintf "decodeILAttribData: error parsing type in custom attribute blob: %s" exn.Message) + with exn -> + failwith (sprintf "decodeILAttribData: error parsing type in custom attribute blob: %s" exn.Message) | ILType.Boxed tspec when tspec.Name = "System.Object" -> let et, sigptr = sigptr_get_u8 bytes sigptr diff --git a/src/Compiler/AbstractIL/ilmorph.fs b/src/Compiler/AbstractIL/ilmorph.fs index dd60d94d0fc27cc621e75f4ed5462ec9028f13a7..08bd3a292c68b9e6ebad868168580456ad98eaaf 100644 --- a/src/Compiler/AbstractIL/ilmorph.fs +++ b/src/Compiler/AbstractIL/ilmorph.fs @@ -184,8 +184,8 @@ let cattr_ty2ty f (c: ILAttribute) = let elems = elems |> List.map (celem_ty2ty f) let namedArgs = namedArgs |> List.map (cnamedarg_ty2ty f) mkILCustomAttribMethRef (meth, elems, namedArgs) - with - | _ -> c.WithMethod(meth) + with _ -> + c.WithMethod(meth) else c.WithMethod(meth) diff --git a/src/Compiler/AbstractIL/ilnativeres.fs b/src/Compiler/AbstractIL/ilnativeres.fs index 8bbf79f9afcc4ccbb5a2bf11ae571868767c0c4d..f403a6c5985c69cfb924fd7af523cbcd25807101 100644 --- a/src/Compiler/AbstractIL/ilnativeres.fs +++ b/src/Compiler/AbstractIL/ilnativeres.fs @@ -253,8 +253,8 @@ type COFFResourceReader() = if int64 relocLastAddress > stream.Length then raise <| ResourceException "CoffResourceInvalidRelocation" - with - | :? OverflowException -> (raise <| ResourceException("CoffResourceInvalidRelocation")) + with :? OverflowException -> + (raise <| ResourceException("CoffResourceInvalidRelocation")) let mutable relocationOffsets = Array.zeroCreate (int rsrc1.NumberOfRelocations) @@ -284,8 +284,8 @@ type COFFResourceReader() = if lastSymAddress > stream.Length then raise <| ResourceException "CoffResourceInvalidSymbol" - with - | :? OverflowException -> (raise <| ResourceException("CoffResourceInvalidSymbol")) + with :? OverflowException -> + (raise <| ResourceException("CoffResourceInvalidSymbol")) let mutable outputStream = new MemoryStream(imageResourceSectionBytes) let mutable writer = new BinaryWriter(outputStream) diff --git a/src/Compiler/AbstractIL/ilread.fs b/src/Compiler/AbstractIL/ilread.fs index 022d5eeb83949f5f10e93292bafa02a91c0f21ab..f9401396e737d4afb32197a7b30830eaac373726 100644 --- a/src/Compiler/AbstractIL/ilread.fs +++ b/src/Compiler/AbstractIL/ilread.fs @@ -41,15 +41,15 @@ let _ = let noStableFileHeuristic = try (Environment.GetEnvironmentVariable("FSharp_NoStableFileHeuristic") <> null) - with - | _ -> false + with _ -> + false let alwaysMemoryMapFSC = try (Environment.GetEnvironmentVariable("FSharp_AlwaysMemoryMapCommandLineCompiler") <> null) - with - | _ -> false + with _ -> + false let stronglyHeldReaderCacheSizeDefault = 30 @@ -58,8 +58,8 @@ let stronglyHeldReaderCacheSize = (match Environment.GetEnvironmentVariable("FSharp_StronglyHeldBinaryReaderCacheSize") with | null -> stronglyHeldReaderCacheSizeDefault | s -> int32 s) - with - | _ -> stronglyHeldReaderCacheSizeDefault + with _ -> + stronglyHeldReaderCacheSizeDefault let singleOfBits (x: int32) = BitConverter.ToSingle(BitConverter.GetBytes x, 0) @@ -3804,8 +3804,7 @@ and seekReadMethodRVA (pectxt: PEReader) (ctxt: ILMetadataReader) (idx, nm, _int [] (* scopes fail for mscorlib scopes rootScope *) // REVIEW: look through sps to get ranges? Use GetRanges?? Change AbsIL?? (localPdbInfos, None, seqpoints) - with - | e -> + with e -> // "* Warning: PDB info for method "+nm+" could not be read and will be ignored: "+e.Message [], None, [] #endif @@ -4222,8 +4221,7 @@ let getPdbReader pdbDirPath fileName = | _ -> failwith ("Document with URL " + url + " not found in list of documents in the PDB file") Some(pdbr, docfun) - with - | e -> + with e -> dprintn ("* Warning: PDB file could not be read and will be ignored: " + e.Message) None #endif @@ -5111,8 +5109,8 @@ let stableFileHeuristicApplies fileName = not noStableFileHeuristic && try FileSystem.IsStableFileHeuristic fileName - with - | _ -> false + with _ -> + false let createByteFileChunk opts fileName chunk = // If we're trying to reduce memory usage then we are willing to go back and re-read the binary, so we can use @@ -5184,8 +5182,7 @@ let OpenILModuleReader fileName opts = ILModuleReaderCacheKey(fullPath, writeTime, opts.pdbDirPath.IsSome, opts.reduceMemoryUsage, opts.metadataOnly) key, true - with - | exn -> + with exn -> Debug.Assert( false, sprintf diff --git a/src/Compiler/AbstractIL/ilreflect.fs b/src/Compiler/AbstractIL/ilreflect.fs index 574075ea6b82a5e919567e1a71dd6693a9a9f460..63497ca4d4cf83f6c6e4977d2ba29c79eb5882ba 100644 --- a/src/Compiler/AbstractIL/ilreflect.fs +++ b/src/Compiler/AbstractIL/ilreflect.fs @@ -646,8 +646,8 @@ let envUpdateCreatedTypeRef emEnv (tref: ILTypeRef) = try System.Runtime.Serialization.FormatterServices.GetUninitializedObject ty |> ignore - with - | _ -> () + with _ -> + () #endif { emEnv with emTypMap = Zmap.add tref (typT, typB, typeDef, Some ty) emEnv.emTypMap @@ -1117,8 +1117,8 @@ let queryableTypeGetMethod cenv emEnv parentT (mref: ILMethodRef) : MethodInfo = (null: ParameterModifier[]) ) // This can fail if there is an ambiguity w.r.t. return type - with - | _ -> null + with _ -> + null if (isNotNull methInfo && equalTypes resT methInfo.ReturnType) then methInfo @@ -2759,8 +2759,8 @@ let EmitDynamicAssemblyFragment try ignore (typB.InvokeMemberAndLog(methodName, BindingFlags.InvokeMethod ||| BindingFlags.Public ||| BindingFlags.Static, [||])) None - with - | :? TargetInvocationException as exn -> Some exn.InnerException + with :? TargetInvocationException as exn -> + Some exn.InnerException let emEnv, entryPts = envPopEntryPts emEnv let execs = List.map execEntryPtFun entryPts diff --git a/src/Compiler/AbstractIL/ilsign.fs b/src/Compiler/AbstractIL/ilsign.fs index b4eb67b8acbd35f48429b906ba39a960578ef6e9..bcd64cb28d43666fe092d695de50234147d75812 100644 --- a/src/Compiler/AbstractIL/ilsign.fs +++ b/src/Compiler/AbstractIL/ilsign.fs @@ -704,8 +704,7 @@ type ILStrongNameSigner = let pkSignatureSize pk = try signerSignatureSize pk - with - | exn -> + with exn -> failwith ("A call to StrongNameSignatureSize failed (" + exn.Message + ")") 0x80 diff --git a/src/Compiler/AbstractIL/ilsupp.fs b/src/Compiler/AbstractIL/ilsupp.fs index 30050580dd5575ce541cf383afa540be0f4ebdca..fea9a764487078194cbcc09d6a51fb711c17f81f 100644 --- a/src/Compiler/AbstractIL/ilsupp.fs +++ b/src/Compiler/AbstractIL/ilsupp.fs @@ -1039,8 +1039,8 @@ let pdbClose (writer: PdbWriter) dllFilename pdbFilename = FileSystem.OpenFileForWriteShim(fileName, FileMode.Open, FileAccess.ReadWrite, FileShare.None) false - with - | _ -> true + with _ -> + true let mutable attempts = 0 @@ -1072,8 +1072,8 @@ let internal setCheckSum (url: string, writer: ISymUnmanagedDocumentWriter) = if (checkSum.Length = hashSizeOfMD5) then writer.SetCheckSum(guidSourceHashMD5, hashSizeOfMD5, checkSum) - with - | _ -> () + with _ -> + () let pdbDefineDocument (writer: PdbWriter) (url: string) = //3F5162F8-07C6-11D3-9053-00C04FA302A1 @@ -1204,8 +1204,8 @@ let pdbReadOpen (moduleName: string) (path: string) : PdbReader = ) { symReader = reader :?> ISymbolReader } - with - | _ -> { symReader = null } + with _ -> + { symReader = null } #else let symbolBinder = new System.Diagnostics.SymbolStore.SymBinder() diff --git a/src/Compiler/AbstractIL/ilwritepdb.fs b/src/Compiler/AbstractIL/ilwritepdb.fs index df3ff04764c28a68870b36f2b4931cb210f882a0..3988e136dd81e3d9ad5a9f7704cfbd9cbdb96342 100644 --- a/src/Compiler/AbstractIL/ilwritepdb.fs +++ b/src/Compiler/AbstractIL/ilwritepdb.fs @@ -184,8 +184,8 @@ let checkSum (url: string) (checksumAlgorithm: HashAlgorithm) = let checkSum = alg.ComputeHash file Some(guid, checkSum) - with - | _ -> None + with _ -> + None //--------------------------------------------------------------------- // Portable PDB Writer @@ -935,14 +935,14 @@ let writePdbInfo showTimes outfile pdbfile info cvChunk = try FileSystem.FileDeleteShim pdbfile - with - | _ -> () + with _ -> + () let pdbw = try pdbInitialize outfile pdbfile - with - | _ -> error (Error(FSComp.SR.ilwriteErrorCreatingPdb pdbfile, rangeCmdArgs)) + with _ -> + error (Error(FSComp.SR.ilwriteErrorCreatingPdb pdbfile, rangeCmdArgs)) match info.EntryPoint with | None -> () @@ -1119,16 +1119,16 @@ let writeMdbInfo fmdb f info = // Note, if we can't delete it code will fail later try FileSystem.FileDeleteShim fmdb - with - | _ -> () + with _ -> + () // Try loading the MDB symbol writer from an assembly available on Mono dynamically // Report an error if the assembly is not available. let wr = try createWriter f - with - | _ -> error (Error(FSComp.SR.ilwriteErrorCreatingMdb (), rangeCmdArgs)) + with _ -> + error (Error(FSComp.SR.ilwriteErrorCreatingMdb (), rangeCmdArgs)) // NOTE: MonoSymbolWriter doesn't need information about entrypoints, so 'info.EntryPoint' is unused here. // Write information about Documents. Returns '(SourceFileEntry*CompileUnitEntry)[]' diff --git a/src/Compiler/Utilities/FileSystem.fs b/src/Compiler/Utilities/FileSystem.fs index 5296f567cdea3088a7a9c6b65fe9bb6273e5d66f..bdd64e87b697ef3d6065fb66950003c6dc170297 100644 --- a/src/Compiler/Utilities/FileSystem.fs +++ b/src/Compiler/Utilities/FileSystem.fs @@ -381,12 +381,11 @@ module MemoryMappedFileExtensions = use stream = mmf.CreateViewStream(0L, length, MemoryMappedFileAccess.ReadWrite) copyTo stream Some mmf - with - | _ -> + with _ -> mmf.Dispose() None - with - | _ -> None + with _ -> + None type MemoryMappedFile with @@ -615,8 +614,8 @@ type DefaultFileSystem() as this = ifs.GetFullPathShim path else path - with - | _ -> path + with _ -> + path abstract IsInvalidPathShim: path: string -> bool diff --git a/src/Compiler/Utilities/illib.fs b/src/Compiler/Utilities/illib.fs index f9cfe5ce0e80ed21b585c91c09263315fb4ab930..85e8b8d9d98596ea3234627639bf01d2ccaa3425 100644 --- a/src/Compiler/Utilities/illib.fs +++ b/src/Compiler/Utilities/illib.fs @@ -71,8 +71,7 @@ module internal PervasiveAutoOpens = // "How can I detect if am running in Mono?" section try Type.GetType "Mono.Runtime" <> null - with - | _ -> + with _ -> // Must be robust in the case that someone else has installed a handler into System.AppDomain.OnTypeResolveEvent // that is not reliable. // This is related to bug 5506--the issue is actually a bug in VSTypeResolutionService.EnsurePopulated which is @@ -373,8 +372,8 @@ module Option = let attempt (f: unit -> 'T) = try Some(f ()) - with - | _ -> None + with _ -> + None module List = @@ -991,8 +990,8 @@ module Cancellable = match f ct with | ValueOrCancelled.Value res -> ValueOrCancelled.Value(Choice1Of2 res) | ValueOrCancelled.Cancelled exn -> ValueOrCancelled.Cancelled exn - with - | err -> ValueOrCancelled.Value(Choice2Of2 err)) + with err -> + ValueOrCancelled.Value(Choice2Of2 err)) /// Implement try/finally for a cancellable computation let inline tryFinally comp compensation = @@ -1162,8 +1161,7 @@ type LazyWithContext<'T, 'Ctxt> = x.value <- res x.funcOrException <- null res - with - | exn -> + with exn -> x.funcOrException <- box (LazyWithContextFailure(exn)) reraise () | _ -> failwith "unreachable" @@ -1281,8 +1279,8 @@ module NameMap = (fun n x2 acc -> try f n (Map.find n m1) x2 acc - with - | :? KeyNotFoundException -> errf n x2) + with :? KeyNotFoundException -> + errf n x2) m2 acc diff --git a/src/Compiler/Utilities/illib.fsi b/src/Compiler/Utilities/illib.fsi index 6f7a0591bdc67d259c1729de970e2725e8f987bb..4d7ca7a57d6227b478ded1dde39ceefc052f8d9d 100644 --- a/src/Compiler/Utilities/illib.fsi +++ b/src/Compiler/Utilities/illib.fsi @@ -531,18 +531,21 @@ module internal NameMap = val layer: m1: NameMap<'T> -> m2: Map -> Map /// Not a very useful function - only called in one place - should be changed - val layerAdditive: addf: ('a list -> 'b -> 'a list) -> m1: Map<'c, 'b> -> m2: Map<'c, 'a list> -> Map<'c, 'a list> - when 'c: comparison + val layerAdditive: + addf: ('a list -> 'b -> 'a list) -> m1: Map<'c, 'b> -> m2: Map<'c, 'a list> -> Map<'c, 'a list> + when 'c: comparison /// Union entries by identical key, using the provided function to union sets of values val union: unionf: (seq<'a> -> 'b) -> ms: seq> -> Map /// For every entry in m2 find an entry in m1 and fold - val subfold2: errf: ('a -> 'b -> 'c) -> f: ('a -> 'd -> 'b -> 'c -> 'c) -> m1: Map<'a, 'd> -> m2: Map<'a, 'b> -> acc: 'c -> 'c - when 'a: comparison + val subfold2: + errf: ('a -> 'b -> 'c) -> f: ('a -> 'd -> 'b -> 'c -> 'c) -> m1: Map<'a, 'd> -> m2: Map<'a, 'b> -> acc: 'c -> 'c + when 'a: comparison - val suball2: errf: ('a -> 'b -> bool) -> p: ('c -> 'b -> bool) -> m1: Map<'a, 'c> -> m2: Map<'a, 'b> -> bool - when 'a: comparison + val suball2: + errf: ('a -> 'b -> bool) -> p: ('c -> 'b -> bool) -> m1: Map<'a, 'c> -> m2: Map<'a, 'b> -> bool + when 'a: comparison val mapFold: f: ('a -> string -> 'T -> 'b * 'a) -> s: 'a -> l: NameMap<'T> -> Map * 'a diff --git a/src/Compiler/Utilities/range.fs b/src/Compiler/Utilities/range.fs index b8c98f92ada8244438a70fec61b4e1dd7a3770cd..035a5de80f42eb6ac45cc54983189d17b648f3e5 100755 --- a/src/Compiler/Utilities/range.fs +++ b/src/Compiler/Utilities/range.fs @@ -363,8 +363,8 @@ type Range(code1: int64, code2: int64) = |> Seq.take (m.EndLine - m.StartLine + 1) |> String.concat "\n" |> fun s -> s.Substring(startCol + 1, s.LastIndexOf("\n", StringComparison.Ordinal) + 1 - startCol + endCol) - with - | e -> e.ToString() + with e -> + e.ToString() member m.ToShortString() = sprintf "(%d,%d--%d,%d)" m.StartLine m.StartColumn m.EndLine m.EndColumn @@ -542,5 +542,5 @@ module Range = match nonEmptyLine with | Some (i, s) -> mkRange file (mkPos (i + 1) 0) (mkPos (i + 1) s.Length) | None -> mkRange file (mkPos 1 0) (mkPos 1 80) - with - | _ -> mkRange file (mkPos 1 0) (mkPos 1 80) + with _ -> + mkRange file (mkPos 1 0) (mkPos 1 80) diff --git a/src/Compiler/Utilities/sformat.fs b/src/Compiler/Utilities/sformat.fs index d0e0d6fe5ef754edbdee4c12ff9e73ec60fbf843..1c9a3dd5c51439ccf28a3ab5bed325e14a511969 100644 --- a/src/Compiler/Utilities/sformat.fs +++ b/src/Compiler/Utilities/sformat.fs @@ -589,14 +589,14 @@ module Display = ty.GetMethod("ToString", BindingFlags.Public ||| BindingFlags.Instance, null, [||], null) methInfo.DeclaringType = typeof - with - | _e -> false + with _e -> + false let catchExn f = try Choice1Of2(f ()) - with - | e -> Choice2Of2 e + with e -> + Choice2Of2 e // An implementation of break stack. // Uses mutable state, relying on linear threading of the state. @@ -1039,8 +1039,7 @@ module Display = path.Remove(x) |> ignore res - with - | e -> + with e -> countNodes 1 wordL (tagText ("Error: " + e.Message)) @@ -1157,8 +1156,8 @@ module Display = ) ) ) - with - | _ -> None + with _ -> + None // Seed with an empty layout with a space to the left for formatting purposes buildObjMessageL txt [ leftL (tagText "") ] @@ -1463,12 +1462,11 @@ module Display = tagProperty m.Name), (try Some(nestedObjL nDepth Precedence.BracketIfTuple ((getProperty ty obj m.Name), ty)) - with - | _ -> + with _ -> try Some(nestedObjL nDepth Precedence.BracketIfTuple ((getField obj (m :?> FieldInfo)), ty)) - with - | _ -> None))) + with _ -> + None))) |> Array.toList |> makePropertiesL) @@ -1594,8 +1592,7 @@ module Display = match text with | null -> "" | _ -> text - with - | e -> + with e -> // If a .ToString() call throws an exception, catch it and use the message as the result. // This may be informative, e.g. division by zero etc... "" diff --git a/src/FSharp.Build/CreateFSharpManifestResourceName.fs b/src/FSharp.Build/CreateFSharpManifestResourceName.fs index 175a76d203007e511451de199717b34c43728b5b..9c86fb7fb7df858dfc0dc263852a27be81b81b0d 100644 --- a/src/FSharp.Build/CreateFSharpManifestResourceName.fs +++ b/src/FSharp.Build/CreateFSharpManifestResourceName.fs @@ -35,8 +35,8 @@ type CreateFSharpManifestResourceName public () = let runningOnMono = try System.Type.GetType("Mono.Runtime") <> null - with - | e -> false + with e -> + false let fileName = if diff --git a/src/FSharp.Build/FSharpEmbedResXSource.fs b/src/FSharp.Build/FSharpEmbedResXSource.fs index 4318ff75e466fe203cd76da250fdcd3c0ee75f7f..59a3930059d1c2e07a4d5ab54edc5d6ae92ef4f7 100644 --- a/src/FSharp.Build/FSharpEmbedResXSource.fs +++ b/src/FSharp.Build/FSharpEmbedResXSource.fs @@ -118,8 +118,7 @@ module internal {1} = File.WriteAllText(sourcePath, body.ToString()) printMessage <| sprintf "Done: %s" sourcePath Some(sourcePath) - with - | e -> + with e -> printf "An exception occurred when processing '%s'\n%s" resx (e.ToString()) None diff --git a/src/FSharp.Build/FSharpEmbedResourceText.fs b/src/FSharp.Build/FSharpEmbedResourceText.fs index ede5581c02e9634de09e3cc381d3f22ee0a81ac9..77002aa4f545d64f7a9e50ac42953a1811e26988 100644 --- a/src/FSharp.Build/FSharpEmbedResourceText.fs +++ b/src/FSharp.Build/FSharpEmbedResourceText.fs @@ -236,8 +236,7 @@ type FSharpEmbedResourceText() = let str = try System.String.Format(Unquote(txt.Substring i)) // Format turns e.g '\n' into that char, but also requires that we 'escape' curlies in the original .txt file, e.g. "{{" - with - | e -> + with e -> Err( fileName, lineNum, @@ -551,8 +550,7 @@ open Printf xd.Save outXmlStream printMessage (sprintf "Done %s" outFileName) Some(fileName, outFileName, outXmlFileName) - with - | e -> + with e -> PrintErr(fileName, 0, sprintf "An exception occurred when processing '%s'\n%s" fileName (e.ToString())) None diff --git a/src/FSharp.Build/Fsc.fs b/src/FSharp.Build/Fsc.fs index 436f481d7c5c300da5eae41bda5c0ae08cbcaef4..d7e0d8c52e4e893ea8d360c98fc690b2e9539fb5 100644 --- a/src/FSharp.Build/Fsc.fs +++ b/src/FSharp.Build/Fsc.fs @@ -68,8 +68,8 @@ type public Fsc() as this = let locationOfThisDll = try Some(Path.GetDirectoryName(typeof.Assembly.Location)) - with - | _ -> None + with _ -> + None match FSharpEnvironment.BinFolderOfDefaultFSharpCompiler(locationOfThisDll) with | Some s -> s @@ -677,8 +677,7 @@ type public Fsc() as this = try invokeCompiler baseCallDelegate - with - | e -> + with e -> Debug.Fail( "HostObject received by Fsc task did not have a Compile method or the compile method threw an exception. " + (e.ToString()) diff --git a/src/FSharp.Build/Fsi.fs b/src/FSharp.Build/Fsi.fs index 634f92023bd36a04a90206b2d99850d2a4dcfe32..76dec9c78e4db5e06eb5ecc029314fdb2137e6ca 100644 --- a/src/FSharp.Build/Fsi.fs +++ b/src/FSharp.Build/Fsi.fs @@ -51,8 +51,8 @@ type public Fsi() as this = let locationOfThisDll = try Some(Path.GetDirectoryName(typeof.Assembly.Location)) - with - | _ -> None + with _ -> + None match FSharpEnvironment.BinFolderOfDefaultFSharpCompiler(locationOfThisDll) with | Some s -> s @@ -361,8 +361,7 @@ type public Fsi() as this = try invokeCompiler baseCallDelegate - with - | e -> + with e -> Debug.Assert( false, "HostObject received by Fsi task did not have a Compile method or the compile method threw an exception. " diff --git a/src/FSharp.Build/SubstituteText.fs b/src/FSharp.Build/SubstituteText.fs index c4be2300c0f521adde2399431d4404419b478b5b..0f036da0a86c1d0091023522a5f219dbdcf690cb 100644 --- a/src/FSharp.Build/SubstituteText.fs +++ b/src/FSharp.Build/SubstituteText.fs @@ -87,8 +87,8 @@ type SubstituteText() = Directory.CreateDirectory(directory) |> ignore File.WriteAllText(targetPath, contents) - with - | _ -> () + with _ -> + () copiedFiles.Add(item) diff --git a/src/FSharp.Build/WriteCodeFragment.fs b/src/FSharp.Build/WriteCodeFragment.fs index 7cc80eeafc44f135247fdcd311d0ae4666f48095..ab390ae4a59394961f8e78dab584f8be381a81e6 100644 --- a/src/FSharp.Build/WriteCodeFragment.fs +++ b/src/FSharp.Build/WriteCodeFragment.fs @@ -166,7 +166,6 @@ type WriteCodeFragment() = _outputFile <- outputFileItem true - with - | e -> + with e -> printf "Error writing code fragment: %s" (e.ToString()) false diff --git a/src/FSharp.Compiler.Interactive.Settings/fsiaux.fs b/src/FSharp.Compiler.Interactive.Settings/fsiaux.fs index bf70d1535b3fbfa7bc6184ecb3a0bd08194baa1d..89362feb114d5696b9c3411b0a1eefc2d7478719 100644 --- a/src/FSharp.Compiler.Interactive.Settings/fsiaux.fs +++ b/src/FSharp.Compiler.Interactive.Settings/fsiaux.fs @@ -52,8 +52,8 @@ type internal SimpleEventLoop() = result <- try Some(f ()) - with - | _ -> None) + with _ -> + None) setSignal doneSignal run () diff --git a/src/FSharp.Core/event.fsi b/src/FSharp.Core/event.fsi index 536b414ba54369ad2acc232a7ca1627e750ba8cc..12557f0dc229083a4160496c504aa86bb73d793d 100644 --- a/src/FSharp.Core/event.fsi +++ b/src/FSharp.Core/event.fsi @@ -34,7 +34,8 @@ type DelegateEvent<'Delegate when 'Delegate :> System.Delegate> = /// /// Events and Observables [] -type Event<'Delegate, 'Args when 'Delegate: delegate<'Args, unit> and 'Delegate :> System.Delegate and 'Delegate: not struct> = +type Event<'Delegate, 'Args + when 'Delegate: delegate<'Args, unit> and 'Delegate :> System.Delegate and 'Delegate: not struct> = /// Creates an event object suitable for delegate types following the standard .NET Framework convention of a first 'sender' argument. /// The created event. diff --git a/src/FSharp.Core/local.fsi b/src/FSharp.Core/local.fsi index ddf14b9c2bc86bf90973f627355a51622d803db2..e4d26e76e2bd25288688b65c5a74d309c6c5e624 100644 --- a/src/FSharp.Core/local.fsi +++ b/src/FSharp.Core/local.fsi @@ -43,8 +43,9 @@ module internal List = val distinctWithComparer: System.Collections.Generic.IEqualityComparer<'T> -> 'T list -> 'T list - val distinctByWithComparer: System.Collections.Generic.IEqualityComparer<'Key> -> ('T -> 'Key) -> list: 'T list -> 'T list - when 'Key: equality + val distinctByWithComparer: + System.Collections.Generic.IEqualityComparer<'Key> -> ('T -> 'Key) -> list: 'T list -> 'T list + when 'Key: equality val init: int -> (int -> 'T) -> 'T list val filter: predicate: ('T -> bool) -> 'T list -> 'T list diff --git a/src/FSharp.Core/map.fsi b/src/FSharp.Core/map.fsi index d500c9a0ebe0c1f83f3cf368f7f52a5c26f5de46..eae4943b5b8af94e63c8437075a5b540c3d8251e 100644 --- a/src/FSharp.Core/map.fsi +++ b/src/FSharp.Core/map.fsi @@ -484,8 +484,9 @@ module Map = /// Evaluates to "1 a 2 b initial" /// [] - val foldBack<'Key, 'T, 'State> : folder: ('Key -> 'T -> 'State -> 'State) -> table: Map<'Key, 'T> -> state: 'State -> 'State - when 'Key: comparison + val foldBack<'Key, 'T, 'State> : + folder: ('Key -> 'T -> 'State -> 'State) -> table: Map<'Key, 'T> -> state: 'State -> 'State + when 'Key: comparison /// Folds over the bindings in the map /// @@ -504,8 +505,9 @@ module Map = /// Evaluates to "initial 1 a 2 b". /// [] - val fold<'Key, 'T, 'State> : folder: ('State -> 'Key -> 'T -> 'State) -> state: 'State -> table: Map<'Key, 'T> -> 'State - when 'Key: comparison + val fold<'Key, 'T, 'State> : + folder: ('State -> 'Key -> 'T -> 'State) -> state: 'State -> table: Map<'Key, 'T> -> 'State + when 'Key: comparison /// Applies the given function to each binding in the dictionary /// diff --git a/src/FSharp.Core/seqcore.fsi b/src/FSharp.Core/seqcore.fsi index 162458d8c9020cef870b3655671d46ba1d369f2c..03496378232ecf454dd58dfb495e09b2095b5b28 100644 --- a/src/FSharp.Core/seqcore.fsi +++ b/src/FSharp.Core/seqcore.fsi @@ -100,8 +100,8 @@ module RuntimeHelpers = /// The input sequence. /// /// The result sequence. - val EnumerateUsing: resource: 'T -> source: ('T -> 'Collection) -> seq<'U> - when 'T :> IDisposable and 'Collection :> seq<'U> + val EnumerateUsing: + resource: 'T -> source: ('T -> 'Collection) -> seq<'U> when 'T :> IDisposable and 'Collection :> seq<'U> /// Creates an anonymous event with the given handlers. /// diff --git a/src/FSharp.Core/set.fsi b/src/FSharp.Core/set.fsi index a564360689f6040f90e184426cf0ac61034f03a4..45056191d243559d0f18c9da19742c4eb24dd013 100644 --- a/src/FSharp.Core/set.fsi +++ b/src/FSharp.Core/set.fsi @@ -471,8 +471,8 @@ module Set = /// The reverse of the set is [3; 2; 1] /// [] - val fold<'T, 'State> : folder: ('State -> 'T -> 'State) -> state: 'State -> set: Set<'T> -> 'State - when 'T: comparison + val fold<'T, 'State> : + folder: ('State -> 'T -> 'State) -> state: 'State -> set: Set<'T> -> 'State when 'T: comparison /// Applies the given accumulating function to all the elements of the set. /// @@ -492,8 +492,8 @@ module Set = /// The set is [1; 2; 3] /// [] - val foldBack<'T, 'State> : folder: ('T -> 'State -> 'State) -> set: Set<'T> -> state: 'State -> 'State - when 'T: comparison + val foldBack<'T, 'State> : + folder: ('T -> 'State -> 'State) -> set: Set<'T> -> state: 'State -> 'State when 'T: comparison /// Tests if all elements of the collection satisfy the given predicate. /// If the input function is f and the elements are i0...iN and "j0...jN" diff --git a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.ProjectFile.fs b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.ProjectFile.fs index e0d6660b99b7d2d77c141ef0ccae3b1bc3243cf9..24ad0c02f386bb5c248d7f87f319fa4b5a1899d9 100644 --- a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.ProjectFile.fs +++ b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.ProjectFile.fs @@ -88,8 +88,8 @@ module internal ProjectFile = .ReadAllText(resolutionsFile) .Split([| '\r'; '\n' |], StringSplitOptions.None) |> Array.filter (fun line -> not (String.IsNullOrEmpty(line))) - with - | _ -> [||] + with _ -> + [||] [| for line in lines do diff --git a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs index 794aa5918744564052c6dbcd96d3be1ec6aaba49..e5f8cd95704e137d8c1ad424cd8819b2fcd9d7ad 100644 --- a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs +++ b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs @@ -267,8 +267,8 @@ type FSharpDependencyManager(outputDirectory: string option) = Directory.CreateDirectory(directory) |> ignore directory - with - | _ -> directory + with _ -> + directory let deleteScripts () = try @@ -279,16 +279,16 @@ type FSharpDependencyManager(outputDirectory: string option) = #else () #endif - with - | _ -> () + with _ -> + () let emitFile fileName (body: string) = try // Create a file to write to use sw = File.CreateText(fileName) sw.WriteLine(body) - with - | _ -> () + with _ -> + () let prepareDependencyResolutionFiles ( diff --git a/src/fsc/fscmain.fs b/src/fsc/fscmain.fs index 334f22c36e96b143f537e28526e025077754fdc5..e29f07e8b2069ed8bdc1656dd7ea655b80bd3fad 100644 --- a/src/fsc/fscmain.fs +++ b/src/fsc/fscmain.fs @@ -81,8 +81,8 @@ let main (argv) = member _.Exit(n) = try exit n - with - | _ -> () + with _ -> + () failwithf "%s" (FSComp.SR.elSysEnvExitDidntExit ()) } @@ -116,8 +116,7 @@ let main (argv) = 0 - with - | e -> + with e -> // Last-chance error recovery (note, with a poor error range) errorRecovery e Range.range0 1 diff --git a/src/fsi/console.fs b/src/fsi/console.fs index cd84b705b4af9bf7a4c28dbe2663954be8a71873..aede59c38891c4abf8228a1563db04df065ee585 100644 --- a/src/fsi/console.fs +++ b/src/fsi/console.fs @@ -76,8 +76,7 @@ module internal Utils = let guard (f) = try f () - with - | e -> + with e -> warning ( Failure( sprintf @@ -197,8 +196,8 @@ type internal ReadLineConsole() = |> Seq.iter (fun option -> optionsCache.Add(option)) optionsCache.Root <- root - with - | _ -> optionsCache.Clear() + with _ -> + optionsCache.Clear() optionsCache, true else diff --git a/src/fsi/fsimain.fs b/src/fsi/fsimain.fs index 9df8f0cead4d66f2e280ab018f25f72d0cd79991..6bd2000f9a3a000368482917b7b47b488a0f739f 100644 --- a/src/fsi/fsimain.fs +++ b/src/fsi/fsimain.fs @@ -139,8 +139,7 @@ let internal TrySetUnhandledExceptionMode () = try Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException) - with - | _ -> + with _ -> decr i () @@ -155,8 +154,7 @@ let StartServer (fsiSession: FsiEvaluationSession) (fsiServerName) = //printf "FSI-SERVER: received CTRL-C request...\n" try fsiSession.Interrupt() - with - | _ -> + with _ -> // Final sanity check! - catch all exns - but not expected assert false () @@ -200,8 +198,7 @@ let evaluateSession (argv: string[]) = let _ = Console.ForegroundColor let _ = Console.CursorLeft <- Console.CursorLeft true - with - | _ -> + with _ -> //if progress then fprintfn outWriter "probe failed, we have no console..." false else @@ -248,8 +245,7 @@ let evaluateSession (argv: string[]) = lazy try Some(WinFormsEventLoop()) - with - | e -> + with e -> printfn "Your system doesn't seem to support WinForms correctly. You will" printfn "need to set fsi.EventLoop use GUI windows from F# Interactive." printfn "You can set different event loops for MonoMac, Gtk#, WinForms and other" @@ -341,8 +337,8 @@ let evaluateSession (argv: string[]) = if fsiSession.IsGui then try Application.EnableVisualStyles() - with - | _ -> () + with _ -> + () // Route GUI application exceptions to the exception handlers Application.add_ThreadException ( @@ -352,14 +348,14 @@ let evaluateSession (argv: string[]) = let runningOnMono = try System.Type.GetType("Mono.Runtime") <> null - with - | e -> false + with e -> + false if not runningOnMono then try TrySetUnhandledExceptionMode() - with - | _ -> () + with _ -> + () fsiWinFormsLoop.Value |> Option.iter (fun l -> l.LCID <- fsiSession.LCID) #endif @@ -400,8 +396,8 @@ let MainMain argv = member _.Dispose() = try Console.SetOut(savedOut) - with - | _ -> () + with _ -> + () } #if !FX_NO_APP_DOMAINS