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 -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            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/202107041630.164GUCeI2566627%40masaka.moolenaar.net.

Raspunde prin e-mail lui