Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
21597:b26b1529cb9b | 21598:7b5b9558500a |
---|---|
1616 | 1616 |
1617 delete('Xexported.vim') | 1617 delete('Xexported.vim') |
1618 delete('Ximport.vim') | 1618 delete('Ximport.vim') |
1619 enddef | 1619 enddef |
1620 | 1620 |
1621 def Test_func_overrules_import_fails() | |
1622 let export_lines =<< trim END | |
1623 vim9script | |
1624 export def Func() | |
1625 echo 'imported' | |
1626 enddef | |
1627 END | |
1628 writefile(export_lines, 'XexportedFunc.vim') | |
1629 | |
1630 let lines =<< trim END | |
1631 vim9script | |
1632 import Func from './XexportedFunc.vim' | |
1633 def Func() | |
1634 echo 'local to function' | |
1635 enddef | |
1636 END | |
1637 CheckScriptFailure(lines, 'E1073:') | |
1638 | |
1639 lines =<< trim END | |
1640 vim9script | |
1641 import Func from './XexportedFunc.vim' | |
1642 def Outer() | |
1643 def Func() | |
1644 echo 'local to function' | |
1645 enddef | |
1646 enddef | |
1647 defcompile | |
1648 END | |
1649 CheckScriptFailure(lines, 'E1073:') | |
1650 | |
1651 delete('XexportedFunc.vim') | |
1652 enddef | |
1653 | |
1621 def Test_fixed_size_list() | 1654 def Test_fixed_size_list() |
1622 # will be allocated as one piece of memory, check that changes work | 1655 # will be allocated as one piece of memory, check that changes work |
1623 let l = [1, 2, 3, 4] | 1656 let l = [1, 2, 3, 4] |
1624 l->remove(0) | 1657 l->remove(0) |
1625 l->add(5) | 1658 l->add(5) |