Patch 8.2.1380
Problem:    Vim9: return type of getreg() is always a string.
Solution:   Use list of strings when there are three arguments. (closes #6633)
Files:      src/evalfunc.c, src/testdir/test_vim9_func.vim


*** ../vim-8.2.1379/src/evalfunc.c      2020-07-23 17:16:15.046100627 +0200
--- src/evalfunc.c      2020-08-06 21:25:47.080164202 +0200
***************
*** 393,398 ****
--- 393,407 ----
      return &t_any;
  }
  
+     static type_T *
+ ret_getreg(int argcount, type_T **argtypes UNUSED)
+ {
+     // Assume that if the third argument is passed it's non-zero
+     if (argcount == 3)
+       return &t_list_string;
+     return &t_string;
+ }
+ 
  static type_T *ret_f_function(int argcount, type_T **argtypes);
  
  /*
***************
*** 641,647 ****
      {"getpid",                0, 0, 0,          ret_number,   f_getpid},
      {"getpos",                1, 1, FEARG_1,    ret_list_number,      
f_getpos},
      {"getqflist",     0, 1, 0,          ret_list_or_dict_0,   f_getqflist},
!     {"getreg",                0, 3, FEARG_1,    ret_string,   f_getreg},
      {"getreginfo",    0, 1, FEARG_1,    ret_dict_any, f_getreginfo},
      {"getregtype",    0, 1, FEARG_1,    ret_string,   f_getregtype},
      {"gettabinfo",    0, 1, FEARG_1,    ret_list_dict_any,    f_gettabinfo},
--- 650,656 ----
      {"getpid",                0, 0, 0,          ret_number,   f_getpid},
      {"getpos",                1, 1, FEARG_1,    ret_list_number,      
f_getpos},
      {"getqflist",     0, 1, 0,          ret_list_or_dict_0,   f_getqflist},
!     {"getreg",                0, 3, FEARG_1,    ret_getreg,   f_getreg},
      {"getreginfo",    0, 1, FEARG_1,    ret_dict_any, f_getreginfo},
      {"getregtype",    0, 1, FEARG_1,    ret_string,   f_getregtype},
      {"gettabinfo",    0, 1, FEARG_1,    ret_list_dict_any,    f_gettabinfo},
*** ../vim-8.2.1379/src/testdir/test_vim9_func.vim      2020-08-05 
10:53:15.087273357 +0200
--- src/testdir/test_vim9_func.vim      2020-08-06 21:25:13.588241517 +0200
***************
*** 1202,1207 ****
--- 1202,1213 ----
    assert_equal(6, res)
  enddef
  
+ def Test_getreg_return_type()
+   let s1: string = getreg('"')
+   let s2: string = getreg('"', 1)
+   let s3: list<string> = getreg('"', 1, 1)
+ enddef
+ 
  def Wrong_dict_key_type(items: list<number>): list<number>
    return filter(items, {_, val -> get({val: 1}, 'x')})
  enddef
*** ../vim-8.2.1379/src/version.c       2020-08-06 16:37:56.728521924 +0200
--- src/version.c       2020-08-06 21:26:15.588097512 +0200
***************
*** 756,757 ****
--- 756,759 ----
  {   /* Add new patch number below this line */
+ /**/
+     1380,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
134. You consider bandwidth to be more important than carats.

 /// Bram Moolenaar -- [email protected] -- 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    ///

-- 
-- 
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/202008061927.076JRSUi3655068%40masaka.moolenaar.net.

Raspunde prin e-mail lui