patch 9.0.0444: trying to declare g:variable gives confusing error
Problem: Trying to declare g:variable gives confusing error.
Solution: Give a better error message. (closes #11108)
diff --git a/src/eval.c b/src/eval.c
index f208ab1..5d93b7e 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1031,12 +1031,16 @@
{
char_u *tp = skipwhite(p + 1);
+ if (is_scoped_variable(name))
+ {
+ semsg(_(e_cannot_use_type_with_this_variable_str), name);
+ return NULL;
+ }
if (tp == p + 1 && !quiet)
{
semsg(_(e_white_space_required_after_str_str), ":", p);
return NULL;
}
-
if (!SCRIPT_ID_VALID(current_sctx.sc_sid))
{
semsg(_(e_using_type_not_in_script_context_str), p);