diff src/testdir/test_vim9_func.vim @ 21301:60011b87aae1 v8.2.1201

patch 8.2.1201: Vim9: crash when passing number as dict key Commit: https://github.com/vim/vim/commit/f1a2368d81fc3f70dfcf7d577957185da6ccf0b6 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jul 13 18:55:48 2020 +0200 patch 8.2.1201: Vim9: crash when passing number as dict key Problem: Vim9: crash when passing number as dict key. Solution: Check key type to be string. (closes https://github.com/vim/vim/issues/6449)
author Bram Moolenaar <Bram@vim.org>
date Mon, 13 Jul 2020 19:00:04 +0200
parents 13b1567ae0c6
children 7c50dfe302f8
line wrap: on
line diff
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -954,6 +954,14 @@ def Test_filter_return_type()
   assert_equal(6, res)
 enddef
 
+def Wrong_dict_key_type(items: list<number>): list<number>
+  return filter(items, {_, val -> get({val: 1}, 'x')})
+enddef
+
+def Test_wrong_dict_key_type()
+  assert_fails('Wrong_dict_key_type([1, 2, 3])', 'E1029:')
+enddef
+
 def Line_continuation_in_def(dir: string = ''): string
     let path: string = empty(dir)
             \ ? 'empty'