summaryrefslogtreecommitdiff
path: root/src/typval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-03-02 13:13:30 +0000
committerBram Moolenaar <Bram@vim.org>2022-03-02 13:13:30 +0000
commitc6e9d7063d275139d3c207435d293271c8b556ab (patch)
tree0ebcf48be9c54b8201167e854ea633563fec624c /src/typval.c
parentf6b0c79742727948edee78cb1a3a9a4e3be8b0fd (diff)
downloadvim-git-c6e9d7063d275139d3c207435d293271c8b556ab.tar.gz
patch 8.2.4489: failing test for comparing v:null with numberv8.2.4489
Problem: Failing test for comparing v:null with number. Solution: Allow comparing v:null with number in legacy script. (Ken Takata, closes #9873) Also do this for float.
Diffstat (limited to 'src/typval.c')
-rw-r--r--src/typval.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/typval.c b/src/typval.c
index 38b81e884..e89ba9e76 100644
--- a/src/typval.c
+++ b/src/typval.c
@@ -1405,6 +1405,15 @@ typval_compare_null(typval_T *tv1, typval_T *tv2)
case VAR_LIST: return tv->vval.v_list == NULL;
case VAR_PARTIAL: return tv->vval.v_partial == NULL;
case VAR_STRING: return tv->vval.v_string == NULL;
+
+ case VAR_NUMBER: if (!in_vim9script())
+ return tv->vval.v_number == 0;
+ break;
+#ifdef FEAT_FLOAT
+ case VAR_FLOAT: if (!in_vim9script())
+ return tv->vval.v_float == 0.0;
+ break;
+#endif
default: break;
}
}