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

patch 8.2.4662: no error for using out of range list index

Problem:    No error for using out of range list index.
Solution:   Check list index at script level like in compiled function.
            (closes #10051)
This commit is contained in:
Bram Moolenaar
2022-04-01 15:26:58 +01:00
parent ffe6e646dc
commit 22ebd172e4
8 changed files with 26 additions and 11 deletions

View File

@@ -288,6 +288,12 @@ def Test_assign_concat()
s ..= {a: 2}
END
v9.CheckDefAndScriptFailure(lines, ['E1105: Cannot convert dict to string', 'E734: Wrong variable type for .='], 2)
lines =<< trim END
var ls: list<string> = []
ls[-1] ..= 'foo'
END
v9.CheckDefExecAndScriptFailure(lines, 'E684: list index out of range: -1', 2)
enddef
def Test_assign_register()