diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 0fdcde7e13a..6f319030449 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "fantomas": { - "version": "5.0.0-beta-005", + "version": "5.0.3", "commands": [ "fantomas" ] diff --git a/.fantomasignore b/.fantomasignore index a3094f05991..fabfd3547e1 100644 --- a/.fantomasignore +++ b/.fantomasignore @@ -12,14 +12,79 @@ artifacts/ # Explicitly unformatted implementation files -src/Compiler/Checking/**/*.fs -src/Compiler/DependencyManager/**/*.fs -src/Compiler/Facilities/**/*.fs -src/Compiler/Interactive/**/*.fs -src/Compiler/Legacy/**/*.fs -src/Compiler/Optimize/**/*.fs -src/Compiler/Symbols/**/*.fs -src/Compiler/TypedTree/**/*.fs +src/Compiler/Checking/AccessibilityLogic.fs +src/Compiler/Checking/AttributeChecking.fs +src/Compiler/Checking/AugmentWithHashCompare.fs +src/Compiler/Checking/CheckBasics.fs +src/Compiler/Checking/CheckComputationExpressions.fs +src/Compiler/Checking/CheckDeclarations.fs +src/Compiler/Checking/CheckExpressions.fs +src/Compiler/Checking/CheckFormatStrings.fs +src/Compiler/Checking/CheckIncrementalClasses.fs +src/Compiler/Checking/CheckPatterns.fs +src/Compiler/Checking/ConstraintSolver.fs +src/Compiler/Checking/FindUnsolved.fs +src/Compiler/Checking/import.fs +src/Compiler/Checking/InfoReader.fs +src/Compiler/Checking/infos.fs +src/Compiler/Checking/MethodCalls.fs +src/Compiler/Checking/MethodOverrides.fs +src/Compiler/Checking/NameResolution.fs +src/Compiler/Checking/NicePrint.fs +src/Compiler/Checking/PatternMatchCompilation.fs +src/Compiler/Checking/PostInferenceChecks.fs +src/Compiler/Checking/QuotationTranslator.fs +src/Compiler/Checking/SignatureConformance.fs +src/Compiler/Checking/TypeHierarchy.fs +src/Compiler/Checking/TypeRelations.fs + +src/Compiler/DependencyManager/AssemblyResolveHandler.fs +src/Compiler/DependencyManager/DependencyProvider.fs +src/Compiler/DependencyManager/NativeDllResolveHandler.fs + +src/Compiler/Facilities/BuildGraph.fs +src/Compiler/Facilities/CompilerLocation.fs +src/Compiler/Facilities/DiagnosticOptions.fs +src/Compiler/Facilities/DiagnosticResolutionHints.fs +src/Compiler/Facilities/DiagnosticsLogger.fs +src/Compiler/Facilities/LanguageFeatures.fs +src/Compiler/Facilities/Logger.fs +src/Compiler/Facilities/prim-lexing.fs +src/Compiler/Facilities/prim-parsing.fs +src/Compiler/Facilities/ReferenceResolver.fs +src/Compiler/Facilities/SimulatedMSBuildReferenceResolver.fs +src/Compiler/Facilities/TextLayoutRender.fs + +src/Compiler/Interactive/ControlledExecution.fs +src/Compiler/Interactive/fsi.fs + +src/Compiler/Legacy/LegacyHostedCompilerForTesting.fs +src/Compiler/Legacy/LegacyMSBuildReferenceResolver.fs + +src/Compiler/Optimize/DetupleArgs.fs +src/Compiler/Optimize/InnerLambdasToTopLevelFuncs.fs +src/Compiler/Optimize/LowerCalls.fs +src/Compiler/Optimize/LowerComputedCollections.fs +src/Compiler/Optimize/LowerLocalMutables.fs +src/Compiler/Optimize/LowerSequences.fs +src/Compiler/Optimize/LowerStateMachines.fs +src/Compiler/Optimize/Optimizer.fs + +src/Compiler/Symbols/Exprs.fs +src/Compiler/Symbols/FSharpDiagnostic.fs +src/Compiler/Symbols/SymbolHelpers.fs +src/Compiler/Symbols/SymbolPatterns.fs +src/Compiler/Symbols/Symbols.fs + +src/Compiler/TypedTree/CompilerGlobalState.fs +src/Compiler/TypedTree/QuotationPickler.fs +src/Compiler/TypedTree/tainted.fs +src/Compiler/TypedTree/TcGlobals.fs +src/Compiler/TypedTree/TypedTree.fs +src/Compiler/TypedTree/TypedTreeBasics.fs +src/Compiler/TypedTree/TypedTreeOps.fs +src/Compiler/TypedTree/TypedTreePickle.fs +src/Compiler/TypedTree/TypeProviders.fs # Explicitly unformatted file that needs more care to get it to format well diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index 829b7e03d20..1c3d18ffcd1 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -2840,9 +2840,7 @@ let ComputeDebugPointForBinding g bind = | DebugPointAtBinding.NoneAtDo, _ -> false, None | DebugPointAtBinding.NoneAtLet, _ -> false, None // Don't emit debug points for lambdas. - | _, - (Expr.Lambda _ - | Expr.TyLambda _) -> false, None + | _, (Expr.Lambda _ | Expr.TyLambda _) -> false, None | DebugPointAtBinding.Yes m, _ -> false, Some m //------------------------------------------------------------------------- @@ -5134,21 +5132,10 @@ and GenAsmCode cenv cgbuf eenv (il, tyargs, args, returnTys, m) sequel = // For these we can just generate the argument and change the test (from a brfalse to a brtrue and vice versa) | ([ AI_ceq ], [ arg1 - Expr.Const ((Const.Bool false - | Const.SByte 0y - | Const.Int16 0s - | Const.Int32 0 - | Const.Int64 0L - | Const.Byte 0uy - | Const.UInt16 0us - | Const.UInt32 0u - | Const.UInt64 0UL), + Expr.Const ((Const.Bool false | Const.SByte 0y | Const.Int16 0s | Const.Int32 0 | Const.Int64 0L | Const.Byte 0uy | Const.UInt16 0us | Const.UInt32 0u | Const.UInt64 0UL), _, _) ], - CmpThenBrOrContinue (1, - [ I_brcmp ((BI_brfalse - | BI_brtrue) as bi, - label1) ]), + CmpThenBrOrContinue (1, [ I_brcmp ((BI_brfalse | BI_brtrue) as bi, label1) ]), _) -> let bi = @@ -7903,9 +7890,7 @@ and GenDecisionTreeTest // If so, emit the failure logic, then came back and do the success target, then // do any postponed failure target. match successTree, failureTree with - | TDSuccess _, - (TDBind _ - | TDSwitch _) -> + | TDSuccess _, (TDBind _ | TDSwitch _) -> // OK, there is more logic in the decision tree on the failure branch let success = CG.GenerateDelayMark cgbuf "testSuccess" @@ -10641,10 +10626,9 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) = | None -> None | Some memberInfo -> match name, memberInfo.MemberFlags.MemberKind with - | ("Item" - | "op_IndexedLookup"), - (SynMemberKind.PropertyGet - | SynMemberKind.PropertySet) when not (isNil (ArgInfosOfPropertyVal g vref.Deref)) -> + | ("Item" | "op_IndexedLookup"), (SynMemberKind.PropertyGet | SynMemberKind.PropertySet) when + not (isNil (ArgInfosOfPropertyVal g vref.Deref)) + -> Some( mkILCustomAttribute ( g.FindSysILTypeRef "System.Reflection.DefaultMemberAttribute", diff --git a/src/Compiler/Driver/ParseAndCheckInputs.fs b/src/Compiler/Driver/ParseAndCheckInputs.fs index db3f30d41b5..3f4ac2f89ee 100644 --- a/src/Compiler/Driver/ParseAndCheckInputs.fs +++ b/src/Compiler/Driver/ParseAndCheckInputs.fs @@ -844,10 +844,7 @@ let ProcessMetaCommandsFromInput | ParsedHashDirective ("nowarn", ParsedHashDirectiveArguments numbers, m) -> List.fold (fun state d -> nowarnF state (m, d)) state numbers - | ParsedHashDirective (("reference" - | "r"), - ParsedHashDirectiveArguments args, - m) -> + | ParsedHashDirective (("reference" | "r"), ParsedHashDirectiveArguments args, m) -> matchedm <- m ProcessDependencyManagerDirective Directive.Resolution args m state diff --git a/src/Compiler/Service/FSharpCheckerResults.fs b/src/Compiler/Service/FSharpCheckerResults.fs index 70647f70d59..0abff6d4d04 100644 --- a/src/Compiler/Service/FSharpCheckerResults.fs +++ b/src/Compiler/Service/FSharpCheckerResults.fs @@ -247,9 +247,7 @@ type FSharpSymbolUse(denv: DisplayEnv, symbol: FSharpSymbol, inst: TyparInstanti // 'seq' in 'seq { ... }' gets colored as keywords | Item.Value vref, ItemOccurence.Use when valRefEq denv.g denv.g.seq_vref vref -> true // custom builders, custom operations get colored as keywords - | (Item.CustomBuilder _ - | Item.CustomOperation _), - ItemOccurence.Use -> true + | (Item.CustomBuilder _ | Item.CustomOperation _), ItemOccurence.Use -> true | _ -> false member _.IsFromOpenStatement = itemOcc = ItemOccurence.Open @@ -2306,14 +2304,8 @@ module internal ParseAndCheckFile = matchBraces stackAfterMatch - | LPAREN - | LBRACE _ - | LBRACK - | LBRACE_BAR - | LBRACK_BAR - | LQUOTE _ - | LBRACK_LESS as tok, - _ -> matchBraces ((tok, lexbuf.LexemeRange) :: stack) + | LPAREN | LBRACE _ | LBRACK | LBRACE_BAR | LBRACK_BAR | LQUOTE _ | LBRACK_LESS as tok, _ -> + matchBraces ((tok, lexbuf.LexemeRange) :: stack) // INTERP_STRING_BEGIN_PART corresponds to $"... {" at the start of an interpolated string // @@ -2322,9 +2314,7 @@ module internal ParseAndCheckFile = // interpolation expression) // // Either way we start a new potential match at the last character - | INTERP_STRING_BEGIN_PART _ - | INTERP_STRING_PART _ as tok, - _ -> + | INTERP_STRING_BEGIN_PART _ | INTERP_STRING_PART _ as tok, _ -> let m = lexbuf.LexemeRange let m2 = @@ -2332,9 +2322,7 @@ module internal ParseAndCheckFile = matchBraces ((tok, m2) :: stack) - | (EOF _ - | LEX_FAILURE _), - _ -> () + | (EOF _ | LEX_FAILURE _), _ -> () | _ -> matchBraces stack matchBraces []) diff --git a/src/Compiler/Service/SemanticClassification.fs b/src/Compiler/Service/SemanticClassification.fs index 5da02e32094..8fe50e9c241 100644 --- a/src/Compiler/Service/SemanticClassification.fs +++ b/src/Compiler/Service/SemanticClassification.fs @@ -212,10 +212,8 @@ module TcResolutionsExtensions = resolutions |> Array.iter (fun cnr -> match cnr.Item, cnr.ItemOccurence, cnr.Range with - | (Item.CustomBuilder _ - | Item.CustomOperation _), - ItemOccurence.Use, - m -> add m SemanticClassificationType.ComputationExpression + | (Item.CustomBuilder _ | Item.CustomOperation _), ItemOccurence.Use, m -> + add m SemanticClassificationType.ComputationExpression | Item.Value vref, _, m when isValRefMutable g vref -> add m SemanticClassificationType.MutableVar diff --git a/src/Compiler/Service/ServiceLexing.fs b/src/Compiler/Service/ServiceLexing.fs index 80cfb38cc6c..a772cd707aa 100644 --- a/src/Compiler/Service/ServiceLexing.fs +++ b/src/Compiler/Service/ServiceLexing.fs @@ -205,13 +205,9 @@ module internal TokenClassifications = // (this isn't entirely correct, but it'll work for now - see bug 3727) (FSharpTokenColorKind.Number, FSharpTokenCharKind.Operator, FSharpTokenTriggerClass.None) - | INFIX_STAR_DIV_MOD_OP ("mod" - | "land" - | "lor" - | "lxor") - | INFIX_STAR_STAR_OP ("lsl" - | "lsr" - | "asr") -> (FSharpTokenColorKind.Keyword, FSharpTokenCharKind.Keyword, FSharpTokenTriggerClass.None) + | INFIX_STAR_DIV_MOD_OP ("mod" | "land" | "lor" | "lxor") + | INFIX_STAR_STAR_OP ("lsl" | "lsr" | "asr") -> + (FSharpTokenColorKind.Keyword, FSharpTokenCharKind.Keyword, FSharpTokenTriggerClass.None) | LPAREN_STAR_RPAREN | DOLLAR diff --git a/src/Compiler/Service/ServiceParsedInputOps.fs b/src/Compiler/Service/ServiceParsedInputOps.fs index 7d3c916bc8e..ef194965b34 100644 --- a/src/Compiler/Service/ServiceParsedInputOps.fs +++ b/src/Compiler/Service/ServiceParsedInputOps.fs @@ -2037,10 +2037,7 @@ module ParsedInput = result <- Some(oldScope, oldPos, true) | Some (oldScope, oldPos, _), _ -> match kind, oldScope.Kind with - | (Namespace - | NestedModule - | TopModule), - OpenDeclaration + | (Namespace | NestedModule | TopModule), OpenDeclaration | _ when oldPos.Line <= line -> result <- Some( diff --git a/src/Compiler/TypedTree/QuotationPickler.fsi b/src/Compiler/TypedTree/QuotationPickler.fsi index 648e9d0acf6..fb7dbd2be5a 100644 --- a/src/Compiler/TypedTree/QuotationPickler.fsi +++ b/src/Compiler/TypedTree/QuotationPickler.fsi @@ -2,6 +2,7 @@ /// Code to pickle out quotations in the quotation binary format. module internal FSharp.Compiler.QuotationPickler + #nowarn "1178" type TypeData diff --git a/src/FSharp.Core/local.fsi b/src/FSharp.Core/local.fsi index e4d26e76e2b..2af9465beaf 100644 --- a/src/FSharp.Core/local.fsi +++ b/src/FSharp.Core/local.fsi @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.FSharp.Core + open Microsoft.FSharp.Core [] diff --git a/src/FSharp.Core/quotations.fs b/src/FSharp.Core/quotations.fs index 44c625de5f5..c3c7317e522 100644 --- a/src/FSharp.Core/quotations.fs +++ b/src/FSharp.Core/quotations.fs @@ -942,14 +942,8 @@ module Patterns = | VarSetOp, _ | AddressSetOp, _ -> typeof | AddressOfOp, [ expr ] -> (typeOf expr).MakeByRefType() - | (AddressOfOp - | QuoteOp _ - | SequentialOp - | TryWithOp - | TryFinallyOp - | IfThenElseOp - | AppOp), - _ -> failwith "unreachable" + | (AddressOfOp | QuoteOp _ | SequentialOp | TryWithOp | TryFinallyOp | IfThenElseOp | AppOp), _ -> + failwith "unreachable" //-------------------------------------------------------------------------- // Constructors for building Raw quotations @@ -2933,8 +2927,7 @@ module DerivedPatterns = let (|SpecificCall|_|) templateParameter = // Note: precomputation match templateParameter with - | (Lambdas (_, Call (_, minfo1, _)) - | Call (_, minfo1, _)) -> + | (Lambdas (_, Call (_, minfo1, _)) | Call (_, minfo1, _)) -> let isg1 = minfo1.IsGenericMethod let gmd = diff --git a/src/FSharp.Core/seqcore.fsi b/src/FSharp.Core/seqcore.fsi index 03496378232..701a92fc705 100644 --- a/src/FSharp.Core/seqcore.fsi +++ b/src/FSharp.Core/seqcore.fsi @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.FSharp.Collections + open System open System.Collections open System.Collections.Generic