unison icon indicating copy to clipboard operation
unison copied to clipboard

Whitespace before a definition causes cryptic error message

Open ceedubs opened this issue 2 years ago • 1 comments

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.

ceedubs avatar Jan 05 '24 15:01 ceedubs

Note: something similar happens if you have a space before test> or > watch expressions.

ceedubs avatar Jan 05 '24 15:01 ceedubs