Patch 8.2.3104

2 views
Skip to first unread message

Bram Moolenaar

unread,
Jul 4, 2021, 12:30:19 PM7/4/21
to vim...@googlegroups.com

Patch 8.2.3104
Problem: Vim9: unspecified function type causes type error.
Solution: Don't check type when min_argcount is negative. (issue #8492)
Files: src/globals.h, src/vim9type.c, src/testdir/test_vim9_assign.vim


*** ../vim-8.2.3103/src/globals.h 2021-06-27 22:03:28.637707737 +0200
--- src/globals.h 2021-07-04 18:13:28.776992425 +0200
***************
*** 421,427 ****
// Special value used for @#.
EXTERN type_T t_number_or_string INIT6(VAR_STRING, 0, 0, TTFLAG_STATIC, NULL, NULL);

! EXTERN type_T t_func_unknown INIT6(VAR_FUNC, -1, 0, TTFLAG_STATIC, &t_unknown, NULL);
EXTERN type_T t_func_void INIT6(VAR_FUNC, -1, 0, TTFLAG_STATIC, &t_void, NULL);
EXTERN type_T t_func_any INIT6(VAR_FUNC, -1, 0, TTFLAG_STATIC, &t_any, NULL);
EXTERN type_T t_func_number INIT6(VAR_FUNC, -1, 0, TTFLAG_STATIC, &t_number, NULL);
--- 421,427 ----
// Special value used for @#.
EXTERN type_T t_number_or_string INIT6(VAR_STRING, 0, 0, TTFLAG_STATIC, NULL, NULL);

! EXTERN type_T t_func_unknown INIT6(VAR_FUNC, -1, -1, TTFLAG_STATIC, &t_unknown, NULL);
EXTERN type_T t_func_void INIT6(VAR_FUNC, -1, 0, TTFLAG_STATIC, &t_void, NULL);
EXTERN type_T t_func_any INIT6(VAR_FUNC, -1, 0, TTFLAG_STATIC, &t_any, NULL);
EXTERN type_T t_func_number INIT6(VAR_FUNC, -1, 0, TTFLAG_STATIC, &t_number, NULL);
*** ../vim-8.2.3103/src/vim9type.c 2021-07-04 15:54:04.935754560 +0200
--- src/vim9type.c 2021-07-04 18:20:18.168216771 +0200
***************
*** 526,531 ****
--- 526,532 ----
ret = check_type(expected->tt_member, actual->tt_member,
FALSE, where);
if (ret == OK && expected->tt_argcount != -1
+ && actual->tt_min_argcount != -1
&& (actual->tt_argcount == -1
|| (actual->tt_argcount < expected->tt_min_argcount
|| actual->tt_argcount > expected->tt_argcount)))
*** ../vim-8.2.3103/src/testdir/test_vim9_assign.vim 2021-07-04 15:54:04.939754549 +0200
--- src/testdir/test_vim9_assign.vim 2021-07-04 18:24:44.648022448 +0200
***************
*** 661,666 ****
--- 661,675 ----
CheckDefExecAndScriptFailure(lines, 'E1012:', 5)
enddef

+ def PartFunc(b: bool): string
+ return 'done'
+ enddef
+
+ def Test_assignment_partial()
+ var Partial: func(): string = function(PartFunc, [true])
+ assert_equal('done', Partial())
+ enddef
+
def Test_assignment_list_any_index()
var l: list<number> = [1, 2]
for [x, y, _]
*** ../vim-8.2.3103/src/version.c 2021-07-04 17:36:50.377399435 +0200
--- src/version.c 2021-07-04 18:28:01.391791616 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3104,
/**/

--
In order for something to become clean, something else must become dirty;
but you can get everything dirty without getting anything clean.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages