patch 8.2.0206: calling Vim9 function using default argument fails
Problem: Calling Vim9 function using default argument fails.
Solution: Give an appropriate error. (closes #5572)
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 40411c4..d7c7c8b 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -1024,9 +1024,11 @@
isn->isn_arg.ufunc.cuf_argcount = argcount;
stack->ga_len -= argcount; // drop the arguments
-
- // drop the funcref/partial, get back the return value
- ((type_T **)stack->ga_data)[stack->ga_len - 1] = &t_any;
+ if (ga_grow(stack, 1) == FAIL)
+ return FAIL;
+ // add return value
+ ((type_T **)stack->ga_data)[stack->ga_len] = &t_any;
+ ++stack->ga_len;
return OK;
}