Patch 8.2.3411
Problem: Vim9: crash when using base name of import. (Naohiro Ono)
Solution: Check the import flags. (closes #8843)
Files: src/evalvars.c, src/errors.h, src/testdir/test_vim9_script.vim
*** ../vim-8.2.3410/src/evalvars.c 2021-08-15 16:08:32.374709637 +0200
--- src/evalvars.c 2021-09-07 21:04:43.929506859 +0200
***************
*** 3260,3265 ****
--- 3260,3271 ----
semsg(_(e_redefining_imported_item_str), name);
goto failed;
}
+ if (import->imp_flags & IMP_FLAGS_STAR)
+ {
+ semsg(_(e_cannot_use_str_itself_it_is_imported_with_star),
+ name);
+ goto failed;
+ }
sv = ((svar_T *)si->sn_var_vals.ga_data) + import->imp_var_vals_idx;
where.wt_variable = TRUE;
*** ../vim-8.2.3410/src/errors.h 2021-08-19 21:08:26.178565751 +0200
--- src/errors.h 2021-09-07 21:06:00.985328416 +0200
***************
*** 654,656 ****
--- 654,658 ----
INIT(= N_("E1234: legacy must be followed by a command"));
EXTERN char e_function_reference_is_not_set[]
INIT(= N_("E1235: Function reference is not set"));
+ EXTERN char e_cannot_use_str_itself_it_is_imported_with_star[]
+ INIT(= N_("E1236: Cannot use %s itself, it is imported with '*'"));
*** ../vim-8.2.3410/src/testdir/test_vim9_script.vim 2021-08-21
17:26:47.339002567 +0200
--- src/testdir/test_vim9_script.vim 2021-09-07 22:10:29.041618466 +0200
***************
*** 1477,1482 ****
--- 1477,1497 ----
delete('Xvim9_script')
enddef
+ def Test_import_star_fails()
+ writefile([], 'Xfoo.vim')
+ var lines =<< trim END
+ import * as foo from '/tmp/foo.vim'
+ foo = 'bar'
+ END
+ CheckDefAndScriptFailure2(lines, 'E1094:', 'E1236: Cannot use foo itself')
+ lines =<< trim END
+ vim9script
+ import * as foo from '/tmp/foo.vim'
+ var that = foo
+ END
+ CheckScriptFailure(lines, 'E1029: Expected ''.''')
+ enddef
+
def Test_import_as()
var export_lines =<< trim END
vim9script
*** ../vim-8.2.3410/src/version.c 2021-09-07 20:45:27.796160030 +0200
--- src/version.c 2021-09-07 22:12:02.257473340 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3411,
/**/
--
login: yes
password: I don't know, please tell me
password is incorrect
login: yes
password: incorrect
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202109072012.187KCsxn1709574%40masaka.moolenaar.net.