0
0
mirror of https://github.com/vim/vim.git synced 2025-10-03 05:14:07 -04:00

patch 8.2.1859: Vim9: crash in unpack assignment

Problem:    Vim9: crash in unpack assignment.
Solution:   Make sure an error message is turned into an exception.
            (closes #7159)
This commit is contained in:
Bram Moolenaar
2020-10-17 22:04:08 +02:00
parent 403dc31f5a
commit 352134bbfb
4 changed files with 47 additions and 0 deletions

View File

@@ -620,6 +620,7 @@ def Test_throw_vimscript()
lines =<< trim END
vim9script
@r = ''
def Func()
throw @r
enddef
@@ -2818,6 +2819,27 @@ def Test_script_var_scope()
CheckScriptFailure(lines, 'E121:', 6)
enddef
def Test_catch_exception_in_callback()
var lines =<< trim END
vim9script
def Callback(...l: any)
try
var x: string
var y: string
# this error should be caught with CHECKLEN
[x, y] = ['']
catch
g:caught = 'yes'
endtry
enddef
popup_menu('popup', #{callback: Callback})
feedkeys("\r", 'xt')
END
CheckScriptSuccess(lines)
unlet g:caught
enddef
" Keep this last, it messes up highlighting.
def Test_substitute_cmd()
new