• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Revision3515f341e8ac4df5bb714b74cf0ff5ad8b2e1bbe (tree)
Time2020-09-17 00:30:03
AuthorBram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Log Message

patch 8.2.1695: Vim9: crash when using varargs type "any"

Commit: https://github.com/vim/vim/commit/2f8cbc4b225ba707c3926070a3f133eb0473aed2
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Sep 16 17:22:59 2020 +0200

patch 8.2.1695: Vim9: crash when using varargs type "any"
Problem: Vim9: crash when using varargs type "any".
Solution: Check if uf_va_type is &t_any. (closes https://github.com/vim/vim/issues/6957)

Change Summary

Incremental Difference

diff -r 9a335daeb41d -r 3515f341e8ac src/testdir/test_vim9_func.vim
--- a/src/testdir/test_vim9_func.vim Wed Sep 16 16:00:04 2020 +0200
+++ b/src/testdir/test_vim9_func.vim Wed Sep 16 17:30:03 2020 +0200
@@ -321,6 +321,15 @@
321321
322322 lines =<< trim END
323323 vim9script
324+ def Func(...l: any)
325+ echo l
326+ enddef
327+ Func(0)
328+ END
329+ CheckScriptSuccess(lines)
330+
331+ lines =<< trim END
332+ vim9script
324333 def Func(...l: list<string>)
325334 echo l
326335 enddef
diff -r 9a335daeb41d -r 3515f341e8ac src/version.c
--- a/src/version.c Wed Sep 16 16:00:04 2020 +0200
+++ b/src/version.c Wed Sep 16 17:30:03 2020 +0200
@@ -751,6 +751,8 @@
751751 static int included_patches[] =
752752 { /* Add new patch number below this line */
753753 /**/
754+ 1695,
755+/**/
754756 1694,
755757 /**/
756758 1693,
diff -r 9a335daeb41d -r 3515f341e8ac src/vim9compile.c
--- a/src/vim9compile.c Wed Sep 16 16:00:04 2020 +0200
+++ b/src/vim9compile.c Wed Sep 16 17:30:03 2020 +0200
@@ -1430,8 +1430,8 @@
14301430 continue;
14311431 expected = ufunc->uf_arg_types[i];
14321432 }
1433- else if (ufunc->uf_va_type == NULL)
1434- // possibly a lambda
1433+ else if (ufunc->uf_va_type == NULL || ufunc->uf_va_type == &t_any)
1434+ // possibly a lambda or "...: any"
14351435 expected = &t_any;
14361436 else
14371437 expected = ufunc->uf_va_type->tt_member;
diff -r 9a335daeb41d -r 3515f341e8ac src/vim9execute.c
--- a/src/vim9execute.c Wed Sep 16 16:00:04 2020 +0200
+++ b/src/vim9execute.c Wed Sep 16 17:30:03 2020 +0200
@@ -829,6 +829,7 @@
829829 // Check the type of the list items.
830830 tv = STACK_TV_BOT(-1);
831831 if (ufunc->uf_va_type != NULL
832+ && ufunc->uf_va_type != &t_any
832833 && ufunc->uf_va_type->tt_member != &t_any
833834 && tv->vval.v_list != NULL)
834835 {
Show on old repository browser