0
0
mirror of https://github.com/vim/vim.git synced 2025-10-03 05:14:07 -04:00

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 #6449)
This commit is contained in:
Bram Moolenaar
2020-07-13 18:55:48 +02:00
parent bfd65589d9
commit f1a2368d81
3 changed files with 18 additions and 1 deletions

View File

@@ -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'