Mercurial > vim
diff src/vim9instr.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 | 3bc0a639dfb0 |
children | 088d8dc22045 |
line wrap: on
line diff
--- a/src/vim9instr.c +++ b/src/vim9instr.c @@ -397,20 +397,8 @@ get_compare_isn( vartype_name(vartype1), vartype_name(vartype2)); return ISN_DROP; } - switch (vartype1 == VAR_SPECIAL ? vartype2 : vartype1) - { - case VAR_BLOB: break; - case VAR_CHANNEL: break; - case VAR_DICT: break; - case VAR_FUNC: break; - case VAR_JOB: break; - case VAR_LIST: break; - case VAR_PARTIAL: break; - case VAR_STRING: break; - default: semsg(_(e_cannot_compare_str_with_str), - vartype_name(vartype1), vartype_name(vartype2)); - return ISN_DROP; - } + // although comparing null with number, float or bool is not useful, we + // allow it isntype = ISN_COMPARENULL; }