patch 8.2.0567: Vim9: cannot put comments halfway expressions
Problem: Vim9: cannot put comments halfway expressions.
Solution: Support # comments in many places.
diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim
index c98acc9..f0b0ad0 100644
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -569,6 +569,14 @@
return arg1 .. arg2 .. join(rest, '-')
enddef
+def MultiLineComment(
+ arg1: string, # comment
+ arg2 = 1234, # comment
+ ...rest: list<string> # comment
+ ): string # comment
+ return arg1 .. arg2 .. join(rest, '-')
+enddef
+
def Test_multiline()
assert_equal('text1234', MultiLine('text'))
assert_equal('text777', MultiLine('text', 777))
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index 3a08344..c3e3f22 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -983,10 +983,17 @@
} " comment
assert_equal({'one': 1, 'two': 2, 'three': 3}, mydict)
mydict = #{
- one: 1, " comment
- two:
- 2,
- three: 3 " comment
+ one: 1, # comment
+ two: # comment
+ 2, # comment
+ three: 3 # comment
+ }
+ assert_equal(#{one: 1, two: 2, three: 3}, mydict)
+ mydict = #{
+ one: 1,
+ two:
+ 2,
+ three: 3
}
assert_equal(#{one: 1, two: 2, three: 3}, mydict)