patch 8.2.2455: Vim9: key type for literal dict and indexing is inconsistent
Problem: Vim9: key type that can be used for literal dict and indexing is
inconsistent.
Solution: Allow using number and bool as key for a literal dict. (#7771)
diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim
index 5e678fa..06839c0 100644
--- a/src/testdir/test_vim9_builtin.vim
+++ b/src/testdir/test_vim9_builtin.vim
@@ -350,10 +350,6 @@
endif
enddef
-def Wrong_dict_key_type(items: list<number>): list<number>
- return filter(items, (_, val) => get({[val]: 1}, 'x'))
-enddef
-
def Test_filereadable()
assert_false(filereadable(""))
assert_false(filereadable(test_null_string()))
@@ -410,8 +406,12 @@
CheckDefExecFailure(['echo fnamemodify("file", true)'], 'E928:')
enddef
+def Wrong_dict_key_type(items: list<number>): list<number>
+ return filter(items, (_, val) => get({[val]: 1}, 'x'))
+enddef
+
def Test_filter_wrong_dict_key_type()
- assert_fails('Wrong_dict_key_type([1, 2, 3])', 'E1012:')
+ assert_fails('Wrong_dict_key_type([1, v:null, 3])', 'E1013:')
enddef
def Test_filter_return_type()