patch 8.2.0467: Vim9: some errors are not tested
Problem: Vim9: some errors are not tested
Solution: Add more tests. Fix that Vim9 script flag is not reset.
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 66eda7c..12dae49 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -1815,7 +1815,10 @@
if (*(*arg + 1) == ':')
{
// load namespaced variable
- name = vim_strnsave(*arg + 2, end - (*arg + 2));
+ if (end <= *arg + 2)
+ name = vim_strsave((char_u *)"[empty]");
+ else
+ name = vim_strnsave(*arg + 2, end - (*arg + 2));
if (name == NULL)
return FAIL;
@@ -1833,9 +1836,24 @@
{
res = compile_load_scriptvar(cctx, name, NULL, NULL, error);
}
+ else if (**arg == 'b')
+ {
+ semsg("Namespace b: not supported yet: %s", *arg);
+ goto theend;
+ }
+ else if (**arg == 'w')
+ {
+ semsg("Namespace w: not supported yet: %s", *arg);
+ goto theend;
+ }
+ else if (**arg == 't')
+ {
+ semsg("Namespace t: not supported yet: %s", *arg);
+ goto theend;
+ }
else
{
- semsg("Namespace not supported yet: %s", *arg);
+ semsg("E1075: Namespace not supported: %s", *arg);
goto theend;
}
}
@@ -2060,6 +2078,7 @@
}
else if (p == arg && *arg == '#' && arg[1] == '{')
{
+ // Can be "#{a: 1}->Func()".
++p;
if (eval_dict(&p, &rettv, FALSE, TRUE) == FAIL)
p = arg;
@@ -2068,6 +2087,8 @@
{
int ret = get_lambda_tv(&p, &rettv, FALSE);
+ // Can be "{x -> ret}()".
+ // Can be "{'a': 1}->Func()".
if (ret == NOTDONE)
ret = eval_dict(&p, &rettv, FALSE, FALSE);
if (ret != OK)
@@ -5123,7 +5144,8 @@
}
// "{" starts a block scope
- if (*ea.cmd == '{')
+ // "{'a': 1}->func() is something else
+ if (*ea.cmd == '{' && ends_excmd(*skipwhite(ea.cmd + 1)))
{
line = compile_block(ea.cmd, &cctx);
continue;