diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-01-22 12:27:04 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-01-22 12:27:04 +0000 |
commit | 0bfa84916d110d4f4d863e91e144ff05ba431316 (patch) | |
tree | ccb6be1680b29acd15c50d9e371e2d3b8c52875c /src | |
parent | b697dc295d0625bf2445649f03019f9b8fccc1a8 (diff) | |
download | vim-git-0bfa84916d110d4f4d863e91e144ff05ba431316.tar.gz |
patch 8.2.4178: Vim9: invalid error for return type of lambda when debuggingv8.2.4178
Problem: Vim9: invalid error for return type of lambda when debugging.
Solution: Do not check the return type of a lambda. (closes #9589)
Diffstat (limited to 'src')
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim9cmds.c | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/version.c b/src/version.c index 154b7e314..f273a155f 100644 --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 4178, +/**/ 4177, /**/ 4176, diff --git a/src/vim9cmds.c b/src/vim9cmds.c index 83ff6991b..27322df1c 100644 --- a/src/vim9cmds.c +++ b/src/vim9cmds.c @@ -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; |