To: vim_dev@googlegroups.com Subject: Patch 8.2.4927 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4927 Problem: Return type of remove() incorrect when using three arguments. Solution: Use first argument type when there are three arguments. (closes #10387) Files: src/evalfunc.c, src/testdir/test_vim9_builtin.vim *** ../vim-8.2.4926/src/evalfunc.c 2022-05-07 21:14:01.642973330 +0100 --- src/evalfunc.c 2022-05-09 14:04:59.872704981 +0100 *************** *** 1420,1432 **** static type_T * ret_remove(int argcount, type2_T *argtypes, ! type_T **decl_type UNUSED) { if (argcount > 0) { if (argtypes[0].type_curr->tt_type == VAR_LIST || argtypes[0].type_curr->tt_type == VAR_DICT) { if (argtypes[0].type_curr->tt_type == argtypes[0].type_decl->tt_type) *decl_type = argtypes[0].type_decl->tt_member; --- 1420,1437 ---- static type_T * ret_remove(int argcount, type2_T *argtypes, ! type_T **decl_type) { if (argcount > 0) { if (argtypes[0].type_curr->tt_type == VAR_LIST || argtypes[0].type_curr->tt_type == VAR_DICT) { + if (argcount == 3) + { + *decl_type = argtypes[0].type_decl; + return argtypes[0].type_curr; + } if (argtypes[0].type_curr->tt_type == argtypes[0].type_decl->tt_type) *decl_type = argtypes[0].type_decl->tt_member; *** ../vim-8.2.4926/src/testdir/test_vim9_builtin.vim 2022-05-06 17:53:02.685329543 +0100 --- src/testdir/test_vim9_builtin.vim 2022-05-09 14:11:17.888425121 +0100 *************** *** 3208,3219 **** enddef def Test_remove_return_type() ! var l = remove({one: [1, 2], two: [3, 4]}, 'one') ! var res = 0 ! for n in l ! res += n ! endfor ! res->assert_equal(3) enddef def Test_rename() --- 3208,3218 ---- enddef def Test_remove_return_type() ! var l: list = remove({one: [1, 2], two: [3, 4]}, 'one') ! l->assert_equal([1, 2]) ! ! var ll: list = remove(range(3), 0, 1) ! ll->assert_equal([0, 1]) enddef def Test_rename() *** ../vim-8.2.4926/src/version.c 2022-05-09 13:33:36.054167847 +0100 --- src/version.c 2022-05-09 14:06:22.408643002 +0100 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 4927, /**/ -- You are not really successful until someone claims he sat beside you in school. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///