Skip to content

Commit e98f60a

Browse files
committed
patch 8.2.2642: Vim9: no clear error for wrong inline function
Problem: Vim9: no clear error for wrong inline function. Solution: Check for something following the "{".
1 parent 2cec027 commit e98f60a

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/testdir/test_vim9_expr.vim

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1963,6 +1963,11 @@ def Test_expr7_lambda_block()
19631963
assert_equal(['no', 'yes', 'no'], dll)
19641964
END
19651965
CheckDefAndScriptSuccess(lines)
1966+
1967+
lines =<< trim END
1968+
map([1, 2], (k, v) => { redrawt })
1969+
END
1970+
CheckDefAndScriptFailure(lines, 'E488')
19661971
enddef
19671972

19681973
def NewLambdaWithComments(): func

src/userfunc.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,10 +954,15 @@ lambda_function_body(
954954
int lnum_save = -1;
955955
linenr_T sourcing_lnum_top = SOURCING_LNUM;
956956

957+
if (!ends_excmd2(*arg, skipwhite(*arg + 1)))
958+
{
959+
semsg(_(e_trailing_arg), *arg + 1);
960+
return FAIL;
961+
}
962+
957963
CLEAR_FIELD(eap);
958964
eap.cmdidx = CMD_block;
959965
eap.forceit = FALSE;
960-
eap.arg = *arg + 1;
961966
eap.cmdlinep = &cmdline;
962967
eap.skip = !evaluate;
963968
if (evalarg->eval_cctx != NULL)

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2642,
753755
/**/
754756
2641,
755757
/**/

0 commit comments

Comments
 (0)