erg-lang / erg

A statically typed language compatible with Python
http://erg-lang.org
Apache License 2.0
2.69k stars 55 forks source link

Moved variable messages #241

Open mtshiba opened 1 year ago

mtshiba commented 1 year ago
i = !1
j = i
print! i

The above code will get the output

Error[#0293]: File test.er, line 3, ::test.er

3 | print! i
  :        -

i was moved in line 2

However, it would be easier to understand if it also displays the line where the move occurred, as in Rust. In other words, it should look like this.

Error[#0293]: File test.er, line 3, ::test.er

2 | j = i
  :     \- value moved here
3 | print! i
  :        -

i was moved in line 2