changeset 24469:e5db23a8ad98 v8.2.2774

patch 8.2.2774: Vim9: cannot import an existing name even when using "as" Commit: https://github.com/vim/vim/commit/6c7cc347af4f4bc1bf180d80ef81413f89e78f56 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Apr 17 16:38:50 2021 +0200 patch 8.2.2774: Vim9: cannot import an existing name even when using "as" Problem: Vim9: cannot import an existing name even when using "as". Solution: Do not check for an existing name when using "as". (closes https://github.com/vim/vim/issues/8113)
author Bram Moolenaar <Bram@vim.org>
date Sat, 17 Apr 2021 16:45:05 +0200
parents 9f41bfdbc6fc
children 9e75cdb46bc5
files src/testdir/test_vim9_script.vim src/version.c src/vim9script.c
diffstat 3 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -1280,6 +1280,8 @@ def Test_import_as()
 
   var import_lines =<< trim END
     vim9script
+    var one = 'notused'
+    var yes = 777
     import one as thatOne from './XexportAs'
     assert_equal(1, thatOne)
     import yes as yesYes from './XexportAs'
--- 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 */
 /**/
+    2774,
+/**/
     2773,
 /**/
     2772,
--- a/src/vim9script.c
+++ b/src/vim9script.c
@@ -600,7 +600,8 @@ handle_import(
 	    }
 	    else
 	    {
-		if (check_defined(name, len, cctx, FALSE) == FAIL)
+		if (as_name == NULL
+			      && check_defined(name, len, cctx, FALSE) == FAIL)
 		    goto erret;
 
 		imported = new_imported(gap != NULL ? gap