changeset 27299:7218ad7a55d2 v8.2.4178

patch 8.2.4178: Vim9: invalid error for return type of lambda when debugging Commit: https://github.com/vim/vim/commit/0bfa84916d110d4f4d863e91e144ff05ba431316 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jan 22 12:27:04 2022 +0000 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 https://github.com/vim/vim/issues/9589)
author Bram Moolenaar <Bram@vim.org>
date Sat, 22 Jan 2022 13:30:05 +0100
parents 3e5e360d9096
children 160b87e56c45
files src/version.c src/vim9cmds.c
diffstat 2 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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,
--- a/src/vim9cmds.c
+++ b/src/vim9cmds.c
@@ -2196,7 +2196,10 @@ compile_return(char_u *arg, int check_re
 
     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;