Skip to content

Commit 67f9ccf

Browse files
authored
More fantomas (#13867)
* Update to fantomas 5.0.3. * Expend ignore patterns.
1 parent 8d27963 commit 67f9ccf

12 files changed

+99
-78
lines changed

.config/dotnet-tools.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"fantomas": {
6-
"version": "5.0.0-beta-005",
6+
"version": "5.0.3",
77
"commands": [
88
"fantomas"
99
]

.fantomasignore

+73-8
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,79 @@ artifacts/
1212

1313
# Explicitly unformatted implementation files
1414

15-
src/Compiler/Checking/**/*.fs
16-
src/Compiler/DependencyManager/**/*.fs
17-
src/Compiler/Facilities/**/*.fs
18-
src/Compiler/Interactive/**/*.fs
19-
src/Compiler/Legacy/**/*.fs
20-
src/Compiler/Optimize/**/*.fs
21-
src/Compiler/Symbols/**/*.fs
22-
src/Compiler/TypedTree/**/*.fs
15+
src/Compiler/Checking/AccessibilityLogic.fs
16+
src/Compiler/Checking/AttributeChecking.fs
17+
src/Compiler/Checking/AugmentWithHashCompare.fs
18+
src/Compiler/Checking/CheckBasics.fs
19+
src/Compiler/Checking/CheckComputationExpressions.fs
20+
src/Compiler/Checking/CheckDeclarations.fs
21+
src/Compiler/Checking/CheckExpressions.fs
22+
src/Compiler/Checking/CheckFormatStrings.fs
23+
src/Compiler/Checking/CheckIncrementalClasses.fs
24+
src/Compiler/Checking/CheckPatterns.fs
25+
src/Compiler/Checking/ConstraintSolver.fs
26+
src/Compiler/Checking/FindUnsolved.fs
27+
src/Compiler/Checking/import.fs
28+
src/Compiler/Checking/InfoReader.fs
29+
src/Compiler/Checking/infos.fs
30+
src/Compiler/Checking/MethodCalls.fs
31+
src/Compiler/Checking/MethodOverrides.fs
32+
src/Compiler/Checking/NameResolution.fs
33+
src/Compiler/Checking/NicePrint.fs
34+
src/Compiler/Checking/PatternMatchCompilation.fs
35+
src/Compiler/Checking/PostInferenceChecks.fs
36+
src/Compiler/Checking/QuotationTranslator.fs
37+
src/Compiler/Checking/SignatureConformance.fs
38+
src/Compiler/Checking/TypeHierarchy.fs
39+
src/Compiler/Checking/TypeRelations.fs
40+
41+
src/Compiler/DependencyManager/AssemblyResolveHandler.fs
42+
src/Compiler/DependencyManager/DependencyProvider.fs
43+
src/Compiler/DependencyManager/NativeDllResolveHandler.fs
44+
45+
src/Compiler/Facilities/BuildGraph.fs
46+
src/Compiler/Facilities/CompilerLocation.fs
47+
src/Compiler/Facilities/DiagnosticOptions.fs
48+
src/Compiler/Facilities/DiagnosticResolutionHints.fs
49+
src/Compiler/Facilities/DiagnosticsLogger.fs
50+
src/Compiler/Facilities/LanguageFeatures.fs
51+
src/Compiler/Facilities/Logger.fs
52+
src/Compiler/Facilities/prim-lexing.fs
53+
src/Compiler/Facilities/prim-parsing.fs
54+
src/Compiler/Facilities/ReferenceResolver.fs
55+
src/Compiler/Facilities/SimulatedMSBuildReferenceResolver.fs
56+
src/Compiler/Facilities/TextLayoutRender.fs
57+
58+
src/Compiler/Interactive/ControlledExecution.fs
59+
src/Compiler/Interactive/fsi.fs
60+
61+
src/Compiler/Legacy/LegacyHostedCompilerForTesting.fs
62+
src/Compiler/Legacy/LegacyMSBuildReferenceResolver.fs
63+
64+
src/Compiler/Optimize/DetupleArgs.fs
65+
src/Compiler/Optimize/InnerLambdasToTopLevelFuncs.fs
66+
src/Compiler/Optimize/LowerCalls.fs
67+
src/Compiler/Optimize/LowerComputedCollections.fs
68+
src/Compiler/Optimize/LowerLocalMutables.fs
69+
src/Compiler/Optimize/LowerSequences.fs
70+
src/Compiler/Optimize/LowerStateMachines.fs
71+
src/Compiler/Optimize/Optimizer.fs
72+
73+
src/Compiler/Symbols/Exprs.fs
74+
src/Compiler/Symbols/FSharpDiagnostic.fs
75+
src/Compiler/Symbols/SymbolHelpers.fs
76+
src/Compiler/Symbols/SymbolPatterns.fs
77+
src/Compiler/Symbols/Symbols.fs
78+
79+
src/Compiler/TypedTree/CompilerGlobalState.fs
80+
src/Compiler/TypedTree/QuotationPickler.fs
81+
src/Compiler/TypedTree/tainted.fs
82+
src/Compiler/TypedTree/TcGlobals.fs
83+
src/Compiler/TypedTree/TypedTree.fs
84+
src/Compiler/TypedTree/TypedTreeBasics.fs
85+
src/Compiler/TypedTree/TypedTreeOps.fs
86+
src/Compiler/TypedTree/TypedTreePickle.fs
87+
src/Compiler/TypedTree/TypeProviders.fs
2388

2489
# Explicitly unformatted file that needs more care to get it to format well
2590

src/Compiler/CodeGen/IlxGen.fs

+7-23
Original file line numberDiff line numberDiff line change
@@ -2840,9 +2840,7 @@ let ComputeDebugPointForBinding g bind =
28402840
| DebugPointAtBinding.NoneAtDo, _ -> false, None
28412841
| DebugPointAtBinding.NoneAtLet, _ -> false, None
28422842
// Don't emit debug points for lambdas.
2843-
| _,
2844-
(Expr.Lambda _
2845-
| Expr.TyLambda _) -> false, None
2843+
| _, (Expr.Lambda _ | Expr.TyLambda _) -> false, None
28462844
| DebugPointAtBinding.Yes m, _ -> false, Some m
28472845

28482846
//-------------------------------------------------------------------------
@@ -5134,21 +5132,10 @@ and GenAsmCode cenv cgbuf eenv (il, tyargs, args, returnTys, m) sequel =
51345132
// For these we can just generate the argument and change the test (from a brfalse to a brtrue and vice versa)
51355133
| ([ AI_ceq ],
51365134
[ arg1
5137-
Expr.Const ((Const.Bool false
5138-
| Const.SByte 0y
5139-
| Const.Int16 0s
5140-
| Const.Int32 0
5141-
| Const.Int64 0L
5142-
| Const.Byte 0uy
5143-
| Const.UInt16 0us
5144-
| Const.UInt32 0u
5145-
| Const.UInt64 0UL),
5135+
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),
51465136
_,
51475137
_) ],
5148-
CmpThenBrOrContinue (1,
5149-
[ I_brcmp ((BI_brfalse
5150-
| BI_brtrue) as bi,
5151-
label1) ]),
5138+
CmpThenBrOrContinue (1, [ I_brcmp ((BI_brfalse | BI_brtrue) as bi, label1) ]),
51525139
_) ->
51535140

51545141
let bi =
@@ -7903,9 +7890,7 @@ and GenDecisionTreeTest
79037890
// If so, emit the failure logic, then came back and do the success target, then
79047891
// do any postponed failure target.
79057892
match successTree, failureTree with
7906-
| TDSuccess _,
7907-
(TDBind _
7908-
| TDSwitch _) ->
7893+
| TDSuccess _, (TDBind _ | TDSwitch _) ->
79097894

79107895
// OK, there is more logic in the decision tree on the failure branch
79117896
let success = CG.GenerateDelayMark cgbuf "testSuccess"
@@ -10641,10 +10626,9 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) =
1064110626
| None -> None
1064210627
| Some memberInfo ->
1064310628
match name, memberInfo.MemberFlags.MemberKind with
10644-
| ("Item"
10645-
| "op_IndexedLookup"),
10646-
(SynMemberKind.PropertyGet
10647-
| SynMemberKind.PropertySet) when not (isNil (ArgInfosOfPropertyVal g vref.Deref)) ->
10629+
| ("Item" | "op_IndexedLookup"), (SynMemberKind.PropertyGet | SynMemberKind.PropertySet) when
10630+
not (isNil (ArgInfosOfPropertyVal g vref.Deref))
10631+
->
1064810632
Some(
1064910633
mkILCustomAttribute (
1065010634
g.FindSysILTypeRef "System.Reflection.DefaultMemberAttribute",

src/Compiler/Driver/ParseAndCheckInputs.fs

+1-4
Original file line numberDiff line numberDiff line change
@@ -844,10 +844,7 @@ let ProcessMetaCommandsFromInput
844844
| ParsedHashDirective ("nowarn", ParsedHashDirectiveArguments numbers, m) ->
845845
List.fold (fun state d -> nowarnF state (m, d)) state numbers
846846

847-
| ParsedHashDirective (("reference"
848-
| "r"),
849-
ParsedHashDirectiveArguments args,
850-
m) ->
847+
| ParsedHashDirective (("reference" | "r"), ParsedHashDirectiveArguments args, m) ->
851848
matchedm <- m
852849
ProcessDependencyManagerDirective Directive.Resolution args m state
853850

src/Compiler/Service/FSharpCheckerResults.fs

+5-17
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,7 @@ type FSharpSymbolUse(denv: DisplayEnv, symbol: FSharpSymbol, inst: TyparInstanti
247247
// 'seq' in 'seq { ... }' gets colored as keywords
248248
| Item.Value vref, ItemOccurence.Use when valRefEq denv.g denv.g.seq_vref vref -> true
249249
// custom builders, custom operations get colored as keywords
250-
| (Item.CustomBuilder _
251-
| Item.CustomOperation _),
252-
ItemOccurence.Use -> true
250+
| (Item.CustomBuilder _ | Item.CustomOperation _), ItemOccurence.Use -> true
253251
| _ -> false
254252

255253
member _.IsFromOpenStatement = itemOcc = ItemOccurence.Open
@@ -2306,14 +2304,8 @@ module internal ParseAndCheckFile =
23062304

23072305
matchBraces stackAfterMatch
23082306

2309-
| LPAREN
2310-
| LBRACE _
2311-
| LBRACK
2312-
| LBRACE_BAR
2313-
| LBRACK_BAR
2314-
| LQUOTE _
2315-
| LBRACK_LESS as tok,
2316-
_ -> matchBraces ((tok, lexbuf.LexemeRange) :: stack)
2307+
| LPAREN | LBRACE _ | LBRACK | LBRACE_BAR | LBRACK_BAR | LQUOTE _ | LBRACK_LESS as tok, _ ->
2308+
matchBraces ((tok, lexbuf.LexemeRange) :: stack)
23172309

23182310
// INTERP_STRING_BEGIN_PART corresponds to $"... {" at the start of an interpolated string
23192311
//
@@ -2322,19 +2314,15 @@ module internal ParseAndCheckFile =
23222314
// interpolation expression)
23232315
//
23242316
// Either way we start a new potential match at the last character
2325-
| INTERP_STRING_BEGIN_PART _
2326-
| INTERP_STRING_PART _ as tok,
2327-
_ ->
2317+
| INTERP_STRING_BEGIN_PART _ | INTERP_STRING_PART _ as tok, _ ->
23282318
let m = lexbuf.LexemeRange
23292319

23302320
let m2 =
23312321
mkFileIndexRange m.FileIndex (mkPos m.End.Line (max (m.End.Column - 1) 0)) m.End
23322322

23332323
matchBraces ((tok, m2) :: stack)
23342324

2335-
| (EOF _
2336-
| LEX_FAILURE _),
2337-
_ -> ()
2325+
| (EOF _ | LEX_FAILURE _), _ -> ()
23382326
| _ -> matchBraces stack
23392327

23402328
matchBraces [])

src/Compiler/Service/SemanticClassification.fs

+2-4
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,8 @@ module TcResolutionsExtensions =
212212
resolutions
213213
|> Array.iter (fun cnr ->
214214
match cnr.Item, cnr.ItemOccurence, cnr.Range with
215-
| (Item.CustomBuilder _
216-
| Item.CustomOperation _),
217-
ItemOccurence.Use,
218-
m -> add m SemanticClassificationType.ComputationExpression
215+
| (Item.CustomBuilder _ | Item.CustomOperation _), ItemOccurence.Use, m ->
216+
add m SemanticClassificationType.ComputationExpression
219217

220218
| Item.Value vref, _, m when isValRefMutable g vref -> add m SemanticClassificationType.MutableVar
221219

src/Compiler/Service/ServiceLexing.fs

+3-7
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,9 @@ module internal TokenClassifications =
205205
// (this isn't entirely correct, but it'll work for now - see bug 3727)
206206
(FSharpTokenColorKind.Number, FSharpTokenCharKind.Operator, FSharpTokenTriggerClass.None)
207207

208-
| INFIX_STAR_DIV_MOD_OP ("mod"
209-
| "land"
210-
| "lor"
211-
| "lxor")
212-
| INFIX_STAR_STAR_OP ("lsl"
213-
| "lsr"
214-
| "asr") -> (FSharpTokenColorKind.Keyword, FSharpTokenCharKind.Keyword, FSharpTokenTriggerClass.None)
208+
| INFIX_STAR_DIV_MOD_OP ("mod" | "land" | "lor" | "lxor")
209+
| INFIX_STAR_STAR_OP ("lsl" | "lsr" | "asr") ->
210+
(FSharpTokenColorKind.Keyword, FSharpTokenCharKind.Keyword, FSharpTokenTriggerClass.None)
215211

216212
| LPAREN_STAR_RPAREN
217213
| DOLLAR

src/Compiler/Service/ServiceParsedInputOps.fs

+1-4
Original file line numberDiff line numberDiff line change
@@ -2037,10 +2037,7 @@ module ParsedInput =
20372037
result <- Some(oldScope, oldPos, true)
20382038
| Some (oldScope, oldPos, _), _ ->
20392039
match kind, oldScope.Kind with
2040-
| (Namespace
2041-
| NestedModule
2042-
| TopModule),
2043-
OpenDeclaration
2040+
| (Namespace | NestedModule | TopModule), OpenDeclaration
20442041
| _ when oldPos.Line <= line ->
20452042
result <-
20462043
Some(

src/Compiler/TypedTree/QuotationPickler.fsi

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
/// Code to pickle out quotations in the quotation binary format.
44
module internal FSharp.Compiler.QuotationPickler
5+
56
#nowarn "1178"
67

78
type TypeData

src/FSharp.Core/local.fsi

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
22

33
namespace Microsoft.FSharp.Core
4+
45
open Microsoft.FSharp.Core
56

67
[<AutoOpen>]

src/FSharp.Core/quotations.fs

+3-10
Original file line numberDiff line numberDiff line change
@@ -942,14 +942,8 @@ module Patterns =
942942
| VarSetOp, _
943943
| AddressSetOp, _ -> typeof<Unit>
944944
| AddressOfOp, [ expr ] -> (typeOf expr).MakeByRefType()
945-
| (AddressOfOp
946-
| QuoteOp _
947-
| SequentialOp
948-
| TryWithOp
949-
| TryFinallyOp
950-
| IfThenElseOp
951-
| AppOp),
952-
_ -> failwith "unreachable"
945+
| (AddressOfOp | QuoteOp _ | SequentialOp | TryWithOp | TryFinallyOp | IfThenElseOp | AppOp), _ ->
946+
failwith "unreachable"
953947

954948
//--------------------------------------------------------------------------
955949
// Constructors for building Raw quotations
@@ -2933,8 +2927,7 @@ module DerivedPatterns =
29332927
let (|SpecificCall|_|) templateParameter =
29342928
// Note: precomputation
29352929
match templateParameter with
2936-
| (Lambdas (_, Call (_, minfo1, _))
2937-
| Call (_, minfo1, _)) ->
2930+
| (Lambdas (_, Call (_, minfo1, _)) | Call (_, minfo1, _)) ->
29382931
let isg1 = minfo1.IsGenericMethod
29392932

29402933
let gmd =

src/FSharp.Core/seqcore.fsi

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
22

33
namespace Microsoft.FSharp.Collections
4+
45
open System
56
open System.Collections
67
open System.Collections.Generic

0 commit comments

Comments
 (0)