Skip to content

Indentation warning for long match expression with anonymous record #1903

Closed

Description

@nojaf

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.
  • 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 - be6b897

    { 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?

Activity

  1. nojaf commented on Feb 24, 2026

    @nojaf
    ContributorAuthor

    /repo-assist, I don't think this is still a problem.
    Can you add a regression test for this so we can close this issue.

  2. github-actions commented on Mar 17, 2026

    @github-actions
    Contributor

    🤖 This is an automated response from Repo Assist.

    Hi @nojaf! Confirmed — this issue is no longer reproducible on current main. I've opened a draft PR with a regression test: see PR #3295.

    The test uses MaxLineLength = 60 (which was the setting that triggered the original bug) and verifies that the match on a long unbox<{| ... |}> expression formats correctly without producing invalid indentation. Output is stable under re-formatting.

    Happy to close this issue once the PR is reviewed/merged!

    Generated by Repo Assist · ◷

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/repo-assist.md@346204513ecfa08b81566450d7d599556807389f
    
  3. added 2 commits that reference this issue on Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions