0
0
mirror of https://github.com/vim/vim.git synced 2025-11-01 10:07:16 -04:00

patch 8.2.3182: Vim9: crash when using removing items from a constant list

Problem:    Vim9: crash when using removing items from a constant list.
            (Yegappan Lakshmanan)
Solution:   When a list was allocated with items copy them.
This commit is contained in:
Bram Moolenaar
2021-07-18 22:25:29 +02:00
parent 9ff9c7b974
commit 885971e2f5
3 changed files with 34 additions and 6 deletions

View File

@@ -2083,6 +2083,12 @@ def Test_remote_startserver()
CheckDefFailure(['remote_startserver({})'], 'E1013: Argument 1: type mismatch, expected string but got dict<unknown>')
enddef
def Test_remove_const_list()
var l: list<number> = [1, 2, 3, 4]
assert_equal([1, 2], remove(l, 0, 1))
assert_equal([3, 4], l)
enddef
def Test_remove_return_type()
var l = remove({one: [1, 2], two: [3, 4]}, 'one')
var res = 0