Patch 8.2.1142
Problem: Vim9: return type of insert() is any.
Solution: Use type of the first argument.
Files: src/evalfunc.c, src/testdir/test_vim9_func.vim
*** ../vim-8.2.1141/src/evalfunc.c 2020-07-05 20:16:38.042444749 +0200
--- src/evalfunc.c 2020-07-05 20:44:06.836125124 +0200
***************
*** 667,673 ****
{"inputrestore", 0, 0, 0, ret_number, f_inputrestore},
{"inputsave", 0, 0, 0, ret_number, f_inputsave},
{"inputsecret", 1, 2, FEARG_1, ret_string, f_inputsecret},
! {"insert", 2, 3, FEARG_1, ret_any, f_insert},
{"interrupt", 0, 0, 0, ret_void, f_interrupt},
{"invert", 1, 1, FEARG_1, ret_number, f_invert},
{"isdirectory", 1, 1, FEARG_1, ret_number, f_isdirectory},
--- 667,673 ----
{"inputrestore", 0, 0, 0, ret_number, f_inputrestore},
{"inputsave", 0, 0, 0, ret_number, f_inputsave},
{"inputsecret", 1, 2, FEARG_1, ret_string, f_inputsecret},
! {"insert", 2, 3, FEARG_1, ret_first_arg, f_insert},
{"interrupt", 0, 0, 0, ret_void, f_interrupt},
{"invert", 1, 1, FEARG_1, ret_number, f_invert},
{"isdirectory", 1, 1, FEARG_1, ret_number, f_isdirectory},
*** ../vim-8.2.1141/src/testdir/test_vim9_func.vim 2020-07-05
20:16:38.046444737 +0200
--- src/testdir/test_vim9_func.vim 2020-07-05 20:45:24.143752915 +0200
***************
*** 918,923 ****
--- 918,932 ----
assert_equal(6, res)
enddef
+ def Test_insert_return_type()
+ let l = insert([2, 1], 3)
+ let res = 0
+ for n in l
+ res += n
+ endfor
+ assert_equal(6, res)
+ enddef
+
def Test_filter_return_type()
let l = filter([1, 2, 3], {-> 1})
let res = 0
*** ../vim-8.2.1141/src/version.c 2020-07-05 20:16:38.046444737 +0200
--- src/version.c 2020-07-05 20:45:56.971598347 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 1142,
/**/
--
Team-building exercises come in many forms but they all trace their roots back
to the prison system. In your typical team-building exercise the employees
are subjected to a variety of unpleasant situations until they become either a
cohesive team or a ring of car jackers.
(Scott Adams - The Dilbert principle)
/// Bram Moolenaar -- [email protected] -- 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 ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202007051847.065Ilh4I647519%40masaka.moolenaar.net.