fish-shell/tests/expansion.err
Kevin Ballard cc49042294 Parse slices even for empty variables
When a variable is parsed as being empty, parse out the slice and
validate the indexes anyway, behaving for slicing purposes as if the
variable had a single empty value.

Besides providing errors when expected, this also fixes the following:

    set -l foo
    echo "$foo[1]"

This used to print "[1]", now it properly prints nothing.
2014-08-20 22:09:32 -07:00

19 lines
399 B
Plaintext

Array index out of bounds
fish: show "$foo[2]"
^
Array index out of bounds
fish: show $foo[2]
^
Array index out of bounds
fish: show "$foo[1 2]"
^
Array index out of bounds
fish: show $foo[1 2]
^
Array index out of bounds
fish: show "$foo[2 1]"
^
Array index out of bounds
fish: show $foo[2 1]
^