Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- `///` doc comment without associated declaration (e.g. at end of file) was duplicated when formatting. [#2499](https://github.com/fsprojects/fantomas/issues/2499)
- NamedIndexedPropertySet with two SynLongIdent removed space. [#3273](https://github.com/fsprojects/fantomas/issues/3273)
- `%%` (double-percent) infix operator moved to new line, producing invalid F#. [#2107](https://github.com/fsprojects/fantomas/issues/2107)
- Indentation warning when formatting `match` with long anonymous record discriminant. [#1903](https://github.com/fsprojects/fantomas/issues/1903)

## [8.0.0-alpha-007] - 2026-03-10

Expand Down
56 changes: 56 additions & 0 deletions src/Fantomas.Core.Tests/PatternMatchingTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2339,3 +2339,59 @@ let v, x =
& Assumenda assumenda -> libero, []
| _ -> saepe, delectus
"""

[<Test>]
let ``match on long anonymous record type discriminant does not cause indentation warning, 1903`` () =
let config60 = { config with MaxLineLength = 60 }

formatSourceString
"""
match
(unbox<{| __proto__: {| ChooseAsync: (('T -> Async<_ option>) -> AsyncSeq<_>) option |} option |}> (
source'
))
.__proto__ with
| Some proto when proto.ChooseAsync.IsSome ->
source'.ChooseAsync f
| _ ->
asyncSeq {
for itm in source do
let! v = f itm

match v with
| Some v -> yield v
| _ -> ()
}
"""
config60
|> prepend newline
|> should
equal
"""
match
(unbox<
{|
__proto__:
{|
ChooseAsync:
(('T -> Async<_ option>)
-> AsyncSeq<_>) option
|} option
|}
> (
source'
))
.__proto__
with
| Some proto when proto.ChooseAsync.IsSome ->
source'.ChooseAsync f
| _ ->
asyncSeq {
for itm in source do
let! v = f itm

match v with
| Some v -> yield v
| _ -> ()
}
"""
Loading