Mercurial > vim
diff src/testdir/test_vim9_script.vim @ 21598:7b5b9558500a v8.2.1349
patch 8.2.1349: Vim9: can define a function with the name of an import
Commit: https://github.com/vim/vim/commit/eef2102e20d24f5fbd1c9f53c7a35df61585c5ab
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 1 22:16:43 2020 +0200
patch 8.2.1349: Vim9: can define a function with the name of an import
Problem: Vim9: can define a function with the name of an import.
Solution: Disallow using an existing name. (closes https://github.com/vim/vim/issues/6585)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 01 Aug 2020 22:30:04 +0200 |
parents | d0c76ce48326 |
children | 622021f43db1 |
line wrap: on
line diff
--- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -1618,6 +1618,39 @@ def Test_import_compile_error() delete('Ximport.vim') enddef +def Test_func_overrules_import_fails() + let export_lines =<< trim END + vim9script + export def Func() + echo 'imported' + enddef + END + writefile(export_lines, 'XexportedFunc.vim') + + let lines =<< trim END + vim9script + import Func from './XexportedFunc.vim' + def Func() + echo 'local to function' + enddef + END + CheckScriptFailure(lines, 'E1073:') + + lines =<< trim END + vim9script + import Func from './XexportedFunc.vim' + def Outer() + def Func() + echo 'local to function' + enddef + enddef + defcompile + END + CheckScriptFailure(lines, 'E1073:') + + delete('XexportedFunc.vim') +enddef + def Test_fixed_size_list() # will be allocated as one piece of memory, check that changes work let l = [1, 2, 3, 4]