delete('XnestedDone')
enddef
+def Test_check_func_arg_types()
+ var lines =<< trim END
+ vim9script
+ def F1(x: string): string
+ return x
+ enddef
+
+ def F2(x: number): number
+ return x + 1
+ enddef
+
+ def G(g: func): dict<func>
+ return {f: g}
+ enddef
+
+ def H(d: dict<func>): string
+ return d.f('a')
+ enddef
+ END
+
+ CheckScriptSuccess(lines + ['echo H(G(F1))'])
+ CheckScriptFailure(lines + ['echo H(G(F2))'], 'E1013:')
+enddef
+
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
}
if (ufunc != NULL)
+ {
+ if (ufunc->uf_arg_types != NULL)
+ {
+ int i;
+ typval_T *argv = STACK_TV_BOT(0) - argcount;
+
+ // The function can change at runtime, check that the argument
+ // types are correct.
+ for (i = 0; i < argcount; ++i)
+ {
+ type_T *type = i < ufunc->uf_args.ga_len
+ ? ufunc->uf_arg_types[i] : ufunc->uf_va_type;
+
+ if (type != NULL && check_typval_arg_type(type,
+ &argv[i], i + 1) == FAIL)
+ return FAIL;
+ }
+ }
+
return call_ufunc(ufunc, NULL, argcount, ectx, iptr);
+ }
return FAIL;
}