Patch 8.2.2444
Problem:    Vim9: compile error with combination of operator and list.
Solution:   Generate constants before parsing a list or dict. (closes #7757)
Files:      src/vim9compile.c, src/testdir/test_vim9_expr.vim


*** ../vim-8.2.2443/src/vim9compile.c   2021-01-25 21:01:45.077861178 +0100
--- src/vim9compile.c   2021-01-31 21:44:00.265636107 +0100
***************
*** 4121,4133 ****
        /*
         * List: [expr, expr]
         */
!       case '[':   ret = compile_list(arg, cctx, ppconst);
                    break;
  
        /*
         * Dictionary: {'key': val, 'key': val}
         */
!       case '{':   ret = compile_dict(arg, cctx, ppconst);
                    break;
  
        /*
--- 4121,4137 ----
        /*
         * List: [expr, expr]
         */
!       case '[':   if (generate_ppconst(cctx, ppconst) == FAIL)
!                       return FAIL;
!                   ret = compile_list(arg, cctx, ppconst);
                    break;
  
        /*
         * Dictionary: {'key': val, 'key': val}
         */
!       case '{':   if (generate_ppconst(cctx, ppconst) == FAIL)
!                       return FAIL;
!                   ret = compile_dict(arg, cctx, ppconst);
                    break;
  
        /*
*** ../vim-8.2.2443/src/testdir/test_vim9_expr.vim      2021-01-20 
21:23:10.709286927 +0100
--- src/testdir/test_vim9_expr.vim      2021-01-31 21:46:46.748985214 +0100
***************
*** 1083,1088 ****
--- 1083,1091 ----
          assert_equal('a0.123', 'a' .. 0.123)
        endif
  
+       assert_equal(3, 1 + [2, 3, 4][0])
+       assert_equal(5, 2 + {key: 3}['key'])
+ 
        set digraph
        assert_equal('val: true', 'val: ' .. &digraph)
        set nodigraph
*** ../vim-8.2.2443/src/version.c       2021-01-31 20:48:55.162175817 +0100
--- src/version.c       2021-01-31 21:45:13.313349054 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2444,
  /**/

-- 
FIRST HEAD:  Oh! quick! get the sword out I want to cut his head off.
THIRD HEAD:  Oh, cut your own head off.
SECOND HEAD: Yes - do us all a favour.
                 "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/202101312048.10VKmBrF1055076%40masaka.moolenaar.net.

Raspunde prin e-mail lui