diff --git a/CHANGELOG.md b/CHANGELOG.md index b47d80445..ecd2bdc70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,14 @@ # Changelog +## 6.3.9 - 2024-06-10 + +### Fixed +* Invalid location of comma when using named parameters for a class. [#2865](https://github.com/fsprojects/fantomas/issues/2865) + ## 6.3.8 - 2024-06-06 ### Fixed +* Fix loss of tuple type annotation without parens. [#2942](https://github.com/fsprojects/fantomas/issues/2942) * Fix precedence change of `||>` due to inserted newline. [#2866](https://github.com/fsprojects/fantomas/issues/2866) ## 6.3.7 - 2024-06-01 diff --git a/src/Fantomas.Core.Tests/ConstructorTests.fs b/src/Fantomas.Core.Tests/ConstructorTests.fs index 1696ae063..7473c3bf8 100644 --- a/src/Fantomas.Core.Tests/ConstructorTests.fs +++ b/src/Fantomas.Core.Tests/ConstructorTests.fs @@ -202,3 +202,38 @@ type CreateBuildingViewModel = then vm.program <- p """ + +[] +let ``invalid location of comma when using named parameters for a class, 2865`` () = + formatSourceString + """ +let instance = + MyClass( + Prop = + match value.SomeValue with + | Some _ -> 0.0m + | None -> 0.0m + , + Prop2 = + match value.SomeValue with + | Some _ -> 0.0m + | None -> 0.0m + ) +""" + config + |> prepend newline + |> should + equal + """ +let instance = + MyClass( + Prop = + match value.SomeValue with + | Some _ -> 0.0m + | None -> 0.0m + , Prop2 = + match value.SomeValue with + | Some _ -> 0.0m + | None -> 0.0m + ) +""" diff --git a/src/Fantomas.Core/CodePrinter.fs b/src/Fantomas.Core/CodePrinter.fs index 5a13896a6..afc7f7615 100644 --- a/src/Fantomas.Core/CodePrinter.fs +++ b/src/Fantomas.Core/CodePrinter.fs @@ -1899,6 +1899,7 @@ let genTupleMultiline (node: ExprTupleNode) = | Expr.Lambda _ -> true | Expr.InfixApp node -> match node.RightHandSide with + | Expr.Match _ | Expr.Lambda _ -> true | _ -> false | Expr.SameInfixApps node ->