diff options
-rw-r--r-- | src/errors.h | 3 | ||||
-rw-r--r-- | src/evalvars.c | 3 | ||||
-rw-r--r-- | src/testdir/test_vim9_assign.vim | 3 | ||||
-rw-r--r-- | src/testdir/test_vim9_cmd.vim | 18 | ||||
-rw-r--r-- | src/testdir/test_vim9_func.vim | 9 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim9compile.c | 5 |
7 files changed, 38 insertions, 5 deletions
diff --git a/src/errors.h b/src/errors.h index d6b82bbfb..8e2b9da6c 100644 --- a/src/errors.h +++ b/src/errors.h @@ -2788,7 +2788,8 @@ EXTERN char e_missing_argument_type_for_str[] INIT(= N_("E1077: Missing argument type for %s")); // E1078 unused // E1079 unused -// E1080 unused +EXTERN char e_invalid_assignment[] + INIT(= N_("E1080: Invalid assignment")); EXTERN char e_cannot_unlet_str[] INIT(= N_("E1081: Cannot unlet %s")); #endif diff --git a/src/evalvars.c b/src/evalvars.c index 8e862df8b..40375588c 100644 --- a/src/evalvars.c +++ b/src/evalvars.c @@ -1107,7 +1107,8 @@ skip_var_list( { if (*semicolon == 1) { - emsg(_(e_double_semicolon_in_list_of_variables)); + if (!silent) + emsg(_(e_double_semicolon_in_list_of_variables)); return NULL; } *semicolon = 1; diff --git a/src/testdir/test_vim9_assign.vim b/src/testdir/test_vim9_assign.vim index 9c988c96f..c4a457e81 100644 --- a/src/testdir/test_vim9_assign.vim +++ b/src/testdir/test_vim9_assign.vim @@ -1359,7 +1359,8 @@ def Test_assignment_failure() v9.CheckDefFailure(['var null = 1'], 'E1034:') v9.CheckDefFailure(['var this = 1'], 'E1034:') - v9.CheckDefFailure(['[a; b; c] = g:list'], 'E452:') + v9.CheckDefFailure(['[a; b; c] = g:list'], 'E1001:') + v9.CheckDefFailure(['var [a; b; c] = g:list'], 'E1080:') v9.CheckDefExecFailure(['var a: number', '[a] = test_null_list()'], 'E1093:') v9.CheckDefExecFailure(['var a: number', diff --git a/src/testdir/test_vim9_cmd.vim b/src/testdir/test_vim9_cmd.vim index f80d5a26d..10be6910a 100644 --- a/src/testdir/test_vim9_cmd.vim +++ b/src/testdir/test_vim9_cmd.vim @@ -1355,6 +1355,13 @@ def Test_command_not_recognized() v9.CheckDefFailure(lines, 'E1146:', 1) lines =<< trim END + if 0 + d.key = 'asdf' + endif + END + v9.CheckDefSuccess(lines) + + lines =<< trim END d['key'] = 'asdf' END v9.CheckDefFailure(lines, 'E1146:', 1) @@ -1621,6 +1628,11 @@ def Test_substitute_expr() s/text/\=['aaa', 'bbb', 'ccc']/ assert_equal(['some aaa', 'bbb', 'ccc', ' here'], getline(1, '$')) bwipe! + + # inside "if 0" substitute is ignored + if 0 + s/a/\=nothing/ and | some more + endif enddef def Test_redir_to_var() @@ -1664,6 +1676,12 @@ def Test_redir_to_var() v9.CheckDefFailure(lines, 'E1089:') lines =<< trim END + var text: string + redir => text + END + v9.CheckDefFailure(lines, 'E1185:') + + lines =<< trim END var ls = 'asdf' redir => ls[1] redir END diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim index ecc9c64df..65d6dc8f9 100644 --- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -3762,7 +3762,15 @@ def Test_go_beyond_end_of_cmd() v9.CheckScriptFailure(lines, 'E476:') enddef +" The following messes up syntax highlight, keep near the end. if has('python3') + def Test_python3_command() + py3 import vim + py3 vim.command("let g:done = 'yes'") + assert_equal('yes', g:done) + unlet g:done + enddef + def Test_python3_heredoc() py3 << trim EOF import vim @@ -3778,7 +3786,6 @@ if has('python3') enddef endif -" This messes up syntax highlight, keep near the end. if has('lua') def Test_lua_heredoc() g:d = {} diff --git a/src/version.c b/src/version.c index 3510af8a8..e07308627 100644 --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 4395, +/**/ 4394, /**/ 4393, diff --git a/src/vim9compile.c b/src/vim9compile.c index 0eb41e4c1..74dc5e0b0 100644 --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -2420,7 +2420,7 @@ may_compile_assignment(exarg_T *eap, char_u **line, cctx_T *cctx) if (*eap->cmd == '[') { - // [var, var] = expr + // might be "[var, var] = expr" *line = compile_assignment(eap->cmd, eap, CMD_SIZE, cctx); if (*line == NULL) return FAIL; @@ -2958,7 +2958,10 @@ compile_def_function( case CMD_decrement: line = compile_assignment(p, &ea, ea.cmdidx, &cctx); if (line == p) + { + emsg(_(e_invalid_assignment)); line = NULL; + } break; case CMD_unlet: |