Correct misdetection of [001] as literal zero index

The control flow in expand.cpp is a bit more complicated than it seemed
at first blush. Ref #4862.
This commit is contained in:
Mahmoud Al-Qudsi 2018-10-15 14:11:37 -05:00
parent c02bf2548f
commit 0e62dedb26
3 changed files with 7 additions and 0 deletions

View File

@ -260,6 +260,7 @@ static size_t parse_slice(const wchar_t *in, wchar_t **end_ptr, std::vector<long
}
// debug( 0, L"Push idx %d", tmp );
literal_zero_index = literal_zero_index && tmp == 0;
idx.push_back(i1);
source_positions.push_back(i1_src_pos);
}

View File

@ -1,3 +1,8 @@
echo $foo[0]
echo $foo[ 0 ]
echo $foo[ 00 ]
# and make sure these didn't break
set -l foo one two three
echo $foo[001]

View File

@ -0,0 +1 @@
one