From aa92a04beeed1fb10a82edd6a245e5783cd771c1 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 12 Jun 2023 20:35:01 +0800 Subject: vim-patch:8.2.3332: Vim9: cannot assign to range in list Problem: Vim9: cannot assign to range in list. Solution: Implement overwriting a list range. https://github.com/vim/vim/commit/4f0884d6e24d1d45ec83fd86b372b403177d3298 Co-authored-by: Bram Moolenaar --- test/old/testdir/test_listdict.vim | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'test/old') diff --git a/test/old/testdir/test_listdict.vim b/test/old/testdir/test_listdict.vim index 07a365d337..d31d17f81a 100644 --- a/test/old/testdir/test_listdict.vim +++ b/test/old/testdir/test_listdict.vim @@ -178,11 +178,14 @@ endfunc " test for range assign func Test_list_range_assign() - let l = [0] - let l[:] = [1, 2] - call assert_equal([1, 2], l) - let l[-4:-1] = [5, 6] - call assert_equal([5, 6], l) + let lines =<< trim END + VAR l = [0] + LET l[:] = [1, 2] + call assert_equal([1, 2], l) + LET l[-4 : -1] = [5, 6] + call assert_equal([5, 6], l) + END + call CheckLegacyAndVim9Success(lines) endfunc " Test removing items in list -- cgit From d86acfa149c0d91d4880dd124039f3fc983ebe4c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 12 Jun 2023 21:05:36 +0800 Subject: vim-patch:8.2.3338: Vim9: no type check when assigning a list range Problem: Vim9: no type check when assigning a list range. (Naohiro Ono) Solution: Check the member type. (closes vim/vim#8750) https://github.com/vim/vim/commit/89071cb6a116a74f78f77a1853e6fada44872a15 Co-authored-by: Bram Moolenaar --- test/old/testdir/test_listdict.vim | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/old') diff --git a/test/old/testdir/test_listdict.vim b/test/old/testdir/test_listdict.vim index d31d17f81a..1fc0c1e7d4 100644 --- a/test/old/testdir/test_listdict.vim +++ b/test/old/testdir/test_listdict.vim @@ -186,6 +186,12 @@ func Test_list_range_assign() call assert_equal([5, 6], l) END call CheckLegacyAndVim9Success(lines) + + let lines =<< trim END + var l = [7] + l[:] = ['text'] + END + call CheckDefAndScriptFailure(lines, 'E1012:', 2) endfunc " Test removing items in list -- cgit