patch 8.0.0343: b:changedtick can be unlocked
Problem: b:changedtick can be unlocked, even though it has no effect.
(Nikolai Pavlov)
Solution: Add a check and error E940. (closes #1496)
diff --git a/src/eval.c b/src/eval.c
index 0bb1882..3cd73b6 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2882,6 +2882,12 @@
di = find_var(lp->ll_name, NULL, TRUE);
if (di == NULL)
ret = FAIL;
+ else if ((di->di_flags & DI_FLAGS_FIX)
+ && di->di_tv.v_type != VAR_DICT
+ && di->di_tv.v_type != VAR_LIST)
+ /* For historic reasons this error is not given for a list or dict.
+ * E.g., the b: dict could be locked/unlocked. */
+ EMSG2(_("E940: Cannot lock or unlock variable %s"), lp->ll_name);
else
{
if (lock)