Skip to content

Commit

Permalink
Always add a space for multiple curried args invocation (fsprojects#2088
Browse files Browse the repository at this point in the history
)

Fixes fsprojects#2087

Cherry-picked from upstream's
fsprojects@fd46ab0

Co-authored-by: ijanus <[email protected]>
  • Loading branch information
knocte and janus committed Feb 16, 2022
1 parent b632d0d commit 4537585
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
19 changes: 19 additions & 0 deletions src/Fantomas.Tests/AppTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -763,3 +763,22 @@ x |> f<y> // some comment
"""
x |> f<y> // some comment
"""

[<Test>]
let ``function invocation with multiple curried parameters, 2087`` () =
formatSourceString
false
"""
module Foo =
let Bar (baz1: int) (baz2: string) (baz3: string) (baz4: string) (baz5: string) =
FooBarBaz(someFunc x) (someOtherFunc y)
"""
config
|> prepend newline
|> should
equal
"""
module Foo =
let Bar (baz1: int) (baz2: string) (baz3: string) (baz4: string) (baz5: string) =
FooBarBaz (someFunc x) (someOtherFunc y)
"""
2 changes: 1 addition & 1 deletion src/Fantomas.Tests/PatternMatchingTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@ match foo with
getRangeBetween "keyword" headToken headToken
let info =
Trivia.Create(Keyword(headToken)) range
Trivia.Create (Keyword(headToken)) range
|> List.prependItem foundTrivia
getTriviaFromTokensThemSelves allTokens rest info
Expand Down
4 changes: 2 additions & 2 deletions src/Fantomas/CodePrinter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3136,8 +3136,8 @@ and genApp astContext e es ctx =
(fun ctx ->
match es with
| [] -> false
| [ h ]
| h :: _ -> addSpaceBeforeParensInFunCall e h ctx)
| [ h ] -> addSpaceBeforeParensInFunCall e h ctx
| _ -> true)
sepSpace
sepNone

Expand Down

0 comments on commit 4537585

Please sign in to comment.