]> granicus.if.org Git - vim/commitdiff
patch 8.2.2310: Vim9: winsaveview() return type is too generic v8.2.2310
authorBram Moolenaar <Bram@vim.org>
Thu, 7 Jan 2021 19:23:33 +0000 (20:23 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 7 Jan 2021 19:23:33 +0000 (20:23 +0100)
Problem:    Vim9: winsaveview() return type is too generic.
Solution:   use dict<number> instead of dict<any>. (closes #7626)

src/evalfunc.c
src/testdir/test_vim9_builtin.vim
src/version.c

index ed9f06fed436e93b5cb79cf29c5669f1bb30decb..098d906ecf3c3e847c838917123c6df05607f49c 100644 (file)
@@ -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,
index 4eb2d76dfdbb232be58d7cfe66e8b18e9ebfff70..7aef315dc869329f71281c3e315ac72d494cee4a 100644 (file)
@@ -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
index f4a1d58c81a68d8ed2f307fce2a5d627d6a9c3d3..0d9816bc91681cdf0e10d7aadfbd61a9b2165180 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2310,
 /**/
     2309,
 /**/