diff src/vim9compile.c @ 24400:62e978382fa0 v8.2.2740

patch 8.2.2740: Vim9: lambda with varargs doesn't work Commit: https://github.com/vim/vim/commit/2a38908b05c1d3973a8edbeb5b3e05a11332faf0 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Apr 9 20:24:31 2021 +0200 patch 8.2.2740: Vim9: lambda with varargs doesn't work Problem: Vim9: lambda with varargs doesn't work. Solution: Make "...name" work. Require type to be a list.
author Bram Moolenaar <Bram@vim.org>
date Fri, 09 Apr 2021 20:30:03 +0200
parents 492f7b54f691
children 009a540f16a6
line wrap: on
line diff
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -1856,7 +1856,8 @@ generate_CALL(cctx_T *cctx, ufunc_T *ufu
 		    continue;
 		expected = ufunc->uf_arg_types[i];
 	    }
-	    else if (ufunc->uf_va_type == NULL || ufunc->uf_va_type == &t_any)
+	    else if (ufunc->uf_va_type == NULL
+					   || ufunc->uf_va_type == &t_list_any)
 		// possibly a lambda or "...: any"
 		expected = &t_any;
 	    else
@@ -9069,7 +9070,7 @@ set_function_type(ufunc_T *ufunc)
 	if (varargs)
 	{
 	    ufunc->uf_func_type->tt_args[argcount] =
-		    ufunc->uf_va_type == NULL ? &t_any : ufunc->uf_va_type;
+		   ufunc->uf_va_type == NULL ? &t_list_any : ufunc->uf_va_type;
 	    ufunc->uf_func_type->tt_flags = TTFLAG_VARARGS;
 	}
     }