summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-12-30 13:59:20 +0000
committerBram Moolenaar <Bram@vim.org>2021-12-30 13:59:20 +0000
commitcfe3af284a26178f4838df7c7489b2a1edd4c3a1 (patch)
tree6650f1f40bad17a44bc067038a076d25ba1f9440
parentf38aad85cf8e4e930c96cb843bc136949c8dbd29 (diff)
patch 8.2.3948: Vim9: failure with partial with unknown argument countv8.2.3948
Problem: Vim9: failure with partial with unknown argument count. Solution: Do not copy argument types if there aren't any.
-rw-r--r--src/version.c2
-rw-r--r--src/vim9type.c21
2 files changed, 14 insertions, 9 deletions
diff --git a/src/version.c b/src/version.c
index 56825f547b..a362dca9a7 100644
--- a/src/version.c
+++ b/src/version.c
@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3948,
+/**/
3947,
/**/
3946,
diff --git a/src/vim9type.c b/src/vim9type.c
index a9fb5b0e78..c6e80e6777 100644
--- a/src/vim9type.c
+++ b/src/vim9type.c
@@ -369,19 +369,22 @@ typval2type_int(typval_T *tv, int copyID, garray_T *type_gap, int do_member)
if (type == NULL)
return NULL;
*type = *ufunc->uf_func_type;
- type->tt_argcount -= tv->vval.v_partial->pt_argc;
- type->tt_min_argcount -= tv->vval.v_partial->pt_argc;
- if (type->tt_argcount == 0)
- type->tt_args = NULL;
- else
+ if (type->tt_argcount >= 0)
{
- int i;
+ type->tt_argcount -= tv->vval.v_partial->pt_argc;
+ type->tt_min_argcount -= tv->vval.v_partial->pt_argc;
+ if (type->tt_argcount == 0)
+ type->tt_args = NULL;
+ else
+ {
+ int i;
- func_type_add_arg_types(type, type->tt_argcount,
+ func_type_add_arg_types(type, type->tt_argcount,
type_gap);
- for (i = 0; i < type->tt_argcount; ++i)
- type->tt_args[i] = ufunc->uf_func_type->tt_args[
+ for (i = 0; i < type->tt_argcount; ++i)
+ type->tt_args[i] = ufunc->uf_func_type->tt_args[
i + tv->vval.v_partial->pt_argc];
+ }
}
return type;
}