fish-shell/fish-shell — pull request #1630 by kballard (2014-08-21 08:16:06+00:00)
Title: Fix various expansions issues with variables

Fixes the following issues:

- [x] `"$$foo"` is completely broken; it always emits an error, no matter the value of `$foo`.
- [x] `set -l foo; echo $foo[2]` does not complain about out-of-bounds index. Note that `$foo[1]` should always be allowed; it's a usability issue to disallow that on empty variables.
- [x] `set -l foo; echo "$foo[1]"` echoes `[1]`. It should echo nothing, just as it does with `set -l foo ''; echo "$foo[1]"`.
- [x] Similarly, `set -l foo; echo "$foo[2]"` should complain about out-of-bounds index, just as it does with `set -l foo ''; echo "$foo[2]"`.
- [x] Syntax highlighting of `"$foo[1]"` is wrong. It highlights the `[1]` as if it was regular text.
- [x] `set -l foo ''; echo $$foo` throws an error.
- [x] Highlighting of `"$foo[1"` does not properly indicate the error, like `$foo[1` does.

Fixes #1626.