0
0
mirror of https://github.com/vim/vim.git synced 2025-10-01 04:54:07 -04:00

patch 9.0.1436: cannot compare a typed variable with v:none

Problem:    Cannot compare a typed variable with v:none.
Solution:   Allow for "x is v:none" and "x isnot v:none". (issue #12194)
This commit is contained in:
Bram Moolenaar
2023-04-01 22:05:38 +01:00
parent 38d867f041
commit 2ed57ac367
4 changed files with 48 additions and 9 deletions

View File

@@ -413,7 +413,7 @@ generate_two_op(cctx_T *cctx, char_u *op)
*/
static isntype_T
get_compare_isn(
exprtype_T exprtype,
exprtype_T exprtype,
typval_T *tv1,
typval_T *tv2,
type_T *type1,
@@ -485,13 +485,17 @@ get_compare_isn(
return ISN_DROP;
}
if (isntype == ISN_DROP
|| ((exprtype != EXPR_EQUAL && exprtype != EXPR_NEQUAL
&& (vartype1 == VAR_BOOL || vartype1 == VAR_SPECIAL
|| vartype2 == VAR_BOOL || vartype2 == VAR_SPECIAL)))
|| ((exprtype != EXPR_EQUAL && exprtype != EXPR_NEQUAL
&& exprtype != EXPR_IS && exprtype != EXPR_ISNOT
&& (vartype1 == VAR_BLOB || vartype2 == VAR_BLOB
|| vartype1 == VAR_LIST || vartype2 == VAR_LIST))))
|| (isntype != ISN_COMPARENULL
&& (((exprtype != EXPR_EQUAL
&& exprtype != EXPR_NEQUAL
&& (vartype1 == VAR_BOOL || vartype1 == VAR_SPECIAL
|| vartype2 == VAR_BOOL || vartype2 == VAR_SPECIAL)))
|| ((exprtype != EXPR_EQUAL
&& exprtype != EXPR_NEQUAL
&& exprtype != EXPR_IS
&& exprtype != EXPR_ISNOT
&& (vartype1 == VAR_BLOB || vartype2 == VAR_BLOB
|| vartype1 == VAR_LIST || vartype2 == VAR_LIST))))))
{
semsg(_(e_cannot_compare_str_with_str),
vartype_name(vartype1), vartype_name(vartype2));