Problem: Vim9: crash when lambda has fewer arguments than expected.
Solution: Don't check arguments when already failed. (closes #7606)
echo Ref(1, 'x')
END
CheckDefFailure(lines, 'E1013: Argument 2: type mismatch, expected number but got string')
+
+ lines =<< trim END
+ var Ref: func(job, string, number)
+ Ref = (x, y) => 0
+ END
+ CheckDefAndScriptFailure(lines, 'E1012:')
+
+ lines =<< trim END
+ var Ref: func(job, string)
+ Ref = (x, y, z) => 0
+ END
+ CheckDefAndScriptFailure(lines, 'E1012:')
enddef
def Test_lambda_uses_assigned_var()
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 2283,
/**/
2282,
/**/
&& actual->tt_argcount != -1
&& (actual->tt_argcount < expected->tt_min_argcount
|| actual->tt_argcount > expected->tt_argcount))
- ret = FAIL;
- if (expected->tt_args != NULL && actual->tt_args != NULL)
+ ret = FAIL;
+ if (ret == OK && expected->tt_args != NULL
+ && actual->tt_args != NULL)
{
int i;