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

Minor parser enhancement request: Not recognizing empty tuple / mistyped unit literal #7182

Open
dxrcy opened this issue Oct 25, 2024 · 1 comment
Labels
enhancement New feature or request intermediate issue Likely good for someone who has completed a few other issues

Comments

@dxrcy
Copy link

dxrcy commented Oct 25, 2024

When using empty parens as a unit literal () (as in Rust) instead of the correct {}, the parser rightly gives an error, but does not explain why it is wrong.

main =
    Inspect.toStr ()
        |> Stdout.line!
── SYNTAX PROBLEM in main.roc ──────────────────────────────────────────────────

I got stuck here:

[...]
4│
5│  main =
6│      Inspect.toStr ()
                     ^

Whatever I am running into is confusing me a lot! Normally I can give
fairly specific hints, but something is really tripping me up this
time.

I believe including a hint or explanation would be beneficial, like the existing Note, Roc doesn't use '()' as a null type. when using () in a type declaration.

Perhaps something like:

  • Roc doesn't use parentheses for function calls
  • Did you mean to use {} instead?
  • Did you forget to include an expression in the parentheses?
@Anton-4 Anton-4 added the enhancement New feature or request label Oct 25, 2024
@Anton-4
Copy link
Collaborator

Anton-4 commented Oct 25, 2024

Good suggestions @dxrcy, we could make it this:

Tip: Roc doesn't use parentheses for function calls:
    - Did you mean to use `{}` instead?
    - Did you forget to include an expression in the `()`?

@Anton-4 Anton-4 added the intermediate issue Likely good for someone who has completed a few other issues label Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request intermediate issue Likely good for someone who has completed a few other issues
Projects
None yet
Development

No branches or pull requests

2 participants