vim-patch:9.1.0287: Vim9: comment may be treated as heredoc start (#28257)

Problem:  Vim9: comment may be treated as heredoc start.
          (Ernie Rael)
Solution: Use skip_var_list() instead of find_name_end().
          (zeertzjq)

fixes: vim/vim#14444
closes: vim/vim#14446

9a91d2b72c
This commit is contained in:
zeertzjq
2024-04-10 06:07:29 +08:00
committed by GitHub
parent f398552eb1
commit efb6640b29
2 changed files with 59 additions and 3 deletions

View File

@@ -397,6 +397,42 @@ func Test_let_heredoc_fails()
call assert_report('Caught exception: ' .. v:exception)
endtry
try
let @- =<< trim TEXT
change
insert
append
TEXT
call assert_report('No exception thrown')
catch /E730:/
catch
call assert_report('Caught exception: ' .. v:exception)
endtry
try
let [a b c] =<< trim TEXT
change
insert
append
TEXT
call assert_report('No exception thrown')
catch /E475:/
catch
call assert_report('Caught exception: ' .. v:exception)
endtry
try
let [a; b; c] =<< trim TEXT
change
insert
append
TEXT
call assert_report('No exception thrown')
catch /E452:/
catch
call assert_report('Caught exception: ' .. v:exception)
endtry
let text =<< trim END
func WrongSyntax()
let v =<< that there
@@ -569,6 +605,22 @@ append
END
call assert_equal(['change', 'insert', 'append'], [a, b, c])
" unpack assignment with semicolon
let [a; b] =<< END
change
insert
append
END
call assert_equal(['change', ['insert', 'append']], [a, b])
" unpack assignment with registers
let [@/, @", @-] =<< END
change
insert
append
END
call assert_equal(['change', 'insert', 'append'], [@/, @", @-])
" curly braces name and list slice assignment
let foo_3_bar = ['', '', '']
let foo_{1 + 2}_bar[ : ] =<< END