diff src/eval.c @ 25036:3b8d3b383fd6 v8.2.3055

patch 8.2.3055: strange error for assigning to "x.key" on non-dictionary Commit: https://github.com/vim/vim/commit/3a3b10e87a10dd0bc355618dbfc4a0a6c828aad7 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jun 26 15:00:59 2021 +0200 patch 8.2.3055: strange error for assigning to "x.key" on non-dictionary Problem: Strange error for assigning to "x.key" on non-dictionary. Solution: Add a specific error message. (closes https://github.com/vim/vim/issues/8451)
author Bram Moolenaar <Bram@vim.org>
date Sat, 26 Jun 2021 15:15:03 +0200
parents 21ec48d542a8
children 64bef59f11ef
line wrap: on
line diff
--- a/src/eval.c
+++ b/src/eval.c
@@ -924,8 +924,14 @@ get_lval(
     lp->ll_tv = &v->di_tv;
     var1.v_type = VAR_UNKNOWN;
     var2.v_type = VAR_UNKNOWN;
-    while (*p == '[' || (*p == '.' && lp->ll_tv->v_type == VAR_DICT))
+    while (*p == '[' || (*p == '.' && p[1] != '=' && p[1] != '.'))
     {
+	if (*p == '.' && lp->ll_tv->v_type != VAR_DICT)
+	{
+	    if (!quiet)
+		semsg(_(e_dot_can_only_be_used_on_dictionary_str), name);
+	    return NULL;
+	}
 	if (!(lp->ll_tv->v_type == VAR_LIST && lp->ll_tv->vval.v_list != NULL)
 		&& !(lp->ll_tv->v_type == VAR_DICT)
 		&& !(lp->ll_tv->v_type == VAR_BLOB