Skip to content

Commit

Permalink
Remove a superfuous unindent for match lambda in AppWithLambda, fixes…
Browse files Browse the repository at this point in the history
… 2214 (fsprojects#2215)
  • Loading branch information
dawedawe authored May 2, 2022
1 parent b07f830 commit 4606799
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
### Changed
* Add `fable_modules` to the directories which are always excluded. [Fable 3.4](https://github.com/fable-compiler/Fable/releases/tag/3.4.0)

### Fixed
* Let binding after match lambda is moved outside of nested module. [#2214](https://github.com/fsprojects/fantomas/issues/2214)

## [4.7.8] - 2022-04-25

### Fixed
Expand Down
39 changes: 39 additions & 0 deletions src/Fantomas.Tests/ModuleTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,45 @@ module App =
val a: string
"""

[<Test>]
let ``keep correct indentation for let binding after match lambda inside nested module, 2214`` () =
formatSourceString
false
"""
module Outer
let sort fallback (f: int -> string list) = ()
module Inner =
let f =
sort
"Name"
(function
| 1 -> ["One"]
| _ -> ["Not One"])
let g () = 23
"""
config
|> prepend newline
|> should
equal
"""
module Outer
let sort fallback (f: int -> string list) = ()
module Inner =
let f =
sort "Name" (function
| 1 -> [ "One" ]
| _ -> [ "Not One" ])
let g () = 23
"""

[<Test>]
let ``nested nested module with single union DU, 1123`` () =
formatSourceString
Expand Down
1 change: 0 additions & 1 deletion src/Fantomas/CodePrinter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2200,7 +2200,6 @@ and genExpr astContext synExpr ctx =
+> unindent
|> genTriviaFor SynExpr_MatchLambda matchLambdaRange)
+> sepNlnWhenWriteBeforeNewlineNotEmpty id
+> unindent
+> sepCloseTFor rpr)
|> genTriviaFor SynExpr_Paren pr

Expand Down

0 comments on commit 4606799

Please sign in to comment.