summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/version.c2
-rw-r--r--src/vim9cmds.c5
2 files changed, 6 insertions, 1 deletions
diff --git a/src/version.c b/src/version.c
index 154b7e314a..f273a155f8 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 83ff6991bd..27322df1c2 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;