changeset 23535:98185d3dd369 v8.2.2310

patch 8.2.2310: Vim9: winsaveview() return type is too generic Commit: https://github.com/vim/vim/commit/43b69b39acb85a2aab2310cba5a2dbac338a4eb9 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jan 7 20:23:33 2021 +0100 patch 8.2.2310: Vim9: winsaveview() return type is too generic Problem: Vim9: winsaveview() return type is too generic. Solution: use dict<number> instead of dict<any>. (closes https://github.com/vim/vim/issues/7626)
author Bram Moolenaar <Bram@vim.org>
date Thu, 07 Jan 2021 20:30:04 +0100
parents ad34cd2fde1e
children 708e07fe1fb4
files src/evalfunc.c src/testdir/test_vim9_builtin.vim src/version.c
diffstat 3 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -1753,7 +1753,7 @@ static funcentry_T global_functions[] =
     {"winrestview",	1, 1, FEARG_1,	    NULL,
 			ret_void,	    f_winrestview},
     {"winsaveview",	0, 0, 0,	    NULL,
-			ret_dict_any,	    f_winsaveview},
+			ret_dict_number,    f_winsaveview},
     {"winwidth",	1, 1, FEARG_1,	    NULL,
 			ret_number,	    f_winwidth},
     {"wordcount",	0, 0, 0,	    NULL,
--- a/src/testdir/test_vim9_builtin.vim
+++ b/src/testdir/test_vim9_builtin.vim
@@ -786,6 +786,16 @@ def Test_winrestcmd()
   close
 enddef
 
+def Test_winsaveview()
+  var view: dict<number> = winsaveview()
+
+  var lines =<< trim END
+      var view: list<number> = winsaveview()
+  END
+  CheckDefAndScriptFailure(lines, 'E1012: Type mismatch; expected list<number> but got dict<number>', 1)
+enddef
+
+
 
 
 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2310,
+/**/
     2309,
 /**/
     2308,