Fix error span for invalid slice indexes

The span now properly points at the token that was invalid, rather than
the start of the slice.

Also fix the span for `()[1]` and `()[d]`, which were previously
reporting no source location at all.
This commit is contained in:
Kevin Ballard
2014-08-21 00:26:14 -07:00
parent 9a90e041f3
commit 2974025010
3 changed files with 39 additions and 10 deletions

View File

@@ -16,3 +16,15 @@ fish: show "$foo[2 1]"
Array index out of bounds
fish: show $foo[2 1]
^
Invalid index value
fish: echo "$foo[d]"
^
Invalid index value
fish: echo $foo[d]
^
Array index out of bounds
fish: echo ()[1]
^
Invalid index value
fish: echo ()[d]
^