diff options
author | Ernie Rael <errael@raelity.com> | 2023-12-21 17:18:54 +0100 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2023-12-21 17:18:54 +0100 |
commit | e75fde6b043371a188660c3423e48b1b7fd7e14b (patch) | |
tree | 39a7e955cf230c56215182d1cc59c355b61c3d4f /src/typval.c | |
parent | 18ab6c3392ef83abf078042e233d085fe80b6c06 (diff) |
patch 9.0.2184: Vim9: inconsistent :type/:class messagesv9.0.2184
Problem: Vim9: inconsistent :type/:class messages
Solution: Update the Messages (Ernie Rael)
closes: #13706
Signed-off-by: Ernie Rael <errael@raelity.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/typval.c')
-rw-r--r-- | src/typval.c | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/src/typval.c b/src/typval.c index 65cd912c32..35c9e24eb8 100644 --- a/src/typval.c +++ b/src/typval.c @@ -262,7 +262,8 @@ tv_get_bool_or_number_chk( emsg(_(e_using_blob_as_number)); break; case VAR_CLASS: - emsg(_(e_using_class_as_number)); + case VAR_TYPEALIAS: + check_typval_is_value(varp); break; case VAR_OBJECT: emsg(_(e_using_object_as_number)); @@ -270,10 +271,6 @@ tv_get_bool_or_number_chk( case VAR_VOID: emsg(_(e_cannot_use_void_value)); break; - case VAR_TYPEALIAS: - semsg(_(e_using_typealias_as_number), - varp->vval.v_typealias->ta_name); - break; case VAR_UNKNOWN: case VAR_ANY: case VAR_INSTR: @@ -383,7 +380,8 @@ tv_get_float_chk(typval_T *varp, int *error) emsg(_(e_using_blob_as_float)); break; case VAR_CLASS: - emsg(_(e_using_class_as_float)); + case VAR_TYPEALIAS: + check_typval_is_value(varp); break; case VAR_OBJECT: emsg(_(e_using_object_as_float)); @@ -391,10 +389,6 @@ tv_get_float_chk(typval_T *varp, int *error) case VAR_VOID: emsg(_(e_cannot_use_void_value)); break; - case VAR_TYPEALIAS: - semsg(_(e_using_typealias_as_float), - varp->vval.v_typealias->ta_name); - break; case VAR_UNKNOWN: case VAR_ANY: case VAR_INSTR: @@ -1131,7 +1125,8 @@ tv_get_string_buf_chk_strict(typval_T *varp, char_u *buf, int strict) emsg(_(e_using_blob_as_string)); break; case VAR_CLASS: - emsg(_(e_using_class_as_string)); + case VAR_TYPEALIAS: + check_typval_is_value(varp); break; case VAR_OBJECT: emsg(_(e_using_object_as_string)); @@ -1159,10 +1154,6 @@ tv_get_string_buf_chk_strict(typval_T *varp, char_u *buf, int strict) case VAR_VOID: emsg(_(e_cannot_use_void_value)); break; - case VAR_TYPEALIAS: - semsg(_(e_using_typealias_as_string), - varp->vval.v_typealias->ta_name); - break; case VAR_UNKNOWN: case VAR_ANY: case VAR_INSTR: @@ -1358,7 +1349,13 @@ typval_compare( int res = 0; int type_is = type == EXPR_IS || type == EXPR_ISNOT; - if (type_is && tv1->v_type != tv2->v_type) + if (check_typval_is_value(tv1) == FAIL + || check_typval_is_value(tv2) == FAIL) + { + clear_tv(tv1); + return FAIL; + } + else if (type_is && tv1->v_type != tv2->v_type) { // For "is" a different type always means FALSE, for "isnot" // it means TRUE. @@ -1397,15 +1394,6 @@ typval_compare( } n1 = res; } - else if (tv1->v_type == VAR_CLASS || tv2->v_type == VAR_CLASS) - { - if (typval_compare_class(tv1, tv2, type, ic, &res) == FAIL) - { - clear_tv(tv1); - return FAIL; - } - n1 = res; - } else if (tv1->v_type == VAR_OBJECT || tv2->v_type == VAR_OBJECT) { if (typval_compare_object(tv1, tv2, type, ic, &res) == FAIL) |