diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-07-11 14:55:49 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-07-11 14:55:49 +0200 |
commit | 1aeddeb8bd29a69fa118734c7f27d7df1b37801f (patch) | |
tree | b579bb8065f2e57b074529aacb1cac1e7a7b1d84 /src/testdir | |
parent | de69a7353e9bec552e15dbe3706a9f4e88080fce (diff) |
patch 8.2.3142: Vim9: type check for has_key() argument is too strictv8.2.3142
Problem: Vim9: type check for has_key() argument is too strict.
Solution: Also allow for a number key argument. (closes #8542)
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_vim9_builtin.vim | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim index 6b6278b8d0..5bc51b11ca 100644 --- a/src/testdir/test_vim9_builtin.vim +++ b/src/testdir/test_vim9_builtin.vim @@ -1131,6 +1131,12 @@ def Test_has() enddef def Test_has_key() + var d = {123: 'xx'} + assert_true(has_key(d, '123')) + assert_true(has_key(d, 123)) + assert_false(has_key(d, 'x')) + assert_false(has_key(d, 99)) + CheckDefAndScriptFailure2(['has_key([1, 2], "k")'], 'E1013: Argument 1: type mismatch, expected dict<any> but got list<number>', 'E715: Dictionary required') CheckDefAndScriptFailure2(['has_key({"a": 10}, ["a"])'], 'E1013: Argument 2: type mismatch, expected string but got list<string>', 'E730: Using a List as a String') enddef |