Skip to content

Commit be5d577

Browse files
AsmusABdawedawenojaf
authored
Check if we just wrote a DotLambda on a record value before deciding on space before parens, fix 3120 (#3121)
* Check if we just wrote a DotLambda on a record value before deciding on space before parens, fix 3120 * Add note about referring to issue * add changelog entry * Reference issue id in test name Co-authored-by: dawe <[email protected]> * Bump version --------- Co-authored-by: dawe <[email protected]> Co-authored-by: Florian Verdonck <[email protected]>
1 parent ceb1fa2 commit be5d577

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

Diff for: CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 6.3.14 - 2024-09-14
4+
5+
### Fixed
6+
* Idempotency problem when _.Property shorthand with record value. [#3120](https://github.com/fsprojects/fantomas/issues/3120)
7+
38
## 6.3.13 - 2024-09-10
49

510
### Fixed

Diff for: src/Fantomas.Core.Tests/DotLambdaTests.fs

+15
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,21 @@ let ``idempotency problem when _.Property shorthand, 3050`` () =
7575
"ABC" |> _.ToLower()
7676
"""
7777

78+
[<Test>]
79+
let ``idempotency problem with _.Property shorthand with record value, 3120`` () =
80+
formatSourceString
81+
"""
82+
_.A.ToLower()
83+
"""
84+
{ config with
85+
SpaceBeforeUppercaseInvocation = true }
86+
|> prepend newline
87+
|> should
88+
equal
89+
"""
90+
_.A.ToLower()
91+
"""
92+
7893
[<Test>]
7994
let ``idempotency problem when _.property shorthand lowercase, 3050`` () =
8095
formatSourceString

Diff for: src/Fantomas.Core/CodePrinter.fs

+1
Original file line numberDiff line numberDiff line change
@@ -1572,6 +1572,7 @@ let genExpr (e: Expr) =
15721572
let genDotLambdaExpr expr =
15731573
match expr with
15741574
| Expr.AppSingleParenArg p -> genAppSingleParenArgExpr sepNone p // be always atomic, see 3050
1575+
| Expr.AppLongIdentAndSingleParenArg p -> genAppLongIdentAndSingleParenArgExpr sepNone p // see 3120
15751576
| _ -> genExpr expr
15761577

15771578
genSingleTextNode node.Underscore

0 commit comments

Comments
 (0)