Skip to content

Commit de16fbc

Browse files
committed
vim-patch:8.2.0045: script test fails
Problem: Script test fails. Solution: For numbers "is" and "isnot" work like "==" and "!=". vim/vim@ec57ec6
1 parent 53cbfd0 commit de16fbc

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/nvim/eval.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10647,7 +10647,8 @@ int typval_compare(
1064710647
}
1064810648
}
1064910649
} else if (tv_is_func(*typ1) || tv_is_func(*typ2)) {
10650-
if (type != ETYPE_EQUAL && type != ETYPE_NEQUAL) {
10650+
if (type != ETYPE_EQUAL && type != ETYPE_NEQUAL
10651+
&& type != ETYPE_IS && type != ETYPE_ISNOT) {
1065110652
EMSG(_("E694: Invalid operation for Funcrefs"));
1065210653
tv_clear(typ1);
1065310654
return FAIL;
@@ -10680,15 +10681,15 @@ int typval_compare(
1068010681
const float_T f2 = tv_get_float(typ2);
1068110682
n1 = false;
1068210683
switch (type) {
10684+
case ETYPE_IS:
1068310685
case ETYPE_EQUAL: n1 = f1 == f2; break;
10686+
case ETYPE_ISNOT:
1068410687
case ETYPE_NEQUAL: n1 = f1 != f2; break;
1068510688
case ETYPE_GREATER: n1 = f1 > f2; break;
1068610689
case ETYPE_GEQUAL: n1 = f1 >= f2; break;
1068710690
case ETYPE_SMALLER: n1 = f1 < f2; break;
1068810691
case ETYPE_SEQUAL: n1 = f1 <= f2; break;
1068910692
case ETYPE_UNKNOWN:
10690-
case ETYPE_IS:
10691-
case ETYPE_ISNOT:
1069210693
case ETYPE_MATCH:
1069310694
case ETYPE_NOMATCH: break; // avoid gcc warning
1069410695
}
@@ -10699,15 +10700,15 @@ int typval_compare(
1069910700
n1 = tv_get_number(typ1);
1070010701
n2 = tv_get_number(typ2);
1070110702
switch (type) {
10703+
case ETYPE_IS:
1070210704
case ETYPE_EQUAL: n1 = n1 == n2; break;
10705+
case ETYPE_ISNOT:
1070310706
case ETYPE_NEQUAL: n1 = n1 != n2; break;
1070410707
case ETYPE_GREATER: n1 = n1 > n2; break;
1070510708
case ETYPE_GEQUAL: n1 = n1 >= n2; break;
1070610709
case ETYPE_SMALLER: n1 = n1 < n2; break;
1070710710
case ETYPE_SEQUAL: n1 = n1 <= n2; break;
1070810711
case ETYPE_UNKNOWN:
10709-
case ETYPE_IS:
10710-
case ETYPE_ISNOT:
1071110712
case ETYPE_MATCH:
1071210713
case ETYPE_NOMATCH: break; // avoid gcc warning
1071310714
}
@@ -10724,7 +10725,9 @@ int typval_compare(
1072410725
}
1072510726
n1 = false;
1072610727
switch (type) {
10728+
case ETYPE_IS:
1072710729
case ETYPE_EQUAL: n1 = i == 0; break;
10730+
case ETYPE_ISNOT:
1072810731
case ETYPE_NEQUAL: n1 = i != 0; break;
1072910732
case ETYPE_GREATER: n1 = i > 0; break;
1073010733
case ETYPE_GEQUAL: n1 = i >= 0; break;
@@ -10738,8 +10741,6 @@ int typval_compare(
1073810741
n1 = !n1;
1073910742
}
1074010743
break;
10741-
case ETYPE_IS:
10742-
case ETYPE_ISNOT:
1074310744
case ETYPE_UNKNOWN: break; // avoid gcc warning
1074410745
}
1074510746
}

0 commit comments

Comments
 (0)