unison
unison copied to clipboard
Whitespace before a definition causes cryptic error message
On several occasions I've had something like this in my scratch file:
foo : Nat
foo = 3
And I've been surprised to see an error message like:
offset=108:
unexpected foo
expecting newline or semicolon
26 | foo : Nat
The problem is that there is an extra space at the beginning of each line in the definition. Usually this happens because I've uncommented some code in a sloppy way.
I don't know how this case should be detected (is it that they meant for this to be a new definition like I did, or is this supposed to be part of the previous definition?), or what a better error message should be, but one way or another it would be nice to get a better error message.
Note: something similar happens if you have a space before test> or > watch expressions.