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

patch 8.2.1244: Vim9: in lambda index assumes a list

Problem:    Vim9: in lambda index assumes a list.
Solution:   Use the value type to decide about list or dict. (closes #6479)
This commit is contained in:
Bram Moolenaar
2020-07-19 15:49:49 +02:00
parent 75783bd84e
commit 6802cce407
3 changed files with 33 additions and 11 deletions

View File

@@ -1115,7 +1115,7 @@ def Test_expr7_list()
call CheckDefExecFailure(["let x = g:anint[3]"], 'E714:')
call CheckDefFailure(["let x = g:list_mixed[xxx]"], 'E1001:')
call CheckDefFailure(["let x = [1,2,3]"], 'E1069:')
call CheckDefExecFailure(["let x = g:list_mixed['xx']"], 'E39:')
call CheckDefExecFailure(["let x = g:list_mixed['xx']"], 'E1029:')
call CheckDefFailure(["let x = g:list_mixed["], 'E1097:')
call CheckDefFailure(["let x = g:list_mixed[0"], 'E1097:')
call CheckDefExecFailure(["let x = g:list_empty[3]"], 'E684:')
@@ -1173,6 +1173,9 @@ def Test_expr7_lambda()
})
assert_equal([111, 222, 111], ll)
let dl = [{'key': 0}, {'key': 22}]->filter({ _, v -> v['key'] })
assert_equal([{'key': 22}], dl)
call CheckDefFailure(["filter([1, 2], {k,v -> 1})"], 'E1069:')
enddef