summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/testdir/sautest/autoload/foo.vim4
-rw-r--r--src/testdir/test_autoload.vim4
-rw-r--r--src/userfunc.c4
-rw-r--r--src/version.c2
4 files changed, 12 insertions, 2 deletions
diff --git a/src/testdir/sautest/autoload/foo.vim b/src/testdir/sautest/autoload/foo.vim
index 298e7275d..21d33a0f4 100644
--- a/src/testdir/sautest/autoload/foo.vim
+++ b/src/testdir/sautest/autoload/foo.vim
@@ -9,3 +9,7 @@ endfunc
func foo#addFoo(head)
return a:head .. 'foo'
endfunc
+
+func foo#()
+ return 'empty'
+endfunc
diff --git a/src/testdir/test_autoload.vim b/src/testdir/test_autoload.vim
index 384ee1a32..21de65563 100644
--- a/src/testdir/test_autoload.vim
+++ b/src/testdir/test_autoload.vim
@@ -10,6 +10,9 @@ func Test_autoload_dict_func()
call assert_equal(1, g:called_foo_bar_echo)
eval 'bar'->g:foo#addFoo()->assert_equal('barfoo')
+
+ " empty name works in legacy script
+ call assert_equal('empty', foo#())
endfunc
func Test_source_autoload()
@@ -23,4 +26,5 @@ func Test_autoload_vim9script()
call assert_equal(49, auto9#add42(7))
endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/userfunc.c b/src/userfunc.c
index 5de5dd00f..223535fdb 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -3693,8 +3693,8 @@ trans_function_name(
// Note that TFN_ flags use the same values as GLV_ flags.
end = get_lval(start, NULL, &lv, FALSE, skip, flags | GLV_READ_ONLY,
lead > 2 ? 0 : FNE_CHECK_START);
- if (end == start
- || (end != NULL && end[-1] == AUTOLOAD_CHAR && *end == '('))
+ if (end == start || (in_vim9script() && end != NULL
+ && end[-1] == AUTOLOAD_CHAR && *end == '('))
{
if (!skip)
emsg(_(e_function_name_required));
diff --git a/src/version.c b/src/version.c
index 27ee162fc..cea8ece87 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 4168,
+/**/
4167,
/**/
4166,