1
0
forked from aniani/vim

patch 8.2.4178: Vim9: invalid error for return type of lambda when debugging

Problem:    Vim9: invalid error for return type of lambda when debugging.
Solution:   Do not check the return type of a lambda. (closes #9589)
This commit is contained in:
Bram Moolenaar
2022-01-22 12:27:04 +00:00
parent b697dc295d
commit 0bfa84916d
2 changed files with 6 additions and 1 deletions

View File

@@ -2196,7 +2196,10 @@ compile_return(char_u *arg, int check_return_type, int legacy, cctx_T *cctx)
if (*p != NUL && *p != '|' && *p != '\n')
{
if (cctx->ctx_ufunc->uf_ret_type->tt_type == VAR_VOID)
// For a lambda, "return expr" is always used, also when "expr" results
// in a void.
if (cctx->ctx_ufunc->uf_ret_type->tt_type == VAR_VOID
&& (cctx->ctx_ufunc->uf_flags & FC_LAMBDA) == 0)
{
emsg(_(e_returning_value_in_function_without_return_type));
return NULL;