Patch 8.2.4458
Problem:    Vim9: compiling filter() call fails with funcref that has unknown
            arguments.
Solution:   Do not check the arguments if they are unknown at compile time.
            (closes #9835)
Files:      src/evalfunc.c, src/testdir/test_vim9_builtin.vim


*** ../vim-8.2.4457/src/evalfunc.c      2022-02-23 18:07:34.361914993 +0000
--- src/evalfunc.c      2022-02-23 18:27:54.379825110 +0000
***************
*** 552,557 ****
--- 552,559 ----
            t_func_exp.tt_member = &t_bool;
        if (args[0] == NULL)
            args[0] = &t_unknown;
+       if (type->tt_argcount == -1)
+           t_func_exp.tt_argcount = -1;
  
        where.wt_index = 2;
        return check_type(&t_func_exp, type, TRUE, where);
*** ../vim-8.2.4457/src/testdir/test_vim9_builtin.vim   2022-02-22 
21:54:41.175163303 +0000
--- src/testdir/test_vim9_builtin.vim   2022-02-23 18:30:40.039544060 +0000
***************
*** 1340,1349 ****
    enddef
    assert_equal([1], GetFiltered())
  
    v9.CheckDefAndScriptFailure(['filter(1.1, "1")'], ['E1013: Argument 1: type 
mismatch, expected list<any> but got float', 'E1251: List, Dictionary, Blob or 
String required for argument 1'])
    v9.CheckDefAndScriptFailure(['filter([1, 2], 4)'], ['E1256: String or 
function required for argument 2', 'E1024: Using a Number as a String'])
  
!   var lines =<< trim END
      def F(i: number, v: any): string
        return 'bad'
      enddef
--- 1340,1360 ----
    enddef
    assert_equal([1], GetFiltered())
  
+   var lines =<< trim END
+       vim9script
+       def Func(): list<string>
+         var MatchWord: func: bool = (_, v) => true
+         var l = ['xxx']
+         return l->filter(MatchWord)
+       enddef
+       assert_equal(['xxx'], Func())
+   END
+   v9.CheckScriptSuccess(lines)
+ 
    v9.CheckDefAndScriptFailure(['filter(1.1, "1")'], ['E1013: Argument 1: type 
mismatch, expected list<any> but got float', 'E1251: List, Dictionary, Blob or 
String required for argument 1'])
    v9.CheckDefAndScriptFailure(['filter([1, 2], 4)'], ['E1256: String or 
function required for argument 2', 'E1024: Using a Number as a String'])
  
!   lines =<< trim END
      def F(i: number, v: any): string
        return 'bad'
      enddef
*** ../vim-8.2.4457/src/version.c       2022-02-23 18:07:34.365914989 +0000
--- src/version.c       2022-02-23 18:44:33.142979481 +0000
***************
*** 756,757 ****
--- 756,759 ----
  {   /* Add new patch number below this line */
+ /**/
+     4458,
  /**/

-- 
I AM THANKFUL...
...for the mess to clean after a party because it means I have
been surrounded by friends.

 /// 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/20220223191236.845E51C16F6%40moolenaar.net.

Raspunde prin e-mail lui