Patch 8.2.3401
Problem:    Vim9: cannot use a negative count with finddir() and findfile().
Solution:   Adjust the return type. (closes #8776)
Files:      src/evalfunc.c, src/testdir/test_vim9_builtin.vim


*** ../vim-8.2.3400/src/evalfunc.c      2021-09-02 19:53:03.206805177 +0200
--- src/evalfunc.c      2021-09-04 14:40:51.792606418 +0200
***************
*** 1354,1362 ****
      {"filter",                2, 2, FEARG_1,      arg2_mapfilter,
                        ret_first_arg,      f_filter},
      {"finddir",               1, 3, FEARG_1,      arg3_string_string_number,
!                       ret_string,         f_finddir},
      {"findfile",      1, 3, FEARG_1,      arg3_string_string_number,
!                       ret_string,         f_findfile},
      {"flatten",               1, 2, FEARG_1,      arg2_list_any_number,
                        ret_list_any,       f_flatten},
      {"flattennew",    1, 2, FEARG_1,      arg2_list_any_number,
--- 1354,1362 ----
      {"filter",                2, 2, FEARG_1,      arg2_mapfilter,
                        ret_first_arg,      f_filter},
      {"finddir",               1, 3, FEARG_1,      arg3_string_string_number,
!                       ret_any,            f_finddir},
      {"findfile",      1, 3, FEARG_1,      arg3_string_string_number,
!                       ret_any,            f_findfile},
      {"flatten",               1, 2, FEARG_1,      arg2_list_any_number,
                        ret_list_any,       f_flatten},
      {"flattennew",    1, 2, FEARG_1,      arg2_list_any_number,
*** ../vim-8.2.3400/src/testdir/test_vim9_builtin.vim   2021-08-28 
14:58:40.886062766 +0200
--- src/testdir/test_vim9_builtin.vim   2021-09-04 14:48:30.375440261 +0200
***************
*** 1027,1032 ****
--- 1027,1040 ----
  enddef
  
  def Test_finddir()
+   mkdir('Xtestdir')
+   finddir('Xtestdir', '**', -1)->assert_equal(['Xtestdir'])
+   var lines =<< trim END
+       var l: list<string> = finddir('nothing', '*;', -1)
+   END
+   CheckDefAndScriptSuccess(lines)
+   delete('Xtestdir', 'rf')
+ 
    CheckDefAndScriptFailure2(['finddir(true)'], 'E1013: Argument 1: type 
mismatch, expected string but got bool', 'E1174: String required for argument 
1')
    CheckDefAndScriptFailure2(['finddir(v:null)'], 'E1013: Argument 1: type 
mismatch, expected string but got special', 'E1174: String required for 
argument 1')
    CheckDefExecFailure(['echo finddir("")'], 'E1175:')
***************
*** 1035,1040 ****
--- 1043,1054 ----
  enddef
  
  def Test_findfile()
+   findfile('runtest.vim', '**', -1)->assert_equal(['runtest.vim'])
+   var lines =<< trim END
+       var l: list<string> = findfile('nothing', '*;', -1)
+   END
+   CheckDefAndScriptSuccess(lines)
+ 
    CheckDefExecFailure(['findfile(true)'], 'E1013: Argument 1: type mismatch, 
expected string but got bool')
    CheckDefExecFailure(['findfile(v:null)'], 'E1013: Argument 1: type 
mismatch, expected string but got special')
    CheckDefExecFailure(['findfile("")'], 'E1175:')
*** ../vim-8.2.3400/src/version.c       2021-09-04 13:43:57.928929327 +0200
--- src/version.c       2021-09-04 14:38:34.372924774 +0200
***************
*** 757,758 ****
--- 757,760 ----
  {   /* Add new patch number below this line */
+ /**/
+     3401,
  /**/

-- 
Female engineers become irresistible at the age of consent and remain that
way until about thirty minutes after their clinical death.  Longer if it's a
warm day.
                                (Scott Adams - The Dilbert principle)

 /// 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/202109041250.184CowrQ803613%40masaka.moolenaar.net.

Raspunde prin e-mail lui