Patch 8.2.1950
Problem:    Vim9: crash when compiling function fails when getting type.
Solution:   Handle NULL type. (closes #7253)
Files:      src/vim9type.c, src/testdir/test_vim9_expr.vim


*** ../vim-8.2.1949/src/vim9type.c      2020-10-03 22:51:42.890813408 +0200
--- src/vim9type.c      2020-11-04 11:58:03.513127051 +0100
***************
*** 108,114 ****
      type_T *type;
  
      // recognize commonly used types
!     if (member_type->tt_type == VAR_ANY)
        return &t_list_any;
      if (member_type->tt_type == VAR_VOID
            || member_type->tt_type == VAR_UNKNOWN)
--- 108,114 ----
      type_T *type;
  
      // recognize commonly used types
!     if (member_type == NULL || member_type->tt_type == VAR_ANY)
        return &t_list_any;
      if (member_type->tt_type == VAR_VOID
            || member_type->tt_type == VAR_UNKNOWN)
***************
*** 137,143 ****
      type_T *type;
  
      // recognize commonly used types
!     if (member_type->tt_type == VAR_ANY)
        return &t_dict_any;
      if (member_type->tt_type == VAR_VOID
            || member_type->tt_type == VAR_UNKNOWN)
--- 137,143 ----
      type_T *type;
  
      // recognize commonly used types
!     if (member_type == NULL || member_type->tt_type == VAR_ANY)
        return &t_dict_any;
      if (member_type->tt_type == VAR_VOID
            || member_type->tt_type == VAR_UNKNOWN)
***************
*** 408,413 ****
--- 408,414 ----
  
  /*
   * Return FAIL if "expected" and "actual" don't match.
+  * When "argidx" > 0 it is included in the error message.
   */
      int
  check_typval_type(type_T *expected, typval_T *actual_tv, int argidx)
*** ../vim-8.2.1949/src/testdir/test_vim9_expr.vim      2020-10-30 
18:32:57.430698692 +0100
--- src/testdir/test_vim9_expr.vim      2020-11-04 11:57:36.069195807 +0100
***************
*** 1749,1754 ****
--- 1749,1763 ----
      var l: list<string> = [234, 'x']
    END
    CheckScriptFailure(lines, 'E1012:', 2)
+ 
+   lines =<< trim END
+       vim9script
+       def Failing()
+         job_stop()
+       enddef
+       var list = [Failing]
+   END
+   CheckScriptFailure(lines, 'E119:', 1)
  enddef
  
  def LambdaWithComments(): func
***************
*** 2009,2014 ****
--- 2018,2032 ----
      var l: dict<string> = #{a: 234, b: 'x'}
    END
    CheckScriptFailure(lines, 'E1012:', 2)
+ 
+   lines =<< trim END
+       vim9script
+       def Failing()
+         job_stop()
+       enddef
+       var dict = #{name: Failing}
+   END
+   CheckScriptFailure(lines, 'E119:', 1)
  enddef
  
  let g:oneString = 'one'
*** ../vim-8.2.1949/src/version.c       2020-11-04 11:36:31.412190527 +0100
--- src/version.c       2020-11-04 11:53:31.377805538 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     1950,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
191. You rate eating establishments not by the quality of the food,
     but by the availability of electrical outlets for your PowerBook.

 /// 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/202011041101.0A4B1JNu3997951%40masaka.moolenaar.net.

Raspunde prin e-mail lui