changeset 18968:24941a950cc7 v8.2.0045

patch 8.2.0045: script test fails Commit: https://github.com/vim/vim/commit/ec57ec692eb228ee061824a190d7c451f029c430 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Dec 25 19:33:22 2019 +0100 patch 8.2.0045: script test fails Problem: Script test fails. Solution: For numbers "is" and "isnot" work like "==" and "!=".
author Bram Moolenaar <Bram@vim.org>
date Wed, 25 Dec 2019 19:45:03 +0100
parents 10693b01cc98
children 23d5acda7107
files src/eval.c src/version.c
diffstat 2 files changed, 13 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/eval.c
+++ b/src/eval.c
@@ -6261,7 +6261,8 @@ typval_compare(
     else if (typ1->v_type == VAR_FUNC || typ2->v_type == VAR_FUNC
 	|| typ1->v_type == VAR_PARTIAL || typ2->v_type == VAR_PARTIAL)
     {
-	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"));
 	    clear_tv(typ1);
@@ -6306,15 +6307,15 @@ typval_compare(
 	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
 	}
@@ -6322,9 +6323,9 @@ typval_compare(
 #endif
 
     /*
-	* If one of the two variables is a number, compare as a number.
-	* When using "=~" or "!~", always compare as string.
-	*/
+     * If one of the two variables is a number, compare as a number.
+     * When using "=~" or "!~", always compare as string.
+     */
     else if ((typ1->v_type == VAR_NUMBER || typ2->v_type == VAR_NUMBER)
 	    && type != ETYPE_MATCH && type != ETYPE_NOMATCH)
     {
@@ -6332,15 +6333,15 @@ typval_compare(
 	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
 	}
@@ -6356,7 +6357,9 @@ 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;
@@ -6370,8 +6373,6 @@ typval_compare(
 			n1 = !n1;
 		    break;
 
-	    case ETYPE_IS:
-	    case ETYPE_ISNOT:
 	    case ETYPE_UNKNOWN:  break;  // avoid gcc warning
 	}
     }
--- a/src/version.c
+++ b/src/version.c
@@ -743,6 +743,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    45,
+/**/
     44,
 /**/
     43,