Mercurial > vim
comparison src/testdir/test_vim9_func.vim @ 21586:5470c36ed7e6 v8.2.1343
patch 8.2.1343: Vim9: cannot find global function when using g:
Commit: https://github.com/vim/vim/commit/333894b195479c9304a19f4e6ec1a9c09ecf07e4
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 1 18:53:07 2020 +0200
patch 8.2.1343: Vim9: cannot find global function when using g:
Problem: Vim9: cannot find global function when using g: when local
function with the same name exists.
Solution: Find global function when using g:.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 01 Aug 2020 19:00:03 +0200 |
parents | 1e3e5058041c |
children | 9ade1da22402 |
comparison
equal
deleted
inserted
replaced
21585:31cfab8f9ced | 21586:5470c36ed7e6 |
---|---|
159 delfunc g:Inner | 159 delfunc g:Inner |
160 END | 160 END |
161 CheckScriptSuccess(lines) | 161 CheckScriptSuccess(lines) |
162 enddef | 162 enddef |
163 | 163 |
164 def Test_global_local_function() | |
165 let lines =<< trim END | |
166 vim9script | |
167 def g:Func(): string | |
168 return 'global' | |
169 enddef | |
170 def Func(): string | |
171 return 'local' | |
172 enddef | |
173 assert_equal('global', g:Func()) | |
174 assert_equal('local', Func()) | |
175 END | |
176 CheckScriptSuccess(lines) | |
177 enddef | |
178 | |
164 func TakesOneArg(arg) | 179 func TakesOneArg(arg) |
165 echo a:arg | 180 echo a:arg |
166 endfunc | 181 endfunc |
167 | 182 |
168 def Test_call_wrong_args() | 183 def Test_call_wrong_args() |