Skip to content

Formatter Breaks Code When Using {_} in Pattern Matching #7179

Closed
@namenu

Description

@namenu

The following code demonstrates the issue:

  switch u {
  | {_} => Js.log("matched")
  }

When running the formatter on this code, it transforms the code into:

  switch u {
  | {, _} => Js.log("matched")
  }

This leads to a syntax error; see playground

It is unclear whether the original syntax {_} should be considered valid. If {_} is invalid syntax, the compiler should raise an error for the original code before formatting occurs.

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