comparison 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
comparison
equal deleted inserted replaced
21410:4fde350c969a 21411:e1aeb986712f
1174 assert_equal([111, 222, 111], ll) 1174 assert_equal([111, 222, 111], ll)
1175 1175
1176 let dl = [{'key': 0}, {'key': 22}]->filter({ _, v -> v['key'] }) 1176 let dl = [{'key': 0}, {'key': 22}]->filter({ _, v -> v['key'] })
1177 assert_equal([{'key': 22}], dl) 1177 assert_equal([{'key': 22}], dl)
1178 1178
1179 dl = [{'key': 12}, {'foo': 34}]
1180 assert_equal([{'key': 12}], filter(dl,
1181 {_, v -> has_key(v, 'key') ? v['key'] == 12 : 0}))
1182
1179 call CheckDefFailure(["filter([1, 2], {k,v -> 1})"], 'E1069:') 1183 call CheckDefFailure(["filter([1, 2], {k,v -> 1})"], 'E1069:')
1180 enddef 1184 enddef
1181 1185
1182 def Test_expr7_lambda_vim9script() 1186 def Test_expr7_lambda_vim9script()
1183 let lines =<< trim END 1187 let lines =<< trim END