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 -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ 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/20220206183728.26AD21C071D%40moolenaar.net.