Patch 8.2.1950

3 views
Skip to first unread message

Bram Moolenaar

unread,
Nov 4, 2020, 6:01:26 AM11/4/20
to vim...@googlegroups.com

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 -- Br...@Moolenaar.net -- 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 ///
Reply all
Reply to author
Forward
0 new messages