Skip to content

Exception abbreviation loses its right-hand side #3511

Description

@nojaf

Issue created from fantomas-online

Code

exception MyError = System.Exception

Result

exception MyError

Problem description

An exception abbreviation loses its right-hand side: exception MyError = System.Exception formats to exception MyError, which declares a new exception instead of an abbreviation. The result is valid F#, so nothing flags the change.

The same happens in a signature file. It fails on 7.0.5, 8.0.5 and main.

ASTTransformer seems to skip the abbreviated name that SynExceptionDefnRepr carries.

Found while writing tests for exception declarations.

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-10-01T08:59:20Z - 6e286d1

Default Fantomas configuration

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 Oct 7, 2026
    e88f494
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