fantomas icon indicating copy to clipboard operation
fantomas copied to clipboard

Indentation warning for long match expression with anonymous record

Open nojaf opened this issue 4 years ago • 0 comments

Issue created from fantomas-online

Code

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
            | _ -> ()
    }

Result

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
            | _ -> ()
    }

Problem description

The formatted result gives an indentation warning on source'.

Extra information

  • [ ] The formatted result breaks by code.
  • [x] The formatted result gives compiler warnings.
  • [ ] I or my company would be willing to help fix this.

Options

Fantomas 4.6 branch at 09/28/2021 06:20:05 - be6b8973b8efa3de6ef707dccbf016bcdca7ac89

    { config with
                MaxLineLength = 60 }

Did you know that you can ignore files when formatting from fantomas-tool or the FAKE targets by using a .fantomasignore file?

nojaf avatar Sep 29 '21 07:09 nojaf