Mercurial > vim
comparison src/typval.c @ 28103:1615d305c71d v8.2.4576
patch 8.2.4576: Vim9: error for comparing with null can be annoying
Commit: https://github.com/vim/vim/commit/056678184f679c2989b73bd48eda112f3c79a62f
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Mar 15 20:21:33 2022 +0000
patch 8.2.4576: Vim9: error for comparing with null can be annoying
Problem: Vim9: error for comparing with null can be annoying.
Solution: Allow comparing anything with null. (closes https://github.com/vim/vim/issues/9948)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 15 Mar 2022 21:30:03 +0100 |
parents | 53e2bf6032e5 |
children | 662d2d5db9a6 |
comparison
equal
deleted
inserted
replaced
28102:9aa6dfbd4698 | 28103:1615d305c71d |
---|---|
1415 break; | 1415 break; |
1416 #endif | 1416 #endif |
1417 default: break; | 1417 default: break; |
1418 } | 1418 } |
1419 } | 1419 } |
1420 if (!in_vim9script()) | 1420 // although comparing null with number, float or bool is not very usefule |
1421 return FALSE; // backwards compatible | 1421 // we won't give an error |
1422 | 1422 return FALSE; |
1423 semsg(_(e_cannot_compare_str_with_str), | |
1424 vartype_name(tv1->v_type), vartype_name(tv2->v_type)); | |
1425 return MAYBE; | |
1426 } | 1423 } |
1427 | 1424 |
1428 /* | 1425 /* |
1429 * Compare "tv1" to "tv2" as blobs acording to "type". | 1426 * Compare "tv1" to "tv2" as blobs acording to "type". |
1430 * Put the result, false or true, in "res". | 1427 * Put the result, false or true, in "res". |