patch 8.2.1268: Vim9: no error for using double quote comment
Problem: Vim9: no error for using double quote comment after :func or :def.
Solution: Only accept double quote when not in Vim9 script and not after
:def. (closes #6483)
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index 59727a2..5fec8a2 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -2198,6 +2198,35 @@
'vim9script',
'call execute("ls")# comment',
], 'E488:')
+
+ CheckScriptFailure([
+ 'def Test() " comment',
+ 'enddef',
+ ], 'E488:')
+ CheckScriptFailure([
+ 'vim9script',
+ 'def Test() " comment',
+ 'enddef',
+ ], 'E488:')
+
+ CheckScriptSuccess([
+ 'func Test() " comment',
+ 'endfunc',
+ ])
+ CheckScriptFailure([
+ 'vim9script',
+ 'func Test() " comment',
+ 'endfunc',
+ ], 'E488:')
+
+ CheckScriptSuccess([
+ 'def Test() # comment',
+ 'enddef',
+ ])
+ CheckScriptFailure([
+ 'func Test() # comment',
+ 'endfunc',
+ ], 'E488:')
enddef
def Test_vim9_comment_gui()