patch 8.2.0972: Vim9 script variable declarations need a type
Problem: Vim9 script variable declarations need a type.
Solution: Make "let var: type" declare a script-local variable.
diff --git a/src/evalvars.c b/src/evalvars.c
index f2128a6..8a7162c 100644
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -728,8 +728,18 @@
else if (expr[0] == '.')
emsg(_("E985: .= is not supported with script version 2"));
else if (!ends_excmd2(eap->cmd, arg))
- // ":let var1 var2"
- arg = list_arg_vars(eap, arg, &first);
+ {
+ if (current_sctx.sc_version == SCRIPT_VERSION_VIM9)
+ {
+ // Vim9 declaration ":let var: type"
+ arg = vim9_declare_scriptvar(eap, arg);
+ }
+ else
+ {
+ // ":let var1 var2" - list values
+ arg = list_arg_vars(eap, arg, &first);
+ }
+ }
else if (!eap->skip)
{
// ":let"