Skip to content

Commit

Permalink
Merge pull request #3101 from dawedawe/fix_3097
Browse files Browse the repository at this point in the history
Fix dot lambda regression reported in 3097
  • Loading branch information
dawedawe authored Jul 12, 2024
2 parents 3e9c673 + 60fc990 commit e2aa020
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
28 changes: 28 additions & 0 deletions src/Fantomas.Core.Tests/DotLambdaTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,31 @@ type Bar() =
let b = Bar ()
b |> _.Foo(Meh ())
"""

[<Test>]
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
)
"""
2 changes: 1 addition & 1 deletion src/Fantomas.Core/CodePrinter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e2aa020

Please sign in to comment.