To: vim_dev@googlegroups.com Subject: Patch 8.2.1138 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1138 Problem: Vim9: return type of copy() and deepcopy() is any. Solution: Use type of the argument. Files: src/evalfunc.c, src/testdir/test_vim9_func.vim *** ../vim-8.2.1137/src/evalfunc.c 2020-07-05 17:04:10.439768864 +0200 --- src/evalfunc.c 2020-07-05 18:38:29.680613791 +0200 *************** *** 544,550 **** {"complete_check", 0, 0, 0, ret_number, f_complete_check}, {"complete_info", 0, 1, FEARG_1, ret_dict_any, f_complete_info}, {"confirm", 1, 4, FEARG_1, ret_number, f_confirm}, ! {"copy", 1, 1, FEARG_1, ret_any, f_copy}, {"cos", 1, 1, FEARG_1, ret_float, FLOAT_FUNC(f_cos)}, {"cosh", 1, 1, FEARG_1, ret_float, FLOAT_FUNC(f_cosh)}, {"count", 2, 4, FEARG_1, ret_number, f_count}, --- 544,550 ---- {"complete_check", 0, 0, 0, ret_number, f_complete_check}, {"complete_info", 0, 1, FEARG_1, ret_dict_any, f_complete_info}, {"confirm", 1, 4, FEARG_1, ret_number, f_confirm}, ! {"copy", 1, 1, FEARG_1, ret_first_arg, f_copy}, {"cos", 1, 1, FEARG_1, ret_float, FLOAT_FUNC(f_cos)}, {"cosh", 1, 1, FEARG_1, ret_float, FLOAT_FUNC(f_cosh)}, {"count", 2, 4, FEARG_1, ret_number, f_count}, *************** *** 557,563 **** NULL #endif }, ! {"deepcopy", 1, 2, FEARG_1, ret_any, f_deepcopy}, {"delete", 1, 2, FEARG_1, ret_number, f_delete}, {"deletebufline", 2, 3, FEARG_1, ret_number, f_deletebufline}, {"did_filetype", 0, 0, 0, ret_number, f_did_filetype}, --- 557,563 ---- NULL #endif }, ! {"deepcopy", 1, 2, FEARG_1, ret_first_arg, f_deepcopy}, {"delete", 1, 2, FEARG_1, ret_number, f_delete}, {"deletebufline", 2, 3, FEARG_1, ret_number, f_deletebufline}, {"did_filetype", 0, 0, 0, ret_number, f_did_filetype}, *** ../vim-8.2.1137/src/testdir/test_vim9_func.vim 2020-07-05 18:18:24.342937456 +0200 --- src/testdir/test_vim9_func.vim 2020-07-05 18:39:14.644399765 +0200 *************** *** 893,898 **** --- 893,914 ---- assert_equal(#{items: []}, d) enddef + def Test_copy_return_type() + let l = copy([1, 2, 3]) + let res = 0 + for n in l + res += n + endfor + assert_equal(6, res) + + let dl = deepcopy([1, 2, 3]) + res = 0 + for n in dl + res += n + endfor + assert_equal(6, res) + enddef + def Line_continuation_in_def(dir: string = ''): string let path: string = empty(dir) \ ? 'empty' *** ../vim-8.2.1137/src/version.c 2020-07-05 18:18:24.346937441 +0200 --- src/version.c 2020-07-05 18:38:07.288720729 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1138, /**/ -- The word "leader" is derived from the word "lead", as in the material that bullets are made out of. The term "leader" was popularized at about the same time as the invention of firearms. It grew out of the observation that the person in charge of every organization was the person whom everyone wanted to fill with hot lead. I don't recomment this; it's just a point of historical interest. (Scott Adams - The Dilbert principle) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///