aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-04-08 07:47:53 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-04-11 16:35:14 -0400
commitde16fbcc57e8a1bcd39edeaa987b310e06b03421 (patch)
treedb471bbccc193f1c319eface736c021e65a81bf3
parent53cbfd02209caee54190aae7f1ff8b407ae4039b (diff)
downloadrneovim-de16fbcc57e8a1bcd39edeaa987b310e06b03421.tar.gz
rneovim-de16fbcc57e8a1bcd39edeaa987b310e06b03421.tar.bz2
rneovim-de16fbcc57e8a1bcd39edeaa987b310e06b03421.zip
vim-patch:8.2.0045: script test fails
Problem: Script test fails. Solution: For numbers "is" and "isnot" work like "==" and "!=". https://github.com/vim/vim/commit/ec57ec692eb228ee061824a190d7c451f029c430
-rw-r--r--src/nvim/eval.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 9f6ddebdd5..8439515a71 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -10647,7 +10647,8 @@ int typval_compare(
}
}
} else if (tv_is_func(*typ1) || tv_is_func(*typ2)) {
- if (type != ETYPE_EQUAL && type != ETYPE_NEQUAL) {
+ if (type != ETYPE_EQUAL && type != ETYPE_NEQUAL
+ && type != ETYPE_IS && type != ETYPE_ISNOT) {
EMSG(_("E694: Invalid operation for Funcrefs"));
tv_clear(typ1);
return FAIL;
@@ -10680,15 +10681,15 @@ int typval_compare(
const float_T f2 = tv_get_float(typ2);
n1 = false;
switch (type) {
+ case ETYPE_IS:
case ETYPE_EQUAL: n1 = f1 == f2; break;
+ case ETYPE_ISNOT:
case ETYPE_NEQUAL: n1 = f1 != f2; break;
case ETYPE_GREATER: n1 = f1 > f2; break;
case ETYPE_GEQUAL: n1 = f1 >= f2; break;
case ETYPE_SMALLER: n1 = f1 < f2; break;
case ETYPE_SEQUAL: n1 = f1 <= f2; break;
case ETYPE_UNKNOWN:
- case ETYPE_IS:
- case ETYPE_ISNOT:
case ETYPE_MATCH:
case ETYPE_NOMATCH: break; // avoid gcc warning
}
@@ -10699,15 +10700,15 @@ int typval_compare(
n1 = tv_get_number(typ1);
n2 = tv_get_number(typ2);
switch (type) {
+ case ETYPE_IS:
case ETYPE_EQUAL: n1 = n1 == n2; break;
+ case ETYPE_ISNOT:
case ETYPE_NEQUAL: n1 = n1 != n2; break;
case ETYPE_GREATER: n1 = n1 > n2; break;
case ETYPE_GEQUAL: n1 = n1 >= n2; break;
case ETYPE_SMALLER: n1 = n1 < n2; break;
case ETYPE_SEQUAL: n1 = n1 <= n2; break;
case ETYPE_UNKNOWN:
- case ETYPE_IS:
- case ETYPE_ISNOT:
case ETYPE_MATCH:
case ETYPE_NOMATCH: break; // avoid gcc warning
}
@@ -10724,7 +10725,9 @@ int typval_compare(
}
n1 = false;
switch (type) {
+ case ETYPE_IS:
case ETYPE_EQUAL: n1 = i == 0; break;
+ case ETYPE_ISNOT:
case ETYPE_NEQUAL: n1 = i != 0; break;
case ETYPE_GREATER: n1 = i > 0; break;
case ETYPE_GEQUAL: n1 = i >= 0; break;
@@ -10738,8 +10741,6 @@ int typval_compare(
n1 = !n1;
}
break;
- case ETYPE_IS:
- case ETYPE_ISNOT:
case ETYPE_UNKNOWN: break; // avoid gcc warning
}
}