]> granicus.if.org Git - vim/commitdiff
patch 8.2.2774: Vim9: cannot import an existing name even when using "as" v8.2.2774
authorBram Moolenaar <Bram@vim.org>
Sat, 17 Apr 2021 14:38:50 +0000 (16:38 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 17 Apr 2021 14:38:50 +0000 (16:38 +0200)
Problem:    Vim9: cannot import an existing name even when using "as".
Solution:   Do not check for an existing name when using "as". (closes #8113)

src/testdir/test_vim9_script.vim
src/version.c
src/vim9script.c

index d9ae4ff670856241026527ed9ba6a257734f627c..2f2fc9cc02adbd8bb41f28da028333bb01240d2c 100644 (file)
@@ -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'
index 113ba8ff00f744e0953ad1b97dd9a2c94f91e3d1..5d26348addbedf191fce1e936f4c18b8f5c06f40 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2774,
 /**/
     2773,
 /**/
index 796b7d13cbdf6ac993300ea0d8edfee53ff9cffc..583a8d4c5976ba11b779f30d2968b5a126009809 100644 (file)
@@ -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