diff src/vim9instr.c @ 28008:cc7d54a134e4 v8.2.4529

patch 8.2.4529: Vim9: comparing partial with function fails Commit: https://github.com/vim/vim/commit/ed0c62e7b16b62655824df28cdd6bd75aadbb8fc Author: Bram Moolenaar <Bram@vim.org> Date: Tue Mar 8 19:43:55 2022 +0000 patch 8.2.4529: Vim9: comparing partial with function fails Problem: Vim9: comparing partial with function fails. Solution: Support this comparison. Avoid a crash. (closes https://github.com/vim/vim/issues/9909) Add more test cases.
author Bram Moolenaar <Bram@vim.org>
date Tue, 08 Mar 2022 20:45:03 +0100
parents 1012048eed26
children 0ed38a4e028d
line wrap: on
line diff
--- a/src/vim9instr.c
+++ b/src/vim9instr.c
@@ -370,7 +370,9 @@ get_compare_isn(exprtype_T exprtype, var
     }
     else if (type1 == VAR_ANY || type2 == VAR_ANY
 	    || ((type1 == VAR_NUMBER || type1 == VAR_FLOAT)
-	      && (type2 == VAR_NUMBER || type2 == VAR_FLOAT)))
+			       && (type2 == VAR_NUMBER || type2 == VAR_FLOAT))
+	    || (type1 == VAR_FUNC && type2 == VAR_PARTIAL)
+	    || (type1 == VAR_PARTIAL && type2 == VAR_FUNC))
 	isntype = ISN_COMPAREANY;
     else if (type1 == VAR_SPECIAL || type2 == VAR_SPECIAL)
     {