Idorobots / spartan

A small Lisp dialect that serves me as a test bed for programming language features.
MIT License
13 stars 3 forks source link

Duplicate, unused variables generate syntax errors only for the second occurrence. #165

Closed Idorobots closed 2 years ago

Idorobots commented 2 years ago

Running the following code:

(let ((x 23) (x 5)) 23)

...produces the following errors:

expr(1,13): Bad `let` bindings syntax, duplicate binding identifier `x`:
  1 |(let ((x 23) (x 5)) 23)
    |             ^^^^^
  2 |

expr(1,14): Unused variable `x`, rename to `_` to avoid this error:
  1 |(let ((x 23) (x 5)) 23)
    |              ^
  2 |

expr(1,14): Unused variable `x`, rename to `_` to avoid this error:
  1 |(let ((x 23) (x 5)) 23)
    |              ^
  2 |

The first "unused variable" error should point to the first occurrence. If not possible, both errors should point to the first occurrence (and be deduplicated).