patch 9.1.1788: Vim9: can declare a void variable

Problem:  Vim9: can declare a void variable (Ernie Rael)
Solution: Disallow such variable declaration (Yegappan Lakshmanan)

fixes: #13773
closes: #18382

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Yegappan Lakshmanan
2025-09-24 17:51:17 +00:00
committed by Christian Brabandt
parent a7680a1a69
commit 7376fa3fd8
13 changed files with 113 additions and 16 deletions

View File

@ -841,7 +841,9 @@ vim9_declare_scriptvar(exarg_T *eap, char_u *arg)
// parse type, check for reserved name
p = skipwhite(p + 1);
type = parse_type(&p, &si->sn_type_list, NULL, NULL, TRUE);
if (type == NULL || check_reserved_name(name, FALSE) == FAIL)
if (type == NULL
|| check_reserved_name(name, FALSE) == FAIL
|| !valid_declaration_type(type))
{
vim_free(name);
return p;