0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

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 #7587)
This commit is contained in:
Bram Moolenaar
2020-12-31 13:31:23 +01:00
parent a04d447d3a
commit 6b55377303
4 changed files with 12 additions and 2 deletions

View File

@@ -480,7 +480,10 @@ check_type(type_T *expected, type_T *actual, int give_msg, int argidx)
}
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