Skip to content

Commit

Permalink
Merge pull request #294 from jindraivanek/fix-248
Browse files Browse the repository at this point in the history
Fix 248
  • Loading branch information
nojaf committed Sep 6, 2018
2 parents ff508f5 + 28cfa5e commit bbe0463
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/Fantomas.Tests/OperatorTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,11 @@ let ``should pipeline monadic bind``() =
>>= strAddLong "A long argument that is ignored" "2"
>>= strAddLong "A long argument that is ignored" "2"
>>= strAddLong "A long argument that is ignored" "2"
"""
[<Test>]
let ``should not add newline before = operator after |>``() =
formatSourceString false """1 |> max 0 = 1""" config
|> should equal """1
|> max 0 = 1
"""
6 changes: 3 additions & 3 deletions src/Fantomas/CodePrinter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -685,15 +685,15 @@ and genLetOrUseList astContext = function
/// When 'hasNewLine' is set, the operator is forced to be in a new line
and genInfixApps astContext hasNewLine synExprs =
match synExprs with
| (s, e)::es when (NoBreakInfixOps.Contains s) ->
(sepSpace -- s +> sepSpace +> genExpr astContext e)
+> genInfixApps astContext (hasNewLine || checkNewLine e es) es
| (s, e)::es when(hasNewLine) ->
(sepNln -- s +> sepSpace +> genExpr astContext e)
+> genInfixApps astContext (hasNewLine || checkNewLine e es) es
| (s, e)::es when(NoSpaceInfixOps.Contains s) ->
(!- s +> autoNln (genExpr astContext e))
+> genInfixApps astContext (hasNewLine || checkNewLine e es) es
| (s, e)::es when (NoBreakInfixOps.Contains s) ->
(sepSpace -- s +> sepSpace +> genExpr astContext e)
+> genInfixApps astContext (hasNewLine || checkNewLine e es) es
| (s, e)::es ->
(sepSpace +> autoNln (!- s +> sepSpace +> genExpr astContext e))
+> genInfixApps astContext (hasNewLine || checkNewLine e es) es
Expand Down

0 comments on commit bbe0463

Please sign in to comment.