Patch 8.2.1764
Problem:    Vim9: no error when assigning to script var with wrong type.
Solution:   Fix off-by-one error. (closes #7028)
Files:      src/vim9compile.c, src/testdir/test_vim9_assign.vim


*** ../vim-8.2.1763/src/vim9compile.c   2020-09-27 18:24:00.087276290 +0200
--- src/vim9compile.c   2020-09-27 21:26:02.982766813 +0200
***************
*** 4899,4905 ****
                        {
                            scriptvar_idx = get_script_item_idx(scriptvar_sid,
                                                                rawname, TRUE);
!                           if (scriptvar_idx > 0)
                            {
                                scriptitem_T *si = SCRIPT_ITEM(scriptvar_sid);
                                svar_T       *sv =
--- 4899,4905 ----
                        {
                            scriptvar_idx = get_script_item_idx(scriptvar_sid,
                                                                rawname, TRUE);
!                           if (scriptvar_idx >= 0)
                            {
                                scriptitem_T *si = SCRIPT_ITEM(scriptvar_sid);
                                svar_T       *sv =
*** ../vim-8.2.1763/src/testdir/test_vim9_assign.vim    2020-09-27 
19:05:28.940098114 +0200
--- src/testdir/test_vim9_assign.vim    2020-09-27 21:27:07.042614505 +0200
***************
*** 567,572 ****
--- 567,582 ----
      assert_equal(44, t)
    END
    CheckScriptSuccess(lines)
+ 
+   lines =<< trim END
+       vim9script
+       var n: number
+       def Func()
+         n = 'string'
+       enddef
+       defcompile
+   END
+   CheckScriptFailure(lines, 'E1012: Type mismatch; expected number but got 
string')
  enddef
  
  def Mess(): string
*** ../vim-8.2.1763/src/version.c       2020-09-27 21:16:41.764046891 +0200
--- src/version.c       2020-09-27 21:22:59.459197811 +0200
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     1764,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
6. You refuse to go to a vacation spot with no electricity and no phone lines.

 /// 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/202009271928.08RJS8fj230989%40masaka.moolenaar.net.

Raspunde prin e-mail lui