Skip to content

Strange behavior with OCaml operators #2380

Open
@abelbraaksma

Description

@abelbraaksma

Issue created from fantomas-online

Code

module X =
    let (land) x y = x + y
    let foo x y = x land y

Result

Note: this result is fine, using the online version, but it also shows the following message, but without the details, so I don't know if any formatting actually took place:

image

module X =
    let (land) x y = x + y
    let foo x y = x land y

The result I get locally, with a slightly older version of Fantomas, is:

module X =
    let ``land`` x y = x + y
    let foo x y = x ``land`` y

Problem description

The land etc as an operator was supposed to be deprecated by the F# compiler, but I could still create these without setting any local compiler flags, yet I saw my code auto-formatted as the second example above, which obviously won't compile (I have format-on-save on in VS 2022).

I'd totally understand if this is a non-issue, as it is supposed to be a deprecated construct. I just like to understand the CompilerMessage from the online Fantomas and whether constructs like above are indeed ignored by Fantomas, or treated as what they are: operators.

Extra information

  • The formatted result breaks my code: partially, it's unclear what happened in the online version
  • Fantomas online throws errors, or resurfaces compiler errors, unclear
  • The formatted result gives compiler warnings errors.
  • I or my company would be willing to help fix this.

Options

Fantomas master branch at 2022-07-19T14:35:52Z - 0fe6785

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? yes, I know ;)

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