Skip to content

Commit 32f335f

Browse files
committed
patch 8.2.1447: Vim9: return type of keys() is list<any>
Problem: Vim9: return type of keys() is list<any>. Solution: Should be list<string>. (closes #6711)
1 parent 7517ffd commit 32f335f

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/evalfunc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ static funcentry_T global_functions[] =
715715
{"js_encode", 1, 1, FEARG_1, ret_string, f_js_encode},
716716
{"json_decode", 1, 1, FEARG_1, ret_any, f_json_decode},
717717
{"json_encode", 1, 1, FEARG_1, ret_string, f_json_encode},
718-
{"keys", 1, 1, FEARG_1, ret_list_any, f_keys},
718+
{"keys", 1, 1, FEARG_1, ret_list_string, f_keys},
719719
{"last_buffer_nr", 0, 0, 0, ret_number, f_last_buffer_nr}, // obsolete
720720
{"len", 1, 1, FEARG_1, ret_number, f_len},
721721
{"libcall", 3, 3, FEARG_3, ret_string, f_libcall},

src/testdir/test_vim9_func.vim

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,6 +1283,11 @@ def Test_insert_return_type()
12831283
assert_equal(6, res)
12841284
enddef
12851285

1286+
def Test_keys_return_type()
1287+
const var: list<string> = #{a: 1, b: 2}->keys()
1288+
assert_equal(['a', 'b'], var)
1289+
enddef
1290+
12861291
def Test_reverse_return_type()
12871292
let l = reverse([1, 2, 3])
12881293
let res = 0

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,8 @@ static char *(features[]) =
754754

755755
static int included_patches[] =
756756
{ /* Add new patch number below this line */
757+
/**/
758+
1447,
757759
/**/
758760
1446,
759761
/**/

0 commit comments

Comments
 (0)