Patch 8.2.1686
Problem:    Vim9: "const!" not sufficiently tested.
Solution:   Add a few more test cases.  Fix type checking.
Files:      src/vim9compile.c, src/testdir/test_vim9_script.vim


*** ../vim-8.2.1685/src/vim9compile.c   2020-09-14 21:38:47.756976285 +0200
--- src/vim9compile.c   2020-09-14 22:15:42.484186102 +0200
***************
*** 5066,5077 ****
                    {
                        type_T *use_type = lvar->lv_type;
  
!                       // without operator type is here, otherwise below
                        if (has_index)
                        {
                            use_type = use_type->tt_member;
                            if (use_type == NULL)
!                               use_type = &t_void;
                        }
                        if (need_type(stacktype, use_type, -1, cctx, FALSE)
                                                                       == FAIL)
--- 5066,5078 ----
                    {
                        type_T *use_type = lvar->lv_type;
  
!                       // without operator check type here, otherwise below
                        if (has_index)
                        {
                            use_type = use_type->tt_member;
                            if (use_type == NULL)
!                               // could be indexing "any"
!                               use_type = &t_any;
                        }
                        if (need_type(stacktype, use_type, -1, cctx, FALSE)
                                                                       == FAIL)
*** ../vim-8.2.1685/src/testdir/test_vim9_script.vim    2020-09-14 
21:38:47.760976275 +0200
--- src/testdir/test_vim9_script.vim    2020-09-14 22:06:03.070942796 +0200
***************
*** 831,836 ****
--- 831,854 ----
      list->assert_equal([4, 2, 3])
      const! other = [5, 6, 7]
      other->assert_equal([5, 6, 7])
+ 
+     let varlist = [7, 8]
+     const! constlist = [1, varlist, 3]
+     varlist[0] = 77
+     # TODO: does not work yet
+     # constlist[1][1] = 88
+     let cl = constlist[1]
+     cl[1] = 88
+     constlist->assert_equal([1, [77, 88], 3])
+ 
+     let vardict = #{five: 5, six: 6}
+     const! constdict = #{one: 1, two: vardict, three: 3}
+     vardict['five'] = 55
+     # TODO: does not work yet
+     # constdict['two']['six'] = 66
+     let cd = constdict['two']
+     cd['six'] = 66
+     constdict->assert_equal(#{one: 1, two: #{five: 55, six: 66}, three: 3})
    END
    CheckDefAndScriptSuccess(lines)
  enddef
*** ../vim-8.2.1685/src/version.c       2020-09-14 21:38:47.760976275 +0200
--- src/version.c       2020-09-14 21:51:37.580786930 +0200
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     1686,
  /**/

-- 
FROG: How you English say:  I one more time, mac, I unclog my nose towards
      you, sons of a window-dresser,  so, you think you could out-clever us
      French fellows with your silly knees-bent creeping about advancing
      behaviour.  (blows a raspberry) I wave my private parts at your aunties,
      you brightly-coloured, mealy-templed, cranberry-smelling, electric
      donkey-bottom biters.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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/202009142029.08EKT19F1727525%40masaka.moolenaar.net.

Raspunde prin e-mail lui