File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -349,3 +349,5 @@ EXTERN char e_cannot_define_autocommands_for_all_events[]
349349 INIT (= N_ ("E1155: Cannot define autocommands for ALL events" ));
350350EXTERN char e_cannot_change_arglist_recursively []
351351 INIT (= N_ ("E1156: Cannot change the argument list recursively" ));
352+ EXTERN char e_missing_return_type []
353+ INIT (= N_ ("E1157: Missing return type" ));
Original file line number Diff line number Diff line change @@ -687,6 +687,13 @@ def Test_call_lambda_args()
687687 CheckDefAndScriptFailure (lines , ' E1012:' )
688688enddef
689689
690+ def Test_lambda_return_type ()
691+ var lines = << trim END
692+ var Ref = (): = > 123
693+ END
694+ CheckDefAndScriptFailure (lines , ' E1157:' , 1 )
695+ enddef
696+
690697def Test_lambda_uses_assigned_var ()
691698 CheckDefSuccess ([
692699 ' var x: any = "aaa"'
Original file line number Diff line number Diff line change @@ -491,6 +491,11 @@ skip_arrow(
491491 s = skipwhite (s + 1 );
492492 * ret_type = s ;
493493 s = skip_type (s , TRUE);
494+ if (s == * ret_type )
495+ {
496+ emsg (_ (e_missing_return_type ));
497+ return NULL ;
498+ }
494499 }
495500 bef = s ;
496501 s = skipwhite (s );
@@ -543,6 +548,7 @@ get_lambda_tv(
543548 char_u * tofree2 = NULL ;
544549 int equal_arrow = * * arg == '(' ;
545550 int white_error = FALSE;
551+ int called_emsg_start = called_emsg ;
546552
547553 if (equal_arrow && !in_vim9script ())
548554 return NOTDONE ;
@@ -560,7 +566,7 @@ get_lambda_tv(
560566 {
561567 if (types_optional )
562568 ga_clear_strings (& argtypes );
563- return NOTDONE ;
569+ return called_emsg == called_emsg_start ? NOTDONE : FAIL ;
564570 }
565571
566572 // Parse the arguments for real.
Original file line number Diff line number Diff line change @@ -750,6 +750,8 @@ static char *(features[]) =
750750
751751static int included_patches [] =
752752{ /* Add new patch number below this line */
753+ /**/
754+ 2445 ,
753755/**/
754756 2444 ,
755757/**/
You can’t perform that action at this time.
0 commit comments