patch 8.1.1188: not all Vim variables require the v: prefix
Problem: Not all Vim variables require the v: prefix.
Solution: When scriptversion is 3 all Vim variables can only be used with
the v: prefix. (Ken Takata, closes #4274)
diff --git a/src/eval.c b/src/eval.c
index 5f45d69..dd66287 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -7672,10 +7672,14 @@
return NULL;
*varname = name;
- /* "version" is "v:version" in all scopes */
- hi = hash_find(&compat_hashtab, name);
- if (!HASHITEM_EMPTY(hi))
- return &compat_hashtab;
+ // "version" is "v:version" in all scopes if scriptversion < 3.
+ // Same for a few other variables marked with VV_COMPAT.
+ if (current_sctx.sc_version < 3)
+ {
+ hi = hash_find(&compat_hashtab, name);
+ if (!HASHITEM_EMPTY(hi))
+ return &compat_hashtab;
+ }
ht = get_funccal_local_ht();
if (ht == NULL)