summaryrefslogtreecommitdiffstats
path: root/src/vim9script.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vim9script.c')
-rw-r--r--src/vim9script.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/vim9script.c b/src/vim9script.c
index 48163150c6..74d0579f35 100644
--- a/src/vim9script.c
+++ b/src/vim9script.c
@@ -548,7 +548,11 @@ vim9_declare_scriptvar(exarg_T *eap, char_u *arg)
// Create the variable with 0/NULL value.
CLEAR_FIELD(init_tv);
- init_tv.v_type = type->tt_type;
+ if (type->tt_type == VAR_ANY)
+ // A variable of type "any" is not possible, just use zero instead
+ init_tv.v_type = VAR_NUMBER;
+ else
+ init_tv.v_type = type->tt_type;
set_var_const(name, type, &init_tv, FALSE, 0);
vim_free(name);