Skip to content

Commit d47c397

Browse files
committed
patch 8.2.3238: Vim9: error message does not indicate the location
Problem: Vim9: error message does not indicate the location. Solution: Add the relevant text. (issue #8634)
1 parent 53f7fcc commit d47c397

4 files changed

Lines changed: 10 additions & 2 deletions

File tree

src/errors.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,3 +639,5 @@ EXTERN char e_list_or_dict_required_for_argument_nr[]
639639
INIT(= N_("E1227: List or Dictionary required for argument %d"));
640640
EXTERN char e_list_or_dict_or_blob_required_for_argument_nr[]
641641
INIT(= N_("E1228: List or Dictionary or Blob required for argument %d"));
642+
EXTERN char e_expected_dictionary_for_using_key_str_but_got_str[]
643+
INIT(= N_("E1229: Expected dictionary for using key \"%s\", but got %s"));

src/testdir/test_vim9_expr.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3114,7 +3114,7 @@ func Test_expr7_fails()
31143114
call CheckDefExecAndScriptFailure(["var x = +g:alist"], 'E745:', 1)
31153115
call CheckDefExecAndScriptFailure(["var x = +g:adict"], 'E728:', 1)
31163116

3117-
call CheckDefAndScriptFailure2(["var x = ''", "var y = x.memb"], 'E715:', 'E488:', 2)
3117+
call CheckDefAndScriptFailure2(["var x = ''", "var y = x.memb"], 'E1229: Expected dictionary for using key "memb", but got string', 'E488:', 2)
31183118

31193119
call CheckDefAndScriptFailure2(["'yes'->", "Echo()"], 'E488: Trailing characters: ->', 'E260: Missing name after ->', 1)
31203120

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,8 @@ static char *(features[]) =
755755

756756
static int included_patches[] =
757757
{ /* Add new patch number below this line */
758+
/**/
759+
3238,
758760
/**/
759761
3237,
760762
/**/

src/vim9compile.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2177,7 +2177,11 @@ generate_STRINGMEMBER(cctx_T *cctx, char_u *name, size_t len)
21772177
type = ((type_T **)stack->ga_data)[stack->ga_len - 1];
21782178
if (type->tt_type != VAR_DICT && type != &t_any)
21792179
{
2180-
emsg(_(e_dictreq));
2180+
char *tofree;
2181+
2182+
semsg(_(e_expected_dictionary_for_using_key_str_but_got_str),
2183+
name, type_name(type, &tofree));
2184+
vim_free(tofree);
21812185
return FAIL;
21822186
}
21832187
// change dict type to dict member type

0 commit comments

Comments
 (0)