diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/testdir/test_user_func.vim | 19 | ||||
-rw-r--r-- | src/userfunc.c | 3 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 24 insertions, 0 deletions
diff --git a/src/testdir/test_user_func.vim b/src/testdir/test_user_func.vim index 57a093c9c9..992329bc72 100644 --- a/src/testdir/test_user_func.vim +++ b/src/testdir/test_user_func.vim @@ -968,4 +968,23 @@ func Test_multidefer_with_exception() delfunc Foo endfunc +func Test_func_curly_brace_invalid_name() + func Fail() + func Foo{'()'}bar() + endfunc + endfunc + + call assert_fails('call Fail()', 'E475: Invalid argument: Foo()bar') + + silent! call Fail() + call assert_equal([], getcompletion('Foo', 'function')) + + set formatexpr=Fail() + normal! gqq + call assert_equal([], getcompletion('Foo', 'function')) + + set formatexpr& + delfunc Fail +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/userfunc.c b/src/userfunc.c index 00e499fd0f..ce144a3978 100644 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -4977,7 +4977,10 @@ define_function( : eval_isnamec(name_base[i])); ++i) ; if (name_base[i] != NUL) + { emsg_funcname(e_invalid_argument_str, arg); + goto ret_free; + } // In Vim9 script a function cannot have the same name as a // variable. diff --git a/src/version.c b/src/version.c index 36c1205777..9f78196322 100644 --- a/src/version.c +++ b/src/version.c @@ -705,6 +705,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 182, +/**/ 181, /**/ 180, |