Skip to content

Commit e2aa020

Browse files
authored
Merge pull request #3101 from dawedawe/fix_3097
Fix dot lambda regression reported in 3097
2 parents 3e9c673 + 60fc990 commit e2aa020

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

Diff for: CHANGELOG.md

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

3-
## [Unreleased]
3+
## 6.3.10 - 2024-07-12
44

55
### Changed
66
* Update FCS to 'Allow ParsedHashDirectives to take non string arguments', commit 836d4e0603442d6053c8d439993a022501cae494 [#3096](https://github.com/fsprojects/fantomas/pull/3096)
77

8+
### Fixed
9+
* Regression with dot lambda args being pushed out too far. [#3097](https://github.com/fsprojects/fantomas/issues/3097)
10+
811
## 6.3.9 - 2024-06-10
912

1013
### Fixed

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

+28
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,31 @@ type Bar() =
131131
let b = Bar ()
132132
b |> _.Foo(Meh ())
133133
"""
134+
135+
[<Test>]
136+
let ``regression with dot lambda args being pushed out too far, 3097`` () =
137+
formatSourceString
138+
"""
139+
workstations
140+
|> Seq.sumBy
141+
_.GetWeeklyValueWithoutAccessCheck(
142+
year,
143+
week,
144+
CapacityAggregateValueType.CostPrice,
145+
category
146+
)
147+
"""
148+
{ config with MaxLineLength = 50 }
149+
|> prepend newline
150+
|> should
151+
equal
152+
"""
153+
workstations
154+
|> Seq.sumBy
155+
_.GetWeeklyValueWithoutAccessCheck(
156+
year,
157+
week,
158+
CapacityAggregateValueType.CostPrice,
159+
category
160+
)
161+
"""

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1562,7 +1562,7 @@ let genExpr (e: Expr) =
15621562
| Expr.DotLambda node ->
15631563
let genDotLambdaExpr expr =
15641564
match expr with
1565-
| Expr.AppSingleParenArg p -> genExpr p.FunctionExpr +> genExpr p.ArgExpr // be always atomic, see 3050
1565+
| Expr.AppSingleParenArg p -> genAppSingleParenArgExpr sepNone p // be always atomic, see 3050
15661566
| _ -> genExpr expr
15671567

15681568
genSingleTextNode node.Underscore

0 commit comments

Comments
 (0)