changeset 27277:b73e3617c1d6 v8.2.4167

patch 8.2.4167: Vim9: error message for old style import Commit: https://github.com/vim/vim/commit/dd5893be34649482ed62525430fb8baa1ec273ce Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jan 20 21:32:54 2022 +0000 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.
author Bram Moolenaar <Bram@vim.org>
date Thu, 20 Jan 2022 22:45:03 +0100
parents 0909c28d1fde
children 31aa8d6063dd
files src/errors.h src/evalvars.c src/testdir/test_vim9_import.vim src/version.c
diffstat 4 files changed, 17 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/errors.h
+++ b/src/errors.h
@@ -2966,8 +2966,7 @@ EXTERN char e_argument_name_shadows_exis
 	INIT(= N_("E1167: Argument name shadows existing variable: %s"));
 EXTERN char e_argument_already_declared_in_script_str[]
 	INIT(= N_("E1168: Argument already declared in the script: %s"));
-EXTERN char e_import_as_name_not_supported_here[]
-	INIT(= N_("E1169: 'import * as {name}' not supported here"));
+// E1169 unused
 EXTERN char e_cannot_use_hash_curly_to_start_comment[]
 	INIT(= N_("E1170: Cannot use #{ to start a comment"));
 EXTERN char e_missing_end_block[]
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -2711,7 +2711,7 @@ eval_variable(
 		else
 		{
 		    if (flags & EVAL_VAR_VERBOSE)
-			emsg(_(e_import_as_name_not_supported_here));
+			semsg(_(e_expected_dot_after_name_str), name);
 		    ret = FAIL;
 		}
 	    }
--- a/src/testdir/test_vim9_import.vim
+++ b/src/testdir/test_vim9_import.vim
@@ -429,6 +429,19 @@ def Test_import_fails()
       var that = foo
   END
   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
       vim9script
--- 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 */
 /**/
+    4167,
+/**/
     4166,
 /**/
     4165,