Closed dmag closed 5 years ago
Thank you for reporting this! I am finishing up a revamp of the compiler that is able to produce much nicer error messages. Based on your example, I made a tweak in https://github.com/elm/compiler/commit/aaa2d65d09672b31b6da6c3c317e12bf6b796d47 to make the message super relevant! My development build is producing:
-- UNEXPECTED ARROW --------------------------------------------------- temp.elm
I am parsing a `case` expression right now, but this arrow is confusing me:
6| NoOp ->
^^
It makes sense to see arrows around here, so I suspect it is something earlier.
Maybe this pattern is indented a bit farther than the previous patterns?
Note: Sometimes I get confused by indentation, so try to make your `case` look
something like this:
case maybeWidth of
Just width ->
width + 200
Nothing ->
400
Notice the indentation! Patterns are aligned with each other. Same indentation.
The expressions after each arrow are all indented a bit more than the patterns.
That is important!
Thank you for reporting this! It makes it really easy to check if the error message is giving information that is relevant to the reader!
I had a working program (elm 0.18.0), and tried to add a simple NoOp branch to my update function. I was doing a copy-paste, which accidentally added an extra space.
The compiler gave me this error, which was quite confusing.
It would have helped if the compiler saw the arrow and gave a hint: "if was supposed to be part of your existing case statement, it's not indented properly." For completeness, if you have too little indent, you get this error, which could use a similar heuristic to give the same hint.