diff src/eval.c @ 24890:0cba2be8cbd7 v8.2.2983

patch 8.2.2983: Vim9: an inline function requires specifying the return type Commit: https://github.com/vim/vim/commit/a9931535387e5eb4e6ce62f2a661484de4a1757d Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jun 12 15:58:16 2021 +0200 patch 8.2.2983: Vim9: an inline function requires specifying the return type Problem: Vim9: an inline function requires specifying the return type. Solution: Make the return type optional.
author Bram Moolenaar <Bram@vim.org>
date Sat, 12 Jun 2021 16:00:04 +0200
parents d254f5c78b5a
children e61a2085c89b
line wrap: on
line diff
--- a/src/eval.c
+++ b/src/eval.c
@@ -3530,9 +3530,13 @@ eval7(
 		    {
 			ufunc_T *ufunc = rettv->vval.v_partial->pt_func;
 
-			// compile it here to get the return type
+			// Compile it here to get the return type.  The return
+			// type is optional, when it's missing use t_unknown.
+			// This is recognized in compile_return().
+			if (ufunc->uf_ret_type->tt_type == VAR_VOID)
+			    ufunc->uf_ret_type = &t_unknown;
 			if (compile_def_function(ufunc,
-					 TRUE, PROFILING(ufunc), NULL) == FAIL)
+					 FALSE, PROFILING(ufunc), NULL) == FAIL)
 			{
 			    clear_tv(rettv);
 			    ret = FAIL;