diff src/typval.c @ 28011:d10d5cc8e657 v8.2.4530

patch 8.2.4530: making comparison with null work changes legacy behavior Commit: https://github.com/vim/vim/commit/f3507a517c38bee5498736607ead64c8ae6b5941 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Mar 9 11:56:21 2022 +0000 patch 8.2.4530: making comparison with null work changes legacy behavior Problem: Making comparison with null work changes legacy behavior. Solution: Only use the better comparison in Vim9 script. (closes https://github.com/vim/vim/issues/9910)
author Bram Moolenaar <Bram@vim.org>
date Wed, 09 Mar 2022 13:00:03 +0100
parents ca7a207d83cd
children 53e2bf6032e5
line wrap: on
line diff
--- a/src/typval.c
+++ b/src/typval.c
@@ -1381,7 +1381,7 @@ typval_compare_list(
 }
 
 /*
- * Compare v:null/v:none with another type.  Return TRUE if the value is NULL.
+ * Compare v:null with another type.  Return TRUE if the value is NULL.
  */
     int
 typval_compare_null(typval_T *tv1, typval_T *tv2)
@@ -1417,6 +1417,9 @@ typval_compare_null(typval_T *tv1, typva
 	    default: break;
 	}
     }
+    if (!in_vim9script())
+	return FALSE;  // backwards compatible
+
     semsg(_(e_cannot_compare_str_with_str),
 			 vartype_name(tv1->v_type), vartype_name(tv2->v_type));
     return MAYBE;