Patch 8.2.4313
Problem: Vim9: cannot change type of list after making a slice.
Solution: Adjust the declared member type. (closes #9696)
Files: src/vim9expr.c, src/testdir/test_vim9_builtin.vim
*** ../vim-8.2.4312/src/vim9expr.c 2022-02-04 21:17:54.412950056 +0000
--- src/vim9expr.c 2022-02-06 18:10:34.899360474 +0000
***************
*** 182,187 ****
--- 182,190 ----
vartype == VAR_LIST ? ISN_LISTSLICE : ISN_ANYSLICE,
2) == FAIL)
return FAIL;
+ // a copy is made so the member type is no longer declared
+ if (typep->type_decl->tt_type == VAR_LIST)
+ typep->type_decl = &t_list_any;
}
else
{
*** ../vim-8.2.4312/src/testdir/test_vim9_builtin.vim 2022-02-06 15:49:32.377256545 +0000
--- src/testdir/test_vim9_builtin.vim 2022-02-06 18:09:59.055386712 +0000
***************
*** 3626,3631 ****
--- 3626,3632 ----
var lds: list<dict<string>> = [{key: 'value'}]
assert_equal(['val'], lds->slice(0, 1)->map((_, v) => 'val'))
+ assert_equal(['val'], lds[ : ]->map((_, v) => 'val'))
assert_equal(0z1122334455, slice(0z001122334455, 1))
assert_equal(0z112233, slice(0z001122334455, 1, 4))
*** ../vim-8.2.4312/src/version.c 2022-02-06 17:30:37.697660685 +0000
--- src/version.c 2022-02-06 18:12:45.019258126 +0000
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 4313,
/**/
--
hundred-and-one symptoms of being an internet addict:
15. Your heart races faster and beats irregularly each time you see a new WWW
site address in print or on TV, even though you've never had heart
problems before.
/// Bram Moolenaar -- Br...@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 ///