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