Skip to content

Commit

Permalink
Remove unused code after FCS upgrade. (#1950)
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf committed Jan 14, 2022
1 parent 60b444f commit e5ff56e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 37 deletions.
4 changes: 0 additions & 4 deletions src/Fantomas.Tests/PatternMatchingTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,6 @@ let private formatResponse<'options> () =
}
"""

[<Ignore("Fixed in https://github.com/dotnet/fsharp/pull/12225")>]
[<Test>]
let ``match inside match expression, 1400`` () =
formatSourceString
Expand Down Expand Up @@ -1301,7 +1300,6 @@ match
| _ -> failwith ""
"""

[<Ignore("Fixed in https://github.com/dotnet/fsharp/pull/12225")>]
[<Test>]
let ``match bang inside match expression`` () =
formatSourceString
Expand Down Expand Up @@ -1332,7 +1330,6 @@ match
| _ -> failwith ""
"""

[<Ignore("Fixed in https://github.com/dotnet/fsharp/pull/12225")>]
[<Test>]
let ``match inside match bang expression`` () =
formatSourceString
Expand Down Expand Up @@ -1363,7 +1360,6 @@ match!
| _ -> failwith ""
"""

[<Ignore("Fixed in https://github.com/dotnet/fsharp/pull/12225")>]
[<Test>]
let ``match bang inside match bang expression`` () =
formatSourceString
Expand Down
25 changes: 1 addition & 24 deletions src/Fantomas/CodePrinter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1699,12 +1699,7 @@ and genExpr astContext synExpr ctx =
sepOpenTFor lpr
+> genExpr astContext e
+> sepCloseTFor rpr pr
| CompApp (s, e) ->
!-s
+> sepSpace
+> sepOpenS
+> genExpr { astContext with IsNakedRange = true } e
+> sepCloseS

// This supposes to be an infix function, but for some reason it isn't picked up by InfixApps
| App (Var "?", e :: es) ->
match es with
Expand All @@ -1717,24 +1712,6 @@ and genExpr astContext synExpr ctx =
+> col sepSpace es (genExpr astContext)
+> sepCloseT

| App (Var "..", [ e1; e2 ]) ->
let expr =
genExpr astContext e1 +> sepSpace -- ".."
+> sepSpace
+> genExpr astContext e2

ifElse astContext.IsNakedRange expr (sepOpenS +> expr +> sepCloseS)
| App (Var ".. ..", [ e1; e2; e3 ]) ->
let expr =
genExpr astContext e1 +> sepSpace -- ".."
+> sepSpace
+> genExpr astContext e2
+> sepSpace
-- ".."
+> sepSpace
+> genExpr astContext e3

ifElse astContext.IsNakedRange expr (sepOpenS +> expr +> sepCloseS)
// Separate two prefix ops by spaces
| PrefixApp (s1, PrefixApp (s2, e)) -> !-(sprintf "%s %s" s1 s2) +> genExpr astContext e
| PrefixApp (s, App (e, [ Paren _ as p ]))
Expand Down
11 changes: 2 additions & 9 deletions src/Fantomas/SourceParser.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module internal Fantomas.SourceParser
open System
open FSharp.Compiler.Syntax
open FSharp.Compiler.Syntax.PrettyNaming
open FSharp.Compiler.Tokenization.FSharpKeywords
open FSharp.Compiler.Text
open FSharp.Compiler.Xml
open Fantomas
Expand Down Expand Up @@ -40,7 +39,7 @@ let (|Ident|) (s: Ident) =
if IsActivePatternName ident then
sprintf "(%s)" (DecompileOpName ident)
else
PrettyNaming.AddBackticksToIdentifierIfNeeded ident
AddBackticksToIdentifierIfNeeded ident

let (|LongIdent|) (li: LongIdent) =
li
Expand Down Expand Up @@ -802,11 +801,6 @@ let (|NewTuple|_|) =
| SynExpr.New (_, t, (ConstExpr (SynConst.Unit, _) as px), _) -> Some(t, px)
| _ -> None

let (|CompApp|_|) =
function
| SynExpr.App (_, _, Var "seq", (SynExpr.App _ as e), _) -> Some("seq", e)
| _ -> None

/// Only process prefix operators here
let (|PrefixApp|_|) =
function
Expand All @@ -822,8 +816,7 @@ let (|PrefixApp|_|) =
let (|InfixApp|_|) synExpr =
match synExpr with
| SynExpr.App (_, true, (Var "::" as e), Tuple ([ e1; e2 ], _), _) -> Some("::", e, e1, e2)
// Range operators need special treatments, so we exclude them here
| SynExpr.App (_, _, SynExpr.App (_, true, (Var s as e), e1, _), e2, _) when s <> ".." -> Some(s, e, e1, e2)
| SynExpr.App (_, _, SynExpr.App (_, true, (Var s as e), e1, _), e2, _) -> Some(s, e, e1, e2)
| _ -> None

let (|NewlineInfixApp|_|) =
Expand Down

0 comments on commit e5ff56e

Please sign in to comment.