Skip to content

Commit

Permalink
Merge pull request fsprojects#3095 from dawedawe/fix_2865
Browse files Browse the repository at this point in the history
Add a missing case to containsLambdaOrMatchExpr to fix 2865
  • Loading branch information
dawedawe committed Jun 9, 2024
2 parents 854d9b3 + 5fa884a commit 6b1ce03
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
35 changes: 35 additions & 0 deletions src/Fantomas.Core.Tests/ConstructorTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,38 @@ type CreateBuildingViewModel =
then vm.program <- p
"""

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

0 comments on commit 6b1ce03

Please sign in to comment.