Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
21300:59c9cfed9270 | 21301:60011b87aae1 |
---|---|
952 res += n | 952 res += n |
953 endfor | 953 endfor |
954 assert_equal(6, res) | 954 assert_equal(6, res) |
955 enddef | 955 enddef |
956 | 956 |
957 def Wrong_dict_key_type(items: list<number>): list<number> | |
958 return filter(items, {_, val -> get({val: 1}, 'x')}) | |
959 enddef | |
960 | |
961 def Test_wrong_dict_key_type() | |
962 assert_fails('Wrong_dict_key_type([1, 2, 3])', 'E1029:') | |
963 enddef | |
964 | |
957 def Line_continuation_in_def(dir: string = ''): string | 965 def Line_continuation_in_def(dir: string = ''): string |
958 let path: string = empty(dir) | 966 let path: string = empty(dir) |
959 \ ? 'empty' | 967 \ ? 'empty' |
960 \ : 'full' | 968 \ : 'full' |
961 return path | 969 return path |