Patch 8.2.2173
Problem:    Vim9: get internal error when assigning to undefined variable.
Solution:   Add error message. (closes #7475)
Files:      src/vim9compile.c, src/vim9execute.c, src/errors.h,
            src/testdir/test_vim9_cmd.vim


*** ../vim-8.2.2172/src/vim9compile.c   2020-12-20 15:20:53.326899494 +0100
--- src/vim9compile.c   2020-12-20 21:36:03.626874518 +0100
***************
*** 7681,7688 ****
            // Expression or function call.
            if (ea.cmdidx != CMD_eval)
            {
!               // CMD_var cannot happen, compile_assignment() above is used
!               iemsg("Command from find_ex_command() not handled");
                goto erret;
            }
        }
--- 7681,7689 ----
            // Expression or function call.
            if (ea.cmdidx != CMD_eval)
            {
!               // CMD_var cannot happen, compile_assignment() above would be
!               // used.  Most likely an assignment to a non-existing variable.
!               semsg(_(e_command_not_recognized_str), ea.cmd);
                goto erret;
            }
        }
*** ../vim-8.2.2172/src/vim9execute.c   2020-12-20 21:10:13.902437880 +0100
--- src/vim9execute.c   2020-12-20 21:41:31.477415038 +0100
***************
*** 606,613 ****
        return FAIL;
      if (ufunc->uf_def_status == UF_COMPILED)
      {
!       int error = check_user_func_argcount(ufunc, argcount);
! 
        if (error != FCERR_UNKNOWN)
        {
            if (error == FCERR_TOOMANY)
--- 606,612 ----
        return FAIL;
      if (ufunc->uf_def_status == UF_COMPILED)
      {
!       error = check_user_func_argcount(ufunc, argcount);
        if (error != FCERR_UNKNOWN)
        {
            if (error == FCERR_TOOMANY)
*** ../vim-8.2.2172/src/errors.h        2020-12-13 17:50:16.734956500 +0100
--- src/errors.h        2020-12-20 21:37:43.066430610 +0100
***************
*** 321,323 ****
--- 321,325 ----
        INIT(= N_("E1144: Command is not followed by white space: %s"));
  EXTERN char e_missing_heredoc_end_marker_str[]
        INIT(= N_("E1145: Missing heredoc end marker: %s"));
+ EXTERN char e_command_not_recognized_str[]
+       INIT(= N_("E1146: Command not recognized: %s"));
*** ../vim-8.2.2172/src/testdir/test_vim9_cmd.vim       2020-12-16 
21:43:47.451181035 +0100
--- src/testdir/test_vim9_cmd.vim       2020-12-20 21:42:36.245127863 +0100
***************
*** 710,714 ****
--- 710,725 ----
    CheckScriptFailure(lines, 'E464:')
  enddef
  
+ def Test_command_not_recognized()
+   var lines =<< trim END
+     d.key = 'asdf'
+   END
+   CheckDefFailure(lines, 'E1146:', 1)
+ 
+   lines =<< trim END
+     d['key'] = 'asdf'
+   END
+   CheckDefFailure(lines, 'E1146:', 1)
+ enddef
  
  " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
*** ../vim-8.2.2172/src/version.c       2020-12-20 21:10:13.902437880 +0100
--- src/version.c       2020-12-20 21:37:17.014546784 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2173,
  /**/

-- 
If the Universe is constantly expanding, why can't I ever find a parking space?

 /// 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/202012202044.0BKKi85N2018976%40masaka.moolenaar.net.

Raspunde prin e-mail lui