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

Confusing error with misplaced negation operator / missing operand #248

Closed robx closed 5 years ago

robx commented 6 years ago
x =
   [ 1
   , 2
   , 4-
   ]

Compiler output:

I ran into something unexpected when parsing your code!
184│    [ 1
          ^
I am looking for one of the following things:
    a closing brace ']'
    whitespace
evancz commented 5 years ago

Thank you for the report! I am finishing up an overhaul of the parser that produces nicer error messages in an effort to help with all the parse errors that got reported on this repo. Based on your comment, I did some last minute cleanup in https://github.com/elm/compiler/commit/c0e858324de22e7db3b781ca9a68592073de4d1c so my development build is producing:

-- MISSING EXPRESSION ------------------------------------------------- temp.elm

I just saw a - sign, so I am getting stuck here:

4|    , 4-
5|    ]
      ^
I was expecting to see an expression next. Something like 42 or 1000 that makes
sense with a - sign.

This should become available once Elm 0.19.1 is released. Thanks again for the report!