diff --git a/CHANGELOG.md b/CHANGELOG.md index 534673a5f..891db0e0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,13 @@ # Changelog -## [Unreleased] +## 6.3.10 - 2024-07-12 ### Changed * Update FCS to 'Allow ParsedHashDirectives to take non string arguments', commit 836d4e0603442d6053c8d439993a022501cae494 [#3096](https://github.com/fsprojects/fantomas/pull/3096) +### Fixed +* Regression with dot lambda args being pushed out too far. [#3097](https://github.com/fsprojects/fantomas/issues/3097) + ## 6.3.9 - 2024-06-10 ### Fixed diff --git a/src/Fantomas.Core.Tests/DotLambdaTests.fs b/src/Fantomas.Core.Tests/DotLambdaTests.fs index 45285c3e3..4e8abdb60 100644 --- a/src/Fantomas.Core.Tests/DotLambdaTests.fs +++ b/src/Fantomas.Core.Tests/DotLambdaTests.fs @@ -131,3 +131,31 @@ type Bar() = let b = Bar () b |> _.Foo(Meh ()) """ + +[] +let ``regression with dot lambda args being pushed out too far, 3097`` () = + formatSourceString + """ +workstations +|> Seq.sumBy + _.GetWeeklyValueWithoutAccessCheck( + year, + week, + CapacityAggregateValueType.CostPrice, + category + ) +""" + { config with MaxLineLength = 50 } + |> prepend newline + |> should + equal + """ +workstations +|> Seq.sumBy + _.GetWeeklyValueWithoutAccessCheck( + year, + week, + CapacityAggregateValueType.CostPrice, + category + ) +""" diff --git a/src/Fantomas.Core/CodePrinter.fs b/src/Fantomas.Core/CodePrinter.fs index 38ba58c8c..f1b58cbda 100644 --- a/src/Fantomas.Core/CodePrinter.fs +++ b/src/Fantomas.Core/CodePrinter.fs @@ -1562,7 +1562,7 @@ let genExpr (e: Expr) = | Expr.DotLambda node -> let genDotLambdaExpr expr = match expr with - | Expr.AppSingleParenArg p -> genExpr p.FunctionExpr +> genExpr p.ArgExpr // be always atomic, see 3050 + | Expr.AppSingleParenArg p -> genAppSingleParenArgExpr sepNone p // be always atomic, see 3050 | _ -> genExpr expr genSingleTextNode node.Underscore