# HG changeset patch # User Bram Moolenaar # Date 1597178705 -7200 # Node ID 7e1316c6d0ebe48cc7496bd905a4fb16dcc3cd8f # Parent b62f11358b9799c43f79edcc80a5417b6258b40c patch 8.2.1423: Vim9: find global function when looking for script-local Commit: https://github.com/vim/vim/commit/035d6e91bd83574cab5a913c5c3a924d9011696b Author: Bram Moolenaar Date: Tue Aug 11 22:30:42 2020 +0200 patch 8.2.1423: Vim9: find global function when looking for script-local Problem: Vim9: find global function when looking for script-local. Solution: Don't strip prefix if name starts with "s:". (closes https://github.com/vim/vim/issues/6688) diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim --- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -203,6 +203,15 @@ def Test_global_local_function() assert_equal('local', Func()) END CheckScriptSuccess(lines) + + lines =<< trim END + vim9script + def g:Funcy() + echo 'funcy' + enddef + s:Funcy() + END + CheckScriptFailure(lines, 'E117:') enddef func TakesOneArg(arg) diff --git a/src/userfunc.c b/src/userfunc.c --- a/src/userfunc.c +++ b/src/userfunc.c @@ -2132,8 +2132,8 @@ call_func( char_u *p = untrans_function_name(rfname); // If using Vim9 script try not local to the script. - // TODO: should not do this if the name started with "s:". - if (p != NULL) + // Don't do this if the name starts with "s:". + if (p != NULL && (funcname[0] != 's' || funcname[1] != ':')) fp = find_func(p, is_global, NULL); } diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -755,6 +755,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1423, +/**/ 1422, /**/ 1421,