Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
namenu opened this issue Nov 28, 2024 · 0 comments · Fixed by #7224
Closed

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

namenu opened this issue Nov 28, 2024 · 0 comments · Fixed by #7224

Comments

@namenu
Copy link
Contributor

namenu commented Nov 28, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants