Problem: Vim9: crash when failed dict member is followed by concatenation.
Solution: Remove the dict from the stack. (closes #7416)
enddef
sil! Func()
assert_equal('none', g:result)
+ unlet g:result
+ END
+ CheckScriptSuccess(lines)
+enddef
+
+def Test_dict_member_with_silent()
+ var lines =<< trim END
+ vim9script
+ g:result = 'none'
+ var d: dict<any>
+ def Func()
+ try
+ g:result = map([], {_, v -> {}[v]})->join() .. d['']
+ catch
+ endtry
+ enddef
+ silent! Func()
+ assert_equal('0', g:result)
+ unlet g:result
END
CheckScriptSuccess(lines)
enddef
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 2095,
/**/
2094,
/**/
{
SOURCING_LNUM = iptr->isn_lnum;
semsg(_(e_dictkey), key);
+
+ // If :silent! is used we will continue, make sure the
+ // stack contents makes sense.
+ clear_tv(tv);
+ --ectx.ec_stack.ga_len;
+ tv = STACK_TV_BOT(-1);
+ clear_tv(tv);
+ tv->v_type = VAR_NUMBER;
+ tv->vval.v_number = 0;
goto on_fatal_error;
}
clear_tv(tv);