patch 8.2.2603: Vim9: no effect if user command is also a function
Problem: Vim9: no effect if user command is also a function.
Solution: Check for paren following. (closes #7960)
diff --git a/src/testdir/test_vim9_cmd.vim b/src/testdir/test_vim9_cmd.vim
index dd6e966..c21e55a 100644
--- a/src/testdir/test_vim9_cmd.vim
+++ b/src/testdir/test_vim9_cmd.vim
@@ -364,9 +364,8 @@
return F()
enddef
def Test()
- Foo
- ->Bar()
- ->setline(1)
+ Foo ->Bar()
+ ->setline(1)
enddef
Test()
assert_equal('the text', getline(1))
@@ -401,8 +400,7 @@
return F()
enddef
- Foo
- ->Bar()
+ Foo->Bar()
->setline(1)
END
CheckScriptSuccess(lines)
@@ -424,6 +422,33 @@
CheckDefAndScriptSuccess(lines)
enddef
+def Test_method_and_user_command()
+ var lines =<< trim END
+ vim9script
+ def Cmd()
+ g:didFunc = 1
+ enddef
+ command Cmd g:didCmd = 1
+ Cmd
+ assert_equal(1, g:didCmd)
+ Cmd()
+ assert_equal(1, g:didFunc)
+ unlet g:didFunc
+ unlet g:didCmd
+
+ def InDefFunc()
+ Cmd
+ assert_equal(1, g:didCmd)
+ Cmd()
+ assert_equal(1, g:didFunc)
+ unlet g:didFunc
+ unlet g:didCmd
+ enddef
+ InDefFunc()
+ END
+ CheckScriptSuccess(lines)
+enddef
+
def Test_skipped_expr_linebreak()
if 0
var x = []