Skip to content

Commit

Permalink
patch 8.2.3370: Vim9: no check for white space before type in declara…
Browse files Browse the repository at this point in the history
…tion

Problem:    Vim9: no check for white space before type in declaration.
            (Naohiro Ono)
Solution:   Check for white space like in a compiled function. (closes #8785)
  • Loading branch information
brammool committed Aug 23, 2021
1 parent 6b36d2a commit 60faf86
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,13 @@ get_lval(
if (*p == ':')
{
scriptitem_T *si = SCRIPT_ITEM(current_sctx.sc_sid);
char_u *tp = skipwhite(p + 1);
char_u *tp = skipwhite(p + 1);

if (tp == p + 1 && !quiet)
{
semsg(_(e_white_space_required_after_str_str), ":", p);
return NULL;
}

// parse the type after the name
lp->ll_type = parse_type(&tp, &si->sn_type_list, !quiet);
Expand Down
2 changes: 2 additions & 0 deletions src/testdir/test_vim9_assign.vim
Original file line number Diff line number Diff line change
Expand Up @@ -1722,6 +1722,8 @@ def Test_var_type_check()
END
CheckScriptFailure(lines, 'E1069:')

CheckDefAndScriptFailure(['var n:number = 42'], 'E1069:')

lines =<< trim END
vim9script
var name: asdf
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,8 @@ static char *(features[]) =

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

0 comments on commit 60faf86

Please sign in to comment.