To: vim_dev@googlegroups.com Subject: Patch 8.2.1133 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1133 Problem: Vim9: return type of add() is not specific enough. Solution: Return the type of the first argument. (closes #6395) Files: src/evalfunc.c, src/testdir/test_vim9_func.vim *** ../vim-8.2.1132/src/evalfunc.c 2020-07-05 16:01:52.709392389 +0200 --- src/evalfunc.c 2020-07-05 16:06:17.973094738 +0200 *************** *** 441,447 **** { {"abs", 1, 1, FEARG_1, ret_any, FLOAT_FUNC(f_abs)}, {"acos", 1, 1, FEARG_1, ret_float, FLOAT_FUNC(f_acos)}, ! {"add", 2, 2, FEARG_1, ret_any, f_add}, {"and", 2, 2, FEARG_1, ret_number, f_and}, {"append", 2, 2, FEARG_LAST, ret_number, f_append}, {"appendbufline", 3, 3, FEARG_LAST, ret_number, f_appendbufline}, --- 441,447 ---- { {"abs", 1, 1, FEARG_1, ret_any, FLOAT_FUNC(f_abs)}, {"acos", 1, 1, FEARG_1, ret_float, FLOAT_FUNC(f_acos)}, ! {"add", 2, 2, FEARG_1, ret_first_arg, f_add}, {"and", 2, 2, FEARG_1, ret_number, f_and}, {"append", 2, 2, FEARG_LAST, ret_number, f_append}, {"appendbufline", 3, 3, FEARG_LAST, ret_number, f_appendbufline}, *** ../vim-8.2.1132/src/testdir/test_vim9_func.vim 2020-07-05 16:01:52.709392389 +0200 --- src/testdir/test_vim9_func.vim 2020-07-05 16:05:55.529082326 +0200 *************** *** 602,607 **** --- 602,613 ---- res += n endfor assert_equal(3, res) + + res = 0 + for n in add([1, 2], 3) + res += n + endfor + assert_equal(6, res) enddef def Test_func_type_part() *** ../vim-8.2.1132/src/version.c 2020-07-05 16:01:52.709392389 +0200 --- src/version.c 2020-07-05 16:06:49.941106707 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1133, /**/ -- BEDEVERE: Wait. Wait ... tell me, what also floats on water? ALL: Bread? No, no, no. Apples .... gravy ... very small rocks ... ARTHUR: A duck. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// 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 ///