Patch 8.2.3118
Problem: Vim9: "any" type not handled correctly in for loop.
Solution: Change compile time check into runtime check. (closes #8516)
Files: src/vim9compile.c, src/testdir/test_vim9_script.vim
*** ../vim-8.2.3117/src/vim9compile.c 2021-07-07 21:21:27.121414079 +0200
--- src/vim9compile.c 2021-07-07 21:49:01.539025376 +0200
***************
*** 7932,7938 ****
if (lhs_type == &t_any)
lhs_type = item_type;
else if (item_type != &t_unknown
! && ((var_list && item_type == &t_any)
? need_type(item_type, lhs_type,
-1, 0, cctx, FALSE, FALSE)
: check_type(lhs_type, item_type, TRUE, where))
--- 7932,7938 ----
if (lhs_type == &t_any)
lhs_type = item_type;
else if (item_type != &t_unknown
! && (item_type == &t_any
? need_type(item_type, lhs_type,
-1, 0, cctx, FALSE, FALSE)
: check_type(lhs_type, item_type, TRUE, where))
*** ../vim-8.2.3117/src/testdir/test_vim9_script.vim 2021-07-07 21:21:27.121414079 +0200
--- src/testdir/test_vim9_script.vim 2021-07-07 21:53:21.330616360 +0200
***************
*** 2488,2493 ****
--- 2488,2499 ----
endfor
assert_equal('foobar', chars)
+ chars = ''
+ for x: string in {a: 'a', b: 'b'}->values()
+ chars ..= x
+ endfor
+ assert_equal('ab', chars)
+
# unpack with type
var res = ''
for [n: number, s: string] in [[1, 'a'], [2, 'b']]
*** ../vim-8.2.3117/src/version.c 2021-07-07 21:21:27.121414079 +0200
--- src/version.c 2021-07-07 21:51:13.594818000 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3118,
/**/
--
From "know your smileys":
[:-) Frankenstein's monster
/// 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 ///