Mercurial > vim
diff src/vim9type.c @ 29780:9f8dd1b77563 v9.0.0229
patch 9.0.0229: Vim9: error message for missing type is not clear
Commit: https://github.com/vim/vim/commit/62e0e2e54b34b618500be4521ab1c33e1c378b42
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 20 12:07:58 2022 +0100
patch 9.0.0229: Vim9: error message for missing type is not clear
Problem: Vim9: error message for missing type is not clear.
Solution: Mention the context. (issue https://github.com/vim/vim/issues/10944)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 20 Aug 2022 13:15:03 +0200 |
parents | 49d8b54802f3 |
children | d751e924cc29 |
line wrap: on
line diff
--- a/src/vim9type.c +++ b/src/vim9type.c @@ -879,6 +879,7 @@ skip_type(char_u *start, int optional) /* * Parse the member type: "<type>" and return "type" with the member set. * Use "type_gap" if a new type needs to be added. + * "info" is extra information for an error message. * Returns NULL in case of failure. */ static type_T * @@ -886,8 +887,10 @@ parse_type_member( char_u **arg, type_T *type, garray_T *type_gap, - int give_error) + int give_error, + char *info) { + char_u *arg_start = *arg; type_T *member_type; int prev_called_emsg = called_emsg; @@ -898,7 +901,7 @@ parse_type_member( if (*skipwhite(*arg) == '<') semsg(_(e_no_white_space_allowed_before_str_str), "<", *arg); else - emsg(_(e_missing_type)); + semsg(_(e_missing_type_after_str), info); } return NULL; } @@ -912,7 +915,7 @@ parse_type_member( if (**arg != '>' && called_emsg == prev_called_emsg) { if (give_error) - emsg(_(e_missing_gt_after_type)); + semsg(_(e_missing_gt_after_type_str), arg_start); return NULL; } ++*arg; @@ -971,7 +974,7 @@ parse_type(char_u **arg, garray_T *type_ { *arg += len; return parse_type_member(arg, &t_dict_any, - type_gap, give_error); + type_gap, give_error, "dict"); } break; case 'f': @@ -1115,7 +1118,7 @@ parse_type(char_u **arg, garray_T *type_ { *arg += len; return parse_type_member(arg, &t_list_any, - type_gap, give_error); + type_gap, give_error, "list"); } break; case 'n':