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 -- [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/202107071955.167Jtx6k3432706%40masaka.moolenaar.net.

Raspunde prin e-mail lui