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

patch 8.2.1256: Vim9: type wrong after getting dict item in lambda

Problem:    Vim9: type wrong after getting dict item in lambda.
Solution:   Set the type to "any" after enforcing dict type. (closes #6491)
This commit is contained in:
Bram Moolenaar
2020-07-20 22:09:34 +02:00
parent d43906d2e5
commit 7892b953e0
3 changed files with 12 additions and 3 deletions

View File

@@ -1176,6 +1176,10 @@ def Test_expr7_lambda()
let dl = [{'key': 0}, {'key': 22}]->filter({ _, v -> v['key'] })
assert_equal([{'key': 22}], dl)
dl = [{'key': 12}, {'foo': 34}]
assert_equal([{'key': 12}], filter(dl,
{_, v -> has_key(v, 'key') ? v['key'] == 12 : 0}))
call CheckDefFailure(["filter([1, 2], {k,v -> 1})"], 'E1069:')
enddef