patch 8.2.4634: Vim9: cannot initialize a variable to null_list
Problem: Vim9: cannot initialize a variable to null_list.
Solution: Give negative count to NEWLIST. (closes #10027)
Also fix inconsistencies in comparing with null values.
diff --git a/src/typval.c b/src/typval.c
index d0c937e..50b1d62 100644
--- a/src/typval.c
+++ b/src/typval.c
@@ -1314,6 +1314,19 @@
return FAIL;
}
}
+#ifdef FEAT_JOB_CHANNEL
+ else if (tv1->v_type == tv2->v_type
+ && (tv1->v_type == VAR_CHANNEL || tv1->v_type == VAR_JOB)
+ && (type == EXPR_NEQUAL || type == EXPR_EQUAL))
+ {
+ if (tv1->v_type == VAR_CHANNEL)
+ n1 = tv1->vval.v_channel == tv2->vval.v_channel;
+ else
+ n1 = tv1->vval.v_job == tv2->vval.v_job;
+ if (type == EXPR_NEQUAL)
+ n1 = !n1;
+ }
+#endif
else
{
if (typval_compare_string(tv1, tv2, type, ic, &res) == FAIL)
@@ -1417,7 +1430,7 @@
default: break;
}
}
- // although comparing null with number, float or bool is not very usefule
+ // although comparing null with number, float or bool is not very useful
// we won't give an error
return FALSE;
}