diff --git a/src/eval.c b/src/eval.c index bc4db2906c..1e2e4c4768 100644 --- a/src/eval.c +++ b/src/eval.c @@ -5006,7 +5006,15 @@ echo_string_core( ga_concat(&ga, (char_u *)"function("); if (fname != NULL) { - ga_concat(&ga, fname); + // When using uf_name prepend "g:" for a global function. + if (pt->pt_name == NULL && fname[0] == '\'' + && vim_isupper(fname[1])) + { + ga_concat(&ga, (char_u *)"'g:"); + ga_concat(&ga, fname + 1); + } + else + ga_concat(&ga, fname); vim_free(fname); } if (pt != NULL && pt->pt_argc > 0) diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim index ac9bb4cfab..a215667964 100644 --- a/src/testdir/test_functions.vim +++ b/src/testdir/test_functions.vim @@ -2771,5 +2771,10 @@ func Test_builtin_check() call assert_fails('call extend(g:, #{bar: { -> "foo" }}, "force")', 'E704:') endfunc +func Test_funcref_to_string() + let Fn = funcref('g:Test_funcref_to_string') + call assert_equal("function('g:Test_funcref_to_string')", string(Fn)) +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index 083c111f0e..0199acade2 100644 --- a/src/version.c +++ b/src/version.c @@ -753,6 +753,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 3766, /**/ 3765, /**/