Skip to content

Commit

Permalink
patch 8.2.3056: Vim9: using default value in lambda gives confusing e…
Browse files Browse the repository at this point in the history
…rror

Problem:    Vim9: using default value in lambda gives confusing error.
Solution:   Pass "default_args" on the first pass to get the arguments.
            (closes #8455)
  • Loading branch information
brammool committed Jun 26, 2021
1 parent 3a3b10e commit 14ded11
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/testdir/test_vim9_func.vim
Expand Up @@ -917,6 +917,12 @@ def Test_call_lambda_args()
CheckDefFailure(lines, 'E1167:')
CheckScriptFailure(['vim9script'] + lines, 'E1168:')

lines =<< trim END
var Ref: func(any, ?any): bool
Ref = (_, y = 1) => false
END
CheckDefAndScriptFailure(lines, 'E1172:')

lines =<< trim END
def ShadowLocal()
var one = 1
Expand Down
2 changes: 1 addition & 1 deletion src/userfunc.c
Expand Up @@ -1222,7 +1222,7 @@ get_lambda_tv(
s = *arg + 1;
ret = get_function_args(&s, equal_arrow ? ')' : '-', NULL,
types_optional ? &argtypes : NULL, types_optional, evalarg,
NULL, NULL, TRUE, NULL, NULL);
NULL, &default_args, TRUE, NULL, NULL);
if (ret == FAIL || skip_arrow(s, equal_arrow, &ret_type, NULL) == NULL)
{
if (types_optional)
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -755,6 +755,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
3056,
/**/
3055,
/**/
Expand Down

0 comments on commit 14ded11

Please sign in to comment.