comparison 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
comparison
equal deleted inserted replaced
28010:c968191a8557 28011:d10d5cc8e657
1379 *res = val; 1379 *res = val;
1380 return OK; 1380 return OK;
1381 } 1381 }
1382 1382
1383 /* 1383 /*
1384 * Compare v:null/v:none with another type. Return TRUE if the value is NULL. 1384 * Compare v:null with another type. Return TRUE if the value is NULL.
1385 */ 1385 */
1386 int 1386 int
1387 typval_compare_null(typval_T *tv1, typval_T *tv2) 1387 typval_compare_null(typval_T *tv1, typval_T *tv2)
1388 { 1388 {
1389 if ((tv1->v_type == VAR_SPECIAL && tv1->vval.v_number == VVAL_NULL) 1389 if ((tv1->v_type == VAR_SPECIAL && tv1->vval.v_number == VVAL_NULL)
1415 break; 1415 break;
1416 #endif 1416 #endif
1417 default: break; 1417 default: break;
1418 } 1418 }
1419 } 1419 }
1420 if (!in_vim9script())
1421 return FALSE; // backwards compatible
1422
1420 semsg(_(e_cannot_compare_str_with_str), 1423 semsg(_(e_cannot_compare_str_with_str),
1421 vartype_name(tv1->v_type), vartype_name(tv2->v_type)); 1424 vartype_name(tv1->v_type), vartype_name(tv2->v_type));
1422 return MAYBE; 1425 return MAYBE;
1423 } 1426 }
1424 1427