Skip to content

Commit

Permalink
Merge pull request #2923 from dawedawe/silence_preview_warnings
Browse files Browse the repository at this point in the history
Brace yourself, warnings are coming
  • Loading branch information
dawedawe authored Jul 12, 2023
2 parents 21bda5b + 4817adc commit 41fe8d6
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 22 deletions.
10 changes: 4 additions & 6 deletions src/Fantomas.Client/LSPFantomasService.fs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ let private createAgent (ct: CancellationToken) =
| Ok newDaemon ->
replyChannel.Reply(Ok newDaemon.RpcClient)

{ state with
FolderToVersion = Map.add folder version state.FolderToVersion
Daemons = Map.add version newDaemon state.Daemons }
{ FolderToVersion = Map.add folder version state.FolderToVersion
Daemons = Map.add version newDaemon state.Daemons }
| Error pse ->
replyChannel.Reply(Error(GetDaemonError.FantomasProcessStart pse))
state
Expand Down Expand Up @@ -94,9 +93,8 @@ let private createAgent (ct: CancellationToken) =
| Ok daemon ->
replyChannel.Reply(Ok daemon.RpcClient)

{ state with
Daemons = Map.add version daemon state.Daemons
FolderToVersion = Map.add folder version state.FolderToVersion }
{ Daemons = Map.add version daemon state.Daemons
FolderToVersion = Map.add folder version state.FolderToVersion }
| Error pse ->
replyChannel.Reply(Error(GetDaemonError.FantomasProcessStart pse))
state
Expand Down
6 changes: 3 additions & 3 deletions src/Fantomas.Core/ASTTransformer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ let mkLinksFromSynLongIdent (sli: SynLongIdent) : LinkExpr list =

let (|UnitExpr|_|) e =
match e with
| SynExpr.Const(constant = SynConst.Unit _) -> Some e.Range
| SynExpr.Const(constant = SynConst.Unit) -> Some e.Range
| _ -> None

let (|ParenExpr|_|) e =
Expand Down Expand Up @@ -2384,7 +2384,7 @@ let mkTypeDefn
| SynTypeDefnLeadingKeyword.Type mType -> stn "type" mType
| SynTypeDefnLeadingKeyword.And mAnd -> stn "and" mAnd
| SynTypeDefnLeadingKeyword.StaticType _
| SynTypeDefnLeadingKeyword.Synthetic _ -> failwithf "unexpected %A" trivia.LeadingKeyword
| SynTypeDefnLeadingKeyword.Synthetic -> failwithf "unexpected %A" trivia.LeadingKeyword

let implicitConstructorNode =
match implicitConstructor with
Expand Down Expand Up @@ -3131,7 +3131,7 @@ let mkTypeDefnSig (creationAide: CreationAide) (SynTypeDefnSig(typeInfo, typeRep
| SynTypeDefnLeadingKeyword.Type mType -> stn "type" mType
| SynTypeDefnLeadingKeyword.And mAnd -> stn "and" mAnd
| SynTypeDefnLeadingKeyword.StaticType _
| SynTypeDefnLeadingKeyword.Synthetic _ -> failwithf "unexpected %A" trivia.LeadingKeyword
| SynTypeDefnLeadingKeyword.Synthetic -> failwithf "unexpected %A" trivia.LeadingKeyword

let m =
if not px.IsEmpty then
Expand Down
6 changes: 3 additions & 3 deletions src/Fantomas.Core/CodePrinter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ let genIdentListNodeAux addLeadingDot (iln: IdentListNode) =
else
genSingleTextNode ident +> sepNlnWhenWriteBeforeNewlineNotEmpty
| IdentifierOrDot.KnownDot dot -> genSingleTextNode dot
| IdentifierOrDot.UnknownDot _ -> sepDot)
| IdentifierOrDot.UnknownDot -> sepDot)
|> genNode iln

let genIdentListNode iln = genIdentListNodeAux false iln
Expand Down Expand Up @@ -2220,12 +2220,12 @@ let genFunctionNameWithMultilineLids (trailing: Context -> Context) (longIdent:
(function
| IdentifierOrDot.Ident _ -> sepNone
| IdentifierOrDot.KnownDot _
| IdentifierOrDot.UnknownDot _ -> sepNln)
| IdentifierOrDot.UnknownDot -> sepNln)
t
(function
| IdentifierOrDot.Ident identNode -> genSingleTextNode identNode
| IdentifierOrDot.KnownDot dot -> genSingleTextNode dot
| IdentifierOrDot.UnknownDot _ -> sepDot)
| IdentifierOrDot.UnknownDot -> sepDot)
+> trailing
)
| _ -> sepNone
Expand Down
9 changes: 4 additions & 5 deletions src/Fantomas.Core/Context.fs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ let newlineBetweenLastWriteEvent ctx =
| RestoreAtColumn _ -> true
| _ -> false)
|> Seq.filter (function
| WriteLine _ -> true
| WriteLine -> true
| _ -> false)
|> Seq.length
|> fun writeLines -> writeLines > 1
Expand Down Expand Up @@ -674,7 +674,7 @@ let leadingExpressionIsMultiline leadingExpression continuationExpression (ctx:
|> Queue.skipExists
eventCountBeforeExpression
(function
| WriteLine _ -> true
| WriteLine -> true
| _ -> false)
(fun e ->
match e with
Expand Down Expand Up @@ -1052,9 +1052,8 @@ let colWithNlnWhenItemIsMultiline (items: ColMultilineItem list) (ctx: Context)
nextCtx

loop
{ acc with
Context = nextCtx
LastBlockMultiline = isMultiline }
{ Context = nextCtx
LastBlockMultiline = isMultiline }
rest

loop itemsState items
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Core/Trivia.fs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ let addToTree (tree: Oak) (trivia: TriviaNode seq) =
| Newline
| Directive _ -> simpleTriviaToTriviaInstruction parentNode trivia
| BlockComment _
| Cursor _ -> blockCommentToTriviaInstruction parentNode trivia
| Cursor -> blockCommentToTriviaInstruction parentNode trivia

let enrichTree (config: FormatConfig) (sourceText: ISourceText) (ast: ParsedInput) (tree: Oak) : Oak =
let fullTreeRange = tree.Range
Expand Down
6 changes: 3 additions & 3 deletions src/Fantomas.FCS/Parse.fs
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ let getSyntaxErrorMessage ctxt =
| Parser.TOKEN_BAR_RBRACK -> getErrorString "Parser.TOKEN.BAR.RBRACK"
| Parser.TOKEN_BAR_RBRACE -> getErrorString "Parser.TOKEN.BAR.RBRACE"
| Parser.TOKEN_GREATER_RBRACK -> getErrorString "Parser.TOKEN.GREATER.RBRACK"
| Parser.TOKEN_RQUOTE_DOT _
| Parser.TOKEN_RQUOTE_DOT
| Parser.TOKEN_RQUOTE -> getErrorString "Parser.TOKEN.RQUOTE"
| Parser.TOKEN_RBRACK -> getErrorString "Parser.TOKEN.RBRACK"
| Parser.TOKEN_RBRACE
Expand All @@ -682,8 +682,8 @@ let getSyntaxErrorMessage ctxt =
| Parser.TOKEN_OTHEN -> getErrorString "Parser.TOKEN.OTHEN"
| Parser.TOKEN_ELSE
| Parser.TOKEN_OELSE -> getErrorString "Parser.TOKEN.OELSE"
| Parser.TOKEN_LET _
| Parser.TOKEN_OLET _ -> getErrorString "Parser.TOKEN.OLET"
| Parser.TOKEN_LET
| Parser.TOKEN_OLET -> getErrorString "Parser.TOKEN.OLET"
| Parser.TOKEN_OBINDER
| Parser.TOKEN_BINDER -> getErrorString "Parser.TOKEN.BINDER"
| Parser.TOKEN_OAND_BANG
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ let runCheckCommand (inputPath: InputPath) : int =
| InputPath.NotFound s ->
elog $"Input path '%s{s}' not found"
1
| InputPath.Unspecified _ ->
| InputPath.Unspecified ->
elog "No input path provided. Call with --help for usage information."
1
| InputPath.File f when (IgnoreFile.isIgnoredFile (IgnoreFile.current.Force()) f) ->
Expand Down

0 comments on commit 41fe8d6

Please sign in to comment.