Patch 8.2.2483
Problem:    Vim9: type error for misformed expression.
Solution:   Check for end of command before checking type. (closes #7795)
Files:      src/vim9compile.c, src/testdir/test_vim9_script.vim


*** ../vim-8.2.2482/src/vim9compile.c   2021-02-07 15:28:05.792508596 +0100
--- src/vim9compile.c   2021-02-07 16:28:54.076945860 +0100
***************
*** 6701,6706 ****
--- 6701,6711 ----
        clear_ppconst(&ppconst);
        return NULL;
      }
+     if (!ends_excmd2(arg, skipwhite(p)))
+     {
+       semsg(_(e_trailing_arg), p);
+       return NULL;
+     }
      if (cctx->ctx_skip == SKIP_YES)
        clear_ppconst(&ppconst);
      else if (instr->ga_len == instr_count && ppconst.pp_used == 1)
***************
*** 6825,6830 ****
--- 6830,6840 ----
        return NULL;
      }
      cctx->ctx_skip = save_skip;
+     if (!ends_excmd2(arg, skipwhite(p)))
+     {
+       semsg(_(e_trailing_arg), p);
+       return NULL;
+     }
      if (scope->se_skip_save == SKIP_YES)
        clear_ppconst(&ppconst);
      else if (instr->ga_len == instr_count && ppconst.pp_used == 1)
***************
*** 7237,7242 ****
--- 7247,7257 ----
      // compile "expr"
      if (compile_expr0(&p, cctx) == FAIL)
        return NULL;
+     if (!ends_excmd2(arg, skipwhite(p)))
+     {
+       semsg(_(e_trailing_arg), p);
+       return NULL;
+     }
  
      if (bool_on_stack(cctx) == FAIL)
        return FAIL;
*** ../vim-8.2.2482/src/testdir/test_vim9_script.vim    2021-02-03 
17:41:19.924245848 +0100
--- src/testdir/test_vim9_script.vim    2021-02-07 16:29:49.144768332 +0100
***************
*** 1743,1748 ****
--- 1743,1763 ----
    CheckDefFailure(['endif'], 'E580:')
    CheckDefFailure(['if g:abool', 'elseif xxx'], 'E1001:')
    CheckDefFailure(['if true', 'echo 1'], 'E171:')
+ 
+   var lines =<< trim END
+       var s = ''
+       if s = ''
+       endif
+   END
+   CheckDefFailure(lines, 'E488:')
+ 
+   lines =<< trim END
+       var s = ''
+       if s == ''
+       elseif s = ''
+       endif
+   END
+   CheckDefFailure(lines, 'E488:')
  enddef
  
  let g:bool_true = v:true
***************
*** 2200,2205 ****
--- 2215,2227 ----
    CheckDefFailure(['break'], 'E587:')
    CheckDefFailure(['if true', 'break'], 'E587:')
    CheckDefFailure(['while 1', 'echo 3'], 'E170:')
+ 
+   var lines =<< trim END
+       var s = ''
+       while s = ''
+       endwhile
+   END
+   CheckDefFailure(lines, 'E488:')
  enddef
  
  def Test_interrupt_loop()
*** ../vim-8.2.2482/src/version.c       2021-02-07 16:05:43.833488594 +0100
--- src/version.c       2021-02-07 16:33:03.800143933 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2483,
  /**/

-- 
This is the polymorph virus!  Follow these instructions carefully:
1. Send this message to everybody you know.
2. Format your harddisk.
Thank you for your cooperation in spreading the most powerful virus ever!

 /// 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/202102071534.117FY4NL2869592%40masaka.moolenaar.net.

Raspunde prin e-mail lui