elm / error-message-catalog

A catalog of broken Elm programs / data to improve error messages
BSD 3-Clause "New" or "Revised" License
173 stars 17 forks source link

Incorrect message on missed `)` in tuple declaration #244

Closed kipanshi closed 5 years ago

kipanshi commented 6 years ago

Ubuntu 16.04 64bit, Core i7

1)

> tf a = (a, 1
-- SYNTAX PROBLEM -------------------------------------------- repl-temp-000.elm

The = operator is reserved for defining variables. Maybe you want == instead? Or
maybe you are defining a variable, but there is whitespace before it?

3|   tf a = (a, 1
          ^
Maybe <http://elm-lang.org/docs/syntax> can help you figure it out.

2)

> n = (1
-- SYNTAX PROBLEM -------------------------------------------- repl-temp-000.elm

The = operator is reserved for defining variables. Maybe you want == instead? Or
maybe you are defining a variable, but there is whitespace before it?

3|   n = (1
       ^
Maybe <http://elm-lang.org/docs/syntax> can help you figure it out.
brasilikum commented 6 years ago

The same error happens with more than two values in a tuple

evancz commented 5 years ago

Thank you for the report! I am wrapping up an overhaul of the parser (partly to produce better error messages) and your case now looks like this:

---- Elm 0.19.1 ----------------------------------------------------------------
Say :help for help and :exit to exit! More at <https://elm-lang.org/0.19.1/repl>
--------------------------------------------------------------------------------
> tf a = (a, 1
|   
-- UNFINISHED PARENTHESES ------------------------------------------------- REPL

I was expecting to see a closing parenthesis next:

2| tf a = (a, 1
               ^
Try adding a ) to see if that helps!

Note: I can get confused by indentation in cases like this, so maybe you have a
closing parenthesis but it is not indented enough?

These changes should become available when Elm 0.19.1 is released. Thanks again for the report!