diff src/vim9type.c @ 23418:681f042ae5ac v8.2.2252

patch 8.2.2252: Vim9: crash when using lambda without return type in dict Commit: https://github.com/vim/vim/commit/6b55377303968e1624339cd95053201d5acdcaa2 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Dec 31 13:31:23 2020 +0100 patch 8.2.2252: Vim9: crash when using lambda without return type in dict Problem: Vim9: crash when using lambda without return type in dict. Solution: Without a return type use t_unknown. (closes https://github.com/vim/vim/issues/7587)
author Bram Moolenaar <Bram@vim.org>
date Thu, 31 Dec 2020 13:45:04 +0100
parents f181fe2150ab
children 62fe9a7fd582
line wrap: on
line diff
--- a/src/vim9type.c
+++ b/src/vim9type.c
@@ -480,7 +480,10 @@ check_type(type_T *expected, type_T *act
 	}
 	else if (expected->tt_type == VAR_FUNC)
 	{
-	    if (expected->tt_member != &t_unknown)
+	    // If the return type is unknown it can be anything, including
+	    // nothing, thus there is no point in checking.
+	    if (expected->tt_member != &t_unknown
+					    && actual->tt_member != &t_unknown)
 		ret = check_type(expected->tt_member, actual->tt_member,
 								     FALSE, 0);
 	    if (ret == OK && expected->tt_argcount != -1