patch 8.2.0555: Vim9: line continuation is not always needed
Problem: Vim9: line continuation is not always needed.
Solution: Recognize continuation lines automatically in list and dict.
diff --git a/src/testdir/test_vim9_expr.vim b/src/testdir/test_vim9_expr.vim
index f34041b..a965bdf 100644
--- a/src/testdir/test_vim9_expr.vim
+++ b/src/testdir/test_vim9_expr.vim
@@ -767,7 +767,7 @@
call CheckDefFailure("let x = #{8: 8}", 'E1014:')
call CheckDefFailure("let x = #{xxx}", 'E720:')
- call CheckDefFailure("let x = #{xxx: 1", 'E722:')
+ call CheckDefFailure("let x = #{xxx: 1", 'E723:')
call CheckDefFailure("let x = #{xxx: 1,", 'E723:')
call CheckDefFailure("let x = {'a': xxx}", 'E1001:')
call CheckDefFailure("let x = {xxx: 8}", 'E1001:')
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index 4e0dc1b..358d4e8 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -966,6 +966,30 @@
assert_true(caught, 'should have caught an exception')
enddef
+def Test_automatic_line_continuation()
+ let mylist = [
+ 'one',
+ 'two',
+ 'three',
+ ] " comment
+ assert_equal(['one', 'two', 'three'], mylist)
+
+ let mydict = {
+ 'one': 1,
+ 'two': 2,
+ 'three':
+ 3,
+ } " comment
+ assert_equal({'one': 1, 'two': 2, 'three': 3}, mydict)
+ mydict = #{
+ one: 1, " comment
+ two:
+ 2,
+ three: 3 " comment
+ }
+ assert_equal(#{one: 1, two: 2, three: 3}, mydict)
+enddef
+
" Keep this last, it messes up highlighting.
def Test_substitute_cmd()
new