Skip to content

Use of A | B as c fails to format correctly  #2289

@dsyme

Description

@dsyme

Found this while formatting the F# compiler. It's not a blocker, see workaround below

Issue created from fantomas-online

Code

type T = A | B

let f a  =
    match a with
    | (A | B as bi, x) ->
        1

Result

type T =
    | A
    | B

let f a =
    match a with
    | (A
       | B as bi,
       label1) -> 1

Problem description

Please describe here the Fantomas problem you encountered.
Check out our Contribution Guidelines.

Workaround

The workaround is to parenthesize, e.g.

type T = A | B

let f a  =
    match a with
    | ((A | B) as bi, x) ->
        1

Extra information

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

Options

Fantomas master branch at 2022-05-30T18:11:41Z - 5e92752

Default Fantomas configuration

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions