diff src/vim9type.c @ 28059:230115610b6a v8.2.4554

patch 8.2.4554: Vim9: using null values not sufficiently tested Commit: https://github.com/vim/vim/commit/badf04f5c219743cd6645ff1f1fe88badf4af4c5 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Mar 12 21:28:22 2022 +0000 patch 8.2.4554: Vim9: using null values not sufficiently tested Problem: Vim9: using null values not sufficiently tested. Solution: Add more tests. Fix uncovered problem.
author Bram Moolenaar <Bram@vim.org>
date Sat, 12 Mar 2022 22:30:03 +0100
parents cc7d54a134e4
children 66b245d84f37
line wrap: on
line diff
--- a/src/vim9type.c
+++ b/src/vim9type.c
@@ -1235,6 +1235,19 @@ common_type(type_T *type1, type_T *type2
 	{
 	    type_T *common;
 
+	    // When one of the types is t_func_unknown return the other one.
+	    // Useful if a list or dict item is null_func.
+	    if (type1 == &t_func_unknown)
+	    {
+		*dest = type2;
+		return;
+	    }
+	    if (type2 == &t_func_unknown)
+	    {
+		*dest = type1;
+		return;
+	    }
+
 	    common_type(type1->tt_member, type2->tt_member, &common, type_gap);
 	    if (type1->tt_argcount == type2->tt_argcount
 						    && type1->tt_argcount >= 0)