]> granicus.if.org Git - vim/commitdiff
patch 8.2.1447: Vim9: return type of keys() is list<any> v8.2.1447
authorBram Moolenaar <Bram@vim.org>
Fri, 14 Aug 2020 16:56:45 +0000 (18:56 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 14 Aug 2020 16:56:45 +0000 (18:56 +0200)
Problem:    Vim9: return type of keys() is list<any>.
Solution:   Should be list<string>. (closes #6711)

src/evalfunc.c
src/testdir/test_vim9_func.vim
src/version.c

index d95a1db8201b3c958da6667f0569dd498b3d550c..ff814622a88a890c61860671c560712040dd843b 100644 (file)
@@ -715,7 +715,7 @@ static funcentry_T global_functions[] =
     {"js_encode",      1, 1, FEARG_1,    ret_string,   f_js_encode},
     {"json_decode",    1, 1, FEARG_1,    ret_any,      f_json_decode},
     {"json_encode",    1, 1, FEARG_1,    ret_string,   f_json_encode},
-    {"keys",           1, 1, FEARG_1,    ret_list_any, f_keys},
+    {"keys",           1, 1, FEARG_1,    ret_list_string, f_keys},
     {"last_buffer_nr", 0, 0, 0,          ret_number,   f_last_buffer_nr}, // obsolete
     {"len",            1, 1, FEARG_1,    ret_number,   f_len},
     {"libcall",                3, 3, FEARG_3,    ret_string,   f_libcall},
index 3e7212094681857ff7b79a92c442b22888be21f4..75db260ce9629de6b62278dd014375a91e8ffde1 100644 (file)
@@ -1283,6 +1283,11 @@ def Test_insert_return_type()
   assert_equal(6, res)
 enddef
 
+def Test_keys_return_type()
+  const var: list<string> = #{a: 1, b: 2}->keys()
+  assert_equal(['a', 'b'], var)
+enddef
+
 def Test_reverse_return_type()
   let l = reverse([1, 2, 3])
   let res = 0
index a8a1d49d571c42453ffbb86d9c0989c54cc05c62..11dd39654613bd8629c0b3a5b8094880bfc119c7 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1447,
 /**/
     1446,
 /**/