zxul767 / lox

An interpreter for the Lox language
1 stars 0 forks source link

incorrect token in error message for `list[wrong-index]` #29

Open zxul767 opened 1 year ago

zxul767 commented 1 year ago

consider the following code:

>>> var l = list()
>>> l.append(1)
>>> l[1]
Runtime Error: tried to access index 1, but valid range is [0..0] or [-1..-1]
[line 1, token: 'at']

the last error is expected to say [line 1, token: '[']; the current message happens because internally, index access is desugared to the list.at function, but this can be quite confusing for users.