From 1918e1ea6d0192712e0a03926e2965a7aac0955e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 17 Aug 2023 16:22:11 +0800 Subject: vim-patch:9.0.0359: error message for wrong argument type is not specific Problem: Error message for wrong argument type is not specific. Solution: Include more information in the error. (Yegappan Lakshmanan, closes vim/vim#11037) https://github.com/vim/vim/commit/8deb2b30c77035bb682ccf80b781455ac1d6038b Cherry-pick test_listdict.vim changes from patch 8.2.4809. Co-authored-by: Yegappan Lakshmanan --- test/old/testdir/test_listdict.vim | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/old/testdir/test_listdict.vim b/test/old/testdir/test_listdict.vim index f2b4747ff2..e82ea60d81 100644 --- a/test/old/testdir/test_listdict.vim +++ b/test/old/testdir/test_listdict.vim @@ -526,7 +526,7 @@ func Test_dict_deepcopy() END call CheckLegacyAndVim9Success(lines) - call assert_fails("call deepcopy([1, 2], 2)", 'E1023:') + call assert_fails("call deepcopy([1, 2], 2)", 'E1212:') endfunc " Locked variables @@ -952,25 +952,26 @@ func Test_reduce() call assert_fails("call reduce([], { acc, val -> acc + val })", 'E998: Reduce of an empty List with no initial value') call assert_fails("call reduce(0z, { acc, val -> acc + val })", 'E998: Reduce of an empty Blob with no initial value') + call assert_fails("call reduce(v:_null_blob, { acc, val -> acc + val })", 'E998: Reduce of an empty Blob with no initial value') call assert_fails("call reduce('', { acc, val -> acc + val })", 'E998: Reduce of an empty String with no initial value') call assert_fails("call reduce(v:_null_string, { acc, val -> acc + val })", 'E998: Reduce of an empty String with no initial value') call assert_fails("call reduce({}, { acc, val -> acc + val }, 1)", 'E1098:') call assert_fails("call reduce(0, { acc, val -> acc + val }, 1)", 'E1098:') call assert_fails("call reduce([1, 2], 'Xdoes_not_exist')", 'E117:') - call assert_fails("echo reduce(0z01, { acc, val -> 2 * acc + val }, '')", 'E39:') + call assert_fails("echo reduce(0z01, { acc, val -> 2 * acc + val }, '')", 'E1210:') " call assert_fails("vim9 reduce(0, (acc, val) => (acc .. val), '')", 'E1252:') " call assert_fails("vim9 reduce({}, (acc, val) => (acc .. val), '')", 'E1252:') " call assert_fails("vim9 reduce(0.1, (acc, val) => (acc .. val), '')", 'E1252:') " call assert_fails("vim9 reduce(function('tr'), (acc, val) => (acc .. val), '')", 'E1252:') - call assert_fails("call reduce('', { acc, val -> acc + val }, 1)", 'E1253:') - call assert_fails("call reduce('', { acc, val -> acc + val }, {})", 'E1253:') - call assert_fails("call reduce('', { acc, val -> acc + val }, 0.1)", 'E1253:') - call assert_fails("call reduce('', { acc, val -> acc + val }, function('tr'))", 'E1253:') + call assert_fails("call reduce('', { acc, val -> acc + val }, 1)", 'E1174:') + call assert_fails("call reduce('', { acc, val -> acc + val }, {})", 'E1174:') + call assert_fails("call reduce('', { acc, val -> acc + val }, 0.1)", 'E1174:') + call assert_fails("call reduce('', { acc, val -> acc + val }, function('tr'))", 'E1174:') call assert_fails("call reduce('abc', { a, v -> a10}, '')", 'E121:') - call assert_fails("call reduce(0z01, { a, v -> a10}, 1)", 'E121:') - call assert_fails("call reduce([1], { a, v -> a10}, '')", 'E121:') + call assert_fails("call reduce(0z0102, { a, v -> a10}, 1)", 'E121:') + call assert_fails("call reduce([1, 2], { a, v -> a10}, '')", 'E121:') let g:lut = [1, 2, 3, 4] func EvilRemove() -- cgit From 1ed12a2e10708f0d4ce39e5adb94d189455f4d98 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 17 Aug 2023 16:17:22 +0800 Subject: vim-patch:9.0.0548: reduce() with a compiled lambda could be faster Problem: reduce() with a compiled lambda could be faster. Solution: Call eval_expr_typval() instead of call_func() directly. https://github.com/vim/vim/commit/f1c60d4bf10794265b828afd9c5f7eddacada10b Co-authored-by: Bram Moolenaar --- test/old/testdir/test_listdict.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/old/testdir/test_listdict.vim b/test/old/testdir/test_listdict.vim index e82ea60d81..abb7f88a7b 100644 --- a/test/old/testdir/test_listdict.vim +++ b/test/old/testdir/test_listdict.vim @@ -958,7 +958,7 @@ func Test_reduce() call assert_fails("call reduce({}, { acc, val -> acc + val }, 1)", 'E1098:') call assert_fails("call reduce(0, { acc, val -> acc + val }, 1)", 'E1098:') - call assert_fails("call reduce([1, 2], 'Xdoes_not_exist')", 'E117:') + call assert_fails("call reduce([1, 2], 'Xdoes_not_exist')", 'E121:') call assert_fails("echo reduce(0z01, { acc, val -> 2 * acc + val }, '')", 'E1210:') " call assert_fails("vim9 reduce(0, (acc, val) => (acc .. val), '')", 'E1252:') -- cgit From 8ac9abd4fad5837c2cc7a858827efb2e53b852be Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 17 Aug 2023 16:58:05 +0800 Subject: vim-patch:9.0.1416: crash when collection is modified when using filter() Problem: Crash when collection is modified when using filter(). Solution: Lock the list/dict/blob. (Ernie Rael, closes vim/vim#12183) https://github.com/vim/vim/commit/e6d40dcdc7227594935d2db01eca29f0e575dcee Co-authored-by: Ernie Rael --- test/old/testdir/test_filter_map.vim | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test') diff --git a/test/old/testdir/test_filter_map.vim b/test/old/testdir/test_filter_map.vim index 3040b7b0d0..7658797759 100644 --- a/test/old/testdir/test_filter_map.vim +++ b/test/old/testdir/test_filter_map.vim @@ -109,6 +109,21 @@ func Test_map_and_modify() let d = #{a: 1, b: 2, c: 3} call assert_fails('call map(d, "remove(d, v:key)[0]")', 'E741:') call assert_fails('echo map(d, {k,v -> remove(d, k)})', 'E741:') + + let b = 0z1234 + call assert_fails('call filter(b, "remove(b, 0)")', 'E741:') +endfunc + +func Test_filter_and_modify() + let l = [0] + " cannot change the list halfway a map() + call assert_fails('call filter(l, "remove(l, 0)")', 'E741:') + + let d = #{a: 0, b: 0, c: 0} + call assert_fails('call filter(d, "remove(d, v:key)")', 'E741:') + + let b = 0z1234 + call assert_fails('call filter(b, "remove(b, 0)")', 'E741:') endfunc func Test_mapnew_dict() -- cgit