Patch 8.2.4949
Problem:    Vim9: some code not covered by tests.
Solution:   Add a few more test cases.  Fix double error message.
Files:      src/vim9expr.c, src/testdir/test_vim9_expr.vim


*** ../vim-8.2.4948/src/vim9expr.c      2022-05-12 22:02:53.287681016 +0100
--- src/vim9expr.c      2022-05-13 16:02:45.775021653 +0100
***************
*** 1899,1904 ****
--- 1899,1905 ----
                {
                    int fail;
                    int save_len = cctx->ctx_ufunc->uf_lines.ga_len;
+                   int prev_did_emsg = did_emsg;
  
                    *paren = NUL;
  
***************
*** 1916,1922 ****
  
                    if (fail)
                    {
!                       semsg(_(e_invalid_expression_str), pstart);
                        return FAIL;
                    }
                }
--- 1917,1924 ----
  
                    if (fail)
                    {
!                       if (did_emsg == prev_did_emsg)
!                           semsg(_(e_invalid_expression_str), pstart);
                        return FAIL;
                    }
                }
*** ../vim-8.2.4948/src/testdir/test_vim9_expr.vim      2022-05-12 
22:02:53.287681016 +0100
--- src/testdir/test_vim9_expr.vim      2022-05-13 16:22:06.941390027 +0100
***************
*** 545,550 ****
--- 545,556 ----
        endif
    END
    v9.CheckDefAndScriptFailure(lines, ['E1012:', 'E1135: Using a String as a 
Bool'], 1)
+ 
+   lines =<< trim END
+       var s = 'asdf'
+       echo true && s
+   END
+   v9.CheckDefAndScriptFailure(lines, ['E1012: Type mismatch; expected bool 
but got string', 'E1135: Using a String as a Bool: "asdf"'])
  enddef
  
  " global variables to use for tests with the "any" type
***************
*** 3377,3382 ****
--- 3383,3400 ----
  
    v9.CheckDefAndScriptFailure(['echo ('], ['E1097: Line incomplete', 'E15: 
Invalid expression: "("'])
    v9.CheckDefAndScriptFailure(['echo (123]'], "E110: Missing ')'", 1)
+ 
+   # this uses up the ppconst stack
+   lines =<< eval trim END
+     vim9script
+     def F()
+       g:result = 1 + {repeat('(1 + ', 51)}1{repeat(')', 51)}
+     enddef
+     F()
+   END
+   v9.CheckScriptSuccess(lines)
+   assert_equal(g:result, 53)
+   unlet g:result
  enddef
  
  def Test_expr8_negate_add()
***************
*** 3623,3628 ****
--- 3641,3658 ----
      RetVoid()->byteidx(3)
    END
    v9.CheckDefExecFailure(lines, 'E1013:')
+ 
+   lines =<< trim END
+       const SetList = [function('len')]
+       echo 'xx'->SetList[x]()
+   END
+   v9.CheckDefFailure(lines, 'E1001: Variable not found: x')
+ 
+   lines =<< trim END
+       const SetList = [function('len')]
+       echo 'xx'->SetList[0]x()
+   END
+   v9.CheckDefFailure(lines, 'E15: Invalid expression: "->SetList[0]x()"')
  enddef
  
  def Test_expr8_method_call_linebreak()
***************
*** 3785,3790 ****
--- 3815,3822 ----
  
    call v9.CheckDefExecFailure(["{['a']: 1->len()"], 'E723:', 2)
    call v9.CheckScriptFailure(['vim9script', "{['a']: 1->len()"], 'E722:', 2)
+ 
+   call v9.CheckDefFailure(['echo #{}'], 'E1170:')
  endfunc
  
  let g:Funcrefs = [function('add')]
*** ../vim-8.2.4948/src/version.c       2022-05-13 13:50:32.815012765 +0100
--- src/version.c       2022-05-13 15:40:04.264263830 +0100
***************
*** 748,749 ****
--- 748,751 ----
  {   /* Add new patch number below this line */
+ /**/
+     4949,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
190. You quickly hand over your wallet, leather jacket, and car keys
     during a mugging, then proceed to beat the crap out of your
     assailant when he asks for your laptop.

 /// 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/20220513154937.0524C1C076B%40moolenaar.net.

Raspunde prin e-mail lui