0
0
mirror of https://github.com/vim/vim.git synced 2025-09-30 04:44:14 -04:00

patch 8.2.2878: Vim9: for loop list unpack only allows for one "_"

Problem:    Vim9: for loop list unpack only allows for one "_".
Solution:   Drop the value when the variable is "_". (closes #8232)
This commit is contained in:
Bram Moolenaar
2021-05-22 21:40:39 +02:00
parent 1e615669c0
commit b777da9be8
3 changed files with 14 additions and 0 deletions

View File

@@ -2500,6 +2500,12 @@ def Test_for_loop_unpack()
endfor
assert_equal(['global', 'buf', 'win', 'tab', '1', '2', '3', '4'], slist)
unlet! g:globalvar b:bufvar w:winvar t:tabvar
var res = []
for [_, n, _] in [[1, 2, 3], [4, 5, 6]]
res->add(n)
endfor
assert_equal([2, 5], res)
END
CheckDefAndScriptSuccess(lines)