patch 8.2.2268: Vim9: list unpack seen as declaration
Problem: Vim9: list unpack seen as declaration.
Solution: Check for "var". (closes #7594)
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 19d8473..303573f 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -5634,6 +5634,11 @@
semsg(_(e_cannot_use_operator_on_new_variable), name);
goto theend;
}
+ if (!is_decl)
+ {
+ semsg(_(e_unknown_variable_str), name);
+ goto theend;
+ }
// new local variable
if ((type->tt_type == VAR_FUNC || type->tt_type == VAR_PARTIAL)
@@ -6140,6 +6145,7 @@
return NULL;
}
+ // TODO: this doesn't work for local variables
ex_unletlock(eap, p, 0, GLV_NO_AUTOLOAD, compile_unlet, cctx);
return eap->nextcmd == NULL ? (char_u *)"" : eap->nextcmd;
}