From 7ac63906eae92b5d31fc7e380ef05b8bce73ad8b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 4 May 2023 14:15:54 +0800 Subject: vim-patch:8.2.1466: Vim9: cannot index or slice a variable with type "any" Problem: Vim9: cannot index or slice a variable with type "any". Solution: Add runtime index and slice. https://github.com/vim/vim/commit/cc673e746ab98566556ff964d7a76f2fb46d7f84 Omit E1024 and E1062: Vim9 script only. Omit string_slice() and char_idx2byte(): Vim9 script only. Remove the first tv_is_luafunc() check because it always returns false. Co-authored-by: Bram Moolenaar --- src/nvim/eval/typval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/eval') diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index ba1d60959a..8028688ac8 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -795,7 +795,7 @@ int tv_list_slice_or_index(list_T *list, bool range, int n1_arg, int n2_arg, typ } return FAIL; } - n1 = len; + n1 = n1 < 0 ? 0 : len; } if (range) { if (n2 < 0) { -- cgit