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>
diff --git a/src/typval.c b/src/typval.c
index 65cd912..35c9e24 100644
--- a/src/typval.c
+++ b/src/typval.c
@@ -262,7 +262,8 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
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)