0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

patch 8.2.4167: Vim9: error message for old style import

Problem:    Vim9: error message for old style import.
Solution:   Use another error message.  Add a test.
This commit is contained in:
Bram Moolenaar
2022-01-20 21:32:54 +00:00
parent e615db0604
commit dd5893be34
4 changed files with 17 additions and 3 deletions

View File

@@ -2966,8 +2966,7 @@ EXTERN char e_argument_name_shadows_existing_variable_str[]
INIT(= N_("E1167: Argument name shadows existing variable: %s")); INIT(= N_("E1167: Argument name shadows existing variable: %s"));
EXTERN char e_argument_already_declared_in_script_str[] EXTERN char e_argument_already_declared_in_script_str[]
INIT(= N_("E1168: Argument already declared in the script: %s")); INIT(= N_("E1168: Argument already declared in the script: %s"));
EXTERN char e_import_as_name_not_supported_here[] // E1169 unused
INIT(= N_("E1169: 'import * as {name}' not supported here"));
EXTERN char e_cannot_use_hash_curly_to_start_comment[] EXTERN char e_cannot_use_hash_curly_to_start_comment[]
INIT(= N_("E1170: Cannot use #{ to start a comment")); INIT(= N_("E1170: Cannot use #{ to start a comment"));
EXTERN char e_missing_end_block[] EXTERN char e_missing_end_block[]

View File

@@ -2711,7 +2711,7 @@ eval_variable(
else else
{ {
if (flags & EVAL_VAR_VERBOSE) if (flags & EVAL_VAR_VERBOSE)
emsg(_(e_import_as_name_not_supported_here)); semsg(_(e_expected_dot_after_name_str), name);
ret = FAIL; ret = FAIL;
} }
} }

View File

@@ -429,6 +429,19 @@ def Test_import_fails()
var that = foo var that = foo
END END
CheckScriptFailure(lines, 'E1060: Expected dot after name: foo') CheckScriptFailure(lines, 'E1060: Expected dot after name: foo')
lines =<< trim END
vim9script
import './Xfoo.vim' as foo
var that: any
that += foo
END
CheckScriptFailure(lines, 'E1060: Expected dot after name: foo')
lines =<< trim END
vim9script
import './Xfoo.vim' as foo
foo += 9
END
CheckScriptFailure(lines, 'E1060: Expected dot after name: foo')
lines =<< trim END lines =<< trim END
vim9script vim9script

View File

@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
4167,
/**/ /**/
4166, 4166,
/**/ /**/