comparison src/vim9type.c @ 33632:2c66a4fe1513 v9.0.2057

patch 9.0.2057: Vim9: no strict type checks for funcrefs varargs Commit: https://github.com/vim/vim/commit/3ec6c1fe3bb1b366b710d3e7226f7eed3be1801a Author: Ernie Rael <errael@raelity.com> Date: Sat Oct 21 11:45:38 2023 +0200 patch 9.0.2057: Vim9: no strict type checks for funcrefs varargs Problem: Vim9: no strict type checks for funcrefs varargs Solution: Perform strict type checking when declaring funcrefs with vararg declaration, add tests closes: #13397 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Ernie Rael <errael@raelity.com>
author Christian Brabandt <cb@256bit.org>
date Sat, 21 Oct 2023 12:00:03 +0200
parents 1fcb7c9dc546
children 7d9d2404a3d4
comparison
equal deleted inserted replaced
33631:9f55ea4702b1 33632:2c66a4fe1513
1229 } 1229 }
1230 1230
1231 type = parse_type(&p, type_gap, give_error); 1231 type = parse_type(&p, type_gap, give_error);
1232 if (type == NULL) 1232 if (type == NULL)
1233 return NULL; 1233 return NULL;
1234 if ((flags & TTFLAG_VARARGS) != 0
1235 && type->tt_type != VAR_LIST)
1236 {
1237 char *tofree;
1238 semsg(_(e_variable_arguments_type_must_be_list_str),
1239 type_name(type, &tofree));
1240 vim_free(tofree);
1241 return NULL;
1242 }
1234 arg_type[argcount++] = type; 1243 arg_type[argcount++] = type;
1235 1244
1236 // Nothing comes after "...{type}". 1245 // Nothing comes after "...{type}".
1237 if (flags & TTFLAG_VARARGS) 1246 if (flags & TTFLAG_VARARGS)
1238 break; 1247 break;