Skip to content

Commit bc327cc

Browse files
committed
patch 8.2.2544: Vim9: error for argument when checking for lambda
Problem: Vim9: error for argument when checking for lambda. Solution: Respect the skip flag. (closes #7887)
1 parent 9cb577a commit bc327cc

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

src/testdir/test_vim9_expr.vim

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1922,6 +1922,14 @@ def Test_expr7_lambda()
19221922

19231923
CheckDefSuccess(['var Fx = (a) => [0,', ' 1]'])
19241924
CheckDefFailure(['var Fx = (a) => [0', ' 1]'], 'E696:', 2)
1925+
1926+
# no error for existing script variable when checking for lambda
1927+
lines =<< trim END
1928+
vim9script
1929+
var name = 0
1930+
eval (name + 2) / 3
1931+
END
1932+
CheckScriptSuccess(lines)
19251933
enddef
19261934

19271935
def NewLambdaWithComments(): func

src/userfunc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ one_function_arg(
8282
}
8383

8484
// Vim9 script: cannot use script var name for argument.
85-
if (argtypes != NULL && script_var_exists(arg, p - arg, FALSE, NULL) == OK)
85+
if (!skip && argtypes != NULL && script_var_exists(arg, p - arg,
86+
FALSE, NULL) == OK)
8687
{
8788
semsg(_(e_variable_already_declared_in_script), arg);
8889
return arg;

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+
2544,
753755
/**/
754756
2543,
755757
/**/

0 commit comments

Comments
 (0)