From 4058f95d9dc9a58ab80f982c91b85ec1363c89c8 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 12 Jun 2023 16:15:12 +0800 Subject: vim-patch:partial:8.2.3335: Vim9: not enough tests run with Vim9 Problem: Vim9: not enough tests run with Vim9. Solution: Run a few more tests in Vim9 script and :def function. Fix that items(), keys() and values9) return zero for a NULL dict. Make join() return an empty string for a NULL list. Make sort() return an empty list for a NULL list. https://github.com/vim/vim/commit/ef98257593a0abf1300d0f70358dc45a70a62580 Skip f_reverse() change for consistency with other functions. Skip Test_null_list() and Test_null_dict() because of missing patches. Co-authored-by: Bram Moolenaar --- src/nvim/eval/typval.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index 9e697d6144..ec227a6b1a 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -3019,12 +3019,13 @@ static void tv_dict_list(typval_T *const tv, typval_T *const rettv, const DictLi emsg(_(e_dictreq)); return; } + + tv_list_alloc_ret(rettv, tv_dict_len(tv->vval.v_dict)); if (tv->vval.v_dict == NULL) { + // NULL dict behaves like an empty dict return; } - tv_list_alloc_ret(rettv, tv_dict_len(tv->vval.v_dict)); - TV_DICT_ITER(tv->vval.v_dict, di, { typval_T tv_item = { .v_lock = VAR_UNLOCKED }; -- cgit