To: vim_dev@googlegroups.com Subject: Patch 8.2.1695 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1695 Problem: Vim9: crash when using varargs type "any". Solution: Check if uf_va_type is &t_any. (closes #6957) Files: src/vim9compile.c, src/vim9execute.c, src/testdir/test_vim9_func.vim *** ../vim-8.2.1694/src/vim9compile.c 2020-09-16 15:21:56.354720354 +0200 --- src/vim9compile.c 2020-09-16 17:18:29.844854273 +0200 *************** *** 1430,1437 **** continue; expected = ufunc->uf_arg_types[i]; } ! else if (ufunc->uf_va_type == NULL) ! // possibly a lambda expected = &t_any; else expected = ufunc->uf_va_type->tt_member; --- 1430,1437 ---- continue; expected = ufunc->uf_arg_types[i]; } ! else if (ufunc->uf_va_type == NULL || ufunc->uf_va_type == &t_any) ! // possibly a lambda or "...: any" expected = &t_any; else expected = ufunc->uf_va_type->tt_member; *** ../vim-8.2.1694/src/vim9execute.c 2020-09-16 15:21:56.354720354 +0200 --- src/vim9execute.c 2020-09-16 17:16:25.269403347 +0200 *************** *** 829,834 **** --- 829,835 ---- // Check the type of the list items. tv = STACK_TV_BOT(-1); if (ufunc->uf_va_type != NULL + && ufunc->uf_va_type != &t_any && ufunc->uf_va_type->tt_member != &t_any && tv->vval.v_list != NULL) { *** ../vim-8.2.1694/src/testdir/test_vim9_func.vim 2020-09-16 15:21:56.358720340 +0200 --- src/testdir/test_vim9_func.vim 2020-09-16 17:20:30.040325738 +0200 *************** *** 321,326 **** --- 321,335 ---- lines =<< trim END vim9script + def Func(...l: any) + echo l + enddef + Func(0) + END + CheckScriptSuccess(lines) + + lines =<< trim END + vim9script def Func(...l: list) echo l enddef *** ../vim-8.2.1694/src/version.c 2020-09-16 15:46:04.881061899 +0200 --- src/version.c 2020-09-16 17:22:26.367815052 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 1695, /**/ -- An SQL statement walks into a bar. He approaches two tables and says, "Mind if I join you?" /// Bram Moolenaar -- Bram@Moolenaar.net -- 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 ///