forked from aniani/vim
patch 9.0.2184: Vim9: inconsistent :type/:class messages
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>
This commit is contained in:
committed by
Christian Brabandt
parent
18ab6c3392
commit
e75fde6b04
38
src/typval.c
38
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)
|
||||
|
Reference in New Issue
Block a user