]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.3238: Vim9: error message does not indicate the location v8.2.3238
authorBram Moolenaar <Bram@vim.org>
Wed, 28 Jul 2021 18:52:13 +0000 (20:52 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 28 Jul 2021 18:52:13 +0000 (20:52 +0200)
Problem:    Vim9: error message does not indicate the location.
Solution:   Add the relevant text. (issue #8634)

src/errors.h
src/testdir/test_vim9_expr.vim
src/version.c
src/vim9compile.c

index 3cbdb53ee9b48375af7acb66737b81a6cf08fa03..40925f89e6d6f1d5a75d27a6389e5075f4737478 100644 (file)
@@ -639,3 +639,5 @@ EXTERN char e_list_or_dict_required_for_argument_nr[]
        INIT(= N_("E1227: List or Dictionary required for argument %d"));
 EXTERN char e_list_or_dict_or_blob_required_for_argument_nr[]
        INIT(= N_("E1228: List or Dictionary or Blob required for argument %d"));
+EXTERN char e_expected_dictionary_for_using_key_str_but_got_str[]
+       INIT(= N_("E1229: Expected dictionary for using key \"%s\", but got %s"));
index 88f725b43f30d647b1bb4eea2e91550032fff644..f207056fc35baaa42484c0065e56f1a88019333f 100644 (file)
@@ -3114,7 +3114,7 @@ func Test_expr7_fails()
   call CheckDefExecAndScriptFailure(["var x = +g:alist"], 'E745:', 1)
   call CheckDefExecAndScriptFailure(["var x = +g:adict"], 'E728:', 1)
 
-  call CheckDefAndScriptFailure2(["var x = ''", "var y = x.memb"], 'E715:', 'E488:', 2)
+  call CheckDefAndScriptFailure2(["var x = ''", "var y = x.memb"], 'E1229: Expected dictionary for using key "memb", but got string', 'E488:', 2)
 
   call CheckDefAndScriptFailure2(["'yes'->", "Echo()"], 'E488: Trailing characters: ->', 'E260: Missing name after ->', 1)
 
index eb656652f5758a6f3a671c933d32e8b3f7c5cc4a..6a8f7c8af96fd2ada94648313bc4192e2e9d8f0b 100644 (file)
@@ -755,6 +755,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3238,
 /**/
     3237,
 /**/
index 0d54db3d5b65038bf4a1a8ecaf2a10a0accdb001..cb00f0348486a32b2768208986a088fdd11233d7 100644 (file)
@@ -2177,7 +2177,11 @@ generate_STRINGMEMBER(cctx_T *cctx, char_u *name, size_t len)
     type = ((type_T **)stack->ga_data)[stack->ga_len - 1];
     if (type->tt_type != VAR_DICT && type != &t_any)
     {
-       emsg(_(e_dictreq));
+       char *tofree;
+
+       semsg(_(e_expected_dictionary_for_using_key_str_but_got_str),
+                                              name, type_name(type, &tofree));
+       vim_free(tofree);
        return FAIL;
     }
     // change dict type to dict member type