vim-patch:9.0.0335: checks for Dictionary argument often give a vague error (#23309)

Problem:    Checks for Dictionary argument often give a vague error message.
Solution:   Give a useful error message. (Yegappan Lakshmanan, closes vim/vim#11009)

04c4c5746e

Cherry-pick removal of E922 from docs from patch 9.0.1403.

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
zeertzjq
2023-04-25 21:32:12 +08:00
committed by GitHub
parent 2e8410b7be
commit 43c49746d9
20 changed files with 107 additions and 108 deletions

View File

@@ -5357,8 +5357,7 @@ void common_function(typval_T *argvars, typval_T *rettv, bool is_funcref)
arg_idx = 1;
}
if (dict_idx > 0) {
if (argvars[dict_idx].v_type != VAR_DICT) {
emsg(_("E922: expected a dict"));
if (tv_check_for_dict_arg(argvars, dict_idx) == FAIL) {
xfree(name);
goto theend;
}
@@ -8726,7 +8725,7 @@ int typval_compare(typval_T *typ1, typval_T *typ2, exprtype_T type, bool ic)
const bool type_is = type == EXPR_IS || type == EXPR_ISNOT;
if (type_is && typ1->v_type != typ2->v_type) {
// For "is" a different type always means false, for "notis"
// For "is" a different type always means false, for "isnot"
// it means true.
n1 = type == EXPR_ISNOT;
} else if (typ1->v_type == VAR_BLOB || typ2->v_type == VAR_BLOB) {