Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if we just wrote a DotLambda on a record value before deciding on space before parens, fix 3120 #3121

Merged
merged 5 commits into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 6.3.14 - 2024-09-14

### Fixed
* Idempotency problem when _.Property shorthand with record value. [#3120](https://github.com/fsprojects/fantomas/issues/3120)

## 6.3.13 - 2024-09-10

### Fixed
Expand Down
15 changes: 15 additions & 0 deletions src/Fantomas.Core.Tests/DotLambdaTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,21 @@ let ``idempotency problem when _.Property shorthand, 3050`` () =
"ABC" |> _.ToLower()
"""

[<Test>]
let ``idempotency problem with _.Property shorthand with record value, 3120`` () =
formatSourceString
"""
_.A.ToLower()
"""
{ config with
SpaceBeforeUppercaseInvocation = true }
|> prepend newline
|> should
equal
"""
_.A.ToLower()
"""

[<Test>]
let ``idempotency problem when _.property shorthand lowercase, 3050`` () =
formatSourceString
Expand Down
1 change: 1 addition & 0 deletions src/Fantomas.Core/CodePrinter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1572,6 +1572,7 @@ let genExpr (e: Expr) =
let genDotLambdaExpr expr =
match expr with
| Expr.AppSingleParenArg p -> genAppSingleParenArgExpr sepNone p // be always atomic, see 3050
| Expr.AppLongIdentAndSingleParenArg p -> genAppLongIdentAndSingleParenArgExpr sepNone p // see 3120
| _ -> genExpr expr

genSingleTextNode node.Underscore
Expand Down
Loading