diff options
-rw-r--r-- | src/nvim/eval.c | 3 | ||||
-rw-r--r-- | src/nvim/eval/vars.c | 6 | ||||
-rw-r--r-- | src/nvim/testdir/test_let.vim | 11 |
3 files changed, 15 insertions, 5 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 1200ba20ba..b93367381d 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -6694,7 +6694,8 @@ const char *find_name_end(const char *arg, const char **expr_start, const char * for (p = arg; *p != NUL && (eval_isnamec(*p) || *p == '{' - || ((flags & FNE_INCL_BR) && (*p == '[' || *p == '.')) + || ((flags & FNE_INCL_BR) && (*p == '[' + || (*p == '.' && eval_isnamec1(p[1])))) || mb_nest != 0 || br_nest != 0); MB_PTR_ADV(p)) { if (*p == '\'') { diff --git a/src/nvim/eval/vars.c b/src/nvim/eval/vars.c index ef6e3f02e2..3f73dbfdc5 100644 --- a/src/nvim/eval/vars.c +++ b/src/nvim/eval/vars.c @@ -231,11 +231,13 @@ static void ex_let_const(exarg_T *eap, const bool is_const) expr++; } } - expr = skipwhite(expr + 2); + expr += 2; } else { - expr = skipwhite(expr + 1); + expr += 1; } + expr = skipwhite(expr); + if (eap->skip) { emsg_skip++; } diff --git a/src/nvim/testdir/test_let.vim b/src/nvim/testdir/test_let.vim index f05e06f774..79619b0f1e 100644 --- a/src/nvim/testdir/test_let.vim +++ b/src/nvim/testdir/test_let.vim @@ -276,20 +276,27 @@ func Test_let_errors() let s = "var" let var = 1 call assert_fails('let var += [1,2]', 'E734:') - call assert_fails('let {s}.1 = 2', 'E18:') + call assert_fails('let {s}.1 = 2', 'E15:') call assert_fails('let a[1] = 5', 'E121:') let l = [[1,2]] call assert_fails('let l[:][0] = [5]', 'E708:') let d = {'k' : 4} - call assert_fails('let d.# = 5', 'E713:') + call assert_fails('let d.# = 5', 'E488:') call assert_fails('let d.m += 5', 'E734:') + call assert_fails('let m = d[{]', 'E15:') let l = [1, 2] call assert_fails('let l[2] = 0', 'E684:') call assert_fails('let l[0:1] = [1, 2, 3]', 'E710:') call assert_fails('let l[-2:-3] = [3, 4]', 'E684:') call assert_fails('let l[0:4] = [5, 6]', 'E711:') + call assert_fails('let l -= 2', 'E734:') + call assert_fails('let l += 2', 'E734:') call assert_fails('let g:["a;b"] = 10', 'E461:') call assert_fails('let g:.min = function("max")', 'E704:') + if has('channel') + let ch = test_null_channel() + call assert_fails('let ch += 1', 'E734:') + endif " This test works only when the language is English if v:lang == "C" || v:lang =~ '^[Ee]n' |