diff src/testdir/test_vim9_expr.vim @ 21411:e1aeb986712f v8.2.1256

patch 8.2.1256: Vim9: type wrong after getting dict item in lambda Commit: https://github.com/vim/vim/commit/7892b953e0e496408008434ae3505293c0c93af1 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jul 20 22:09:34 2020 +0200 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 https://github.com/vim/vim/issues/6491)
author Bram Moolenaar <Bram@vim.org>
date Mon, 20 Jul 2020 22:15:04 +0200
parents 5cb6e676defd
children 0f0fee4122d3
line wrap: on
line diff
--- a/src/testdir/test_vim9_expr.vim
+++ b/src/testdir/test_vim9_expr.vim
@@ -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