Skip to content

Custom operator turns into code comment after formatting #3442

Closed

Description

@nojaf

Issue created from fantomas-online

Code

module MahSignature

        /// Multiplication
        val inline (.*)  : (unit -> ^a) -> ^b           -> unit -> ^c when (^a or ^b) : (static member (*) : ^a * ^b -> ^c)
        /// Multiplication
        val inline ( *.) : ^a           -> (unit -> ^b) -> unit -> ^c when (^a or ^b) : (static member (*) : ^a * ^b -> ^c)
        /// Multiplication
        val inline (.*.) : (unit -> ^a) -> (unit -> ^b) -> unit -> ^c when (^a or ^b) : (static member (*) : ^a * ^b -> ^c)

Result

module MahSignature

/// Multiplication
val inline (.*) : (unit -> ^a) -> ^b -> unit -> ^c when (^a or ^b) : (static member (*) : ^a * ^b -> ^c)
/// Multiplication
val inline (*.) : ^a -> (unit -> ^b) -> unit -> ^c when (^a or ^b) : (static member (*) : ^a * ^b -> ^c)
/// Multiplication
val inline (.*.) : (unit -> ^a) -> (unit -> ^b) -> unit -> ^c when (^a or ^b) : (static member (*) : ^a * ^b -> ^c)

Problem description

Image

The input had space around the operator to avoid this, the format output should do the same.
It might be worth revisiting the style of custom operators at a later stage to always have spaces.
I think some of the style guides might even mention this. A localized fix would be fine for now.

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.
  • I would like a release if this problem is solved.

Options

Fantomas main branch at 2026-08-28T08:06:07Z - b67bc66

    { config with
                SpaceBeforeColon = true }

Signature file

Did you know that you can ignore files when formatting by using a .fantomasignore file?
PS: It's unlikely that someone else will solve your specific issue, as it's something that you have a personal stake in.

Activity

  1. added a commit that references this issue on Aug 28, 2026
    729f1e3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions