0
0
mirror of https://github.com/vim/vim.git synced 2025-10-10 06:24:10 -04:00

patch 8.2.3054: Vim9: unpack assignment using "_" after semicolon fails

Problem:    Vim9: unpack assignment using "_" after semicolon fails.
Solution:   Drop the expression result. (closes #8453)
This commit is contained in:
Bram Moolenaar
2021-06-26 13:59:29 +02:00
parent 13e45d14ba
commit 4d5dfe2083
4 changed files with 18 additions and 3 deletions

View File

@@ -289,6 +289,16 @@ def Test_assign_unpack()
assert_equal(1, v1)
assert_equal(2, v2)
var reslist = []
for text in ['aaa {bbb} ccc', 'ddd {eee} fff']
var before: string
var middle: string
var after: string
[_, before, middle, after; _] = text->matchlist('\(.\{-\}\){\(.\{-\}\)}\(.*\)')
reslist->add(before)->add(middle)->add(after)
endfor
assert_equal(['aaa ', 'bbb', ' ccc', 'ddd ', 'eee', ' fff'], reslist)
var a = 1
var b = 3
[a, b] += [2, 4]