0
0
mirror of https://github.com/vim/vim.git synced 2025-11-13 22:54:27 -05:00

patch 9.1.1913: Error message with :unlet! and non-existing dictionary item

Problem:  Error message with :unlet! and non-existing dictionary item
          (Coacher)
Solution: Set GLV_QUIET when using unlet with bang attribute

fixes: #18516
closes: #18734

Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Christian Brabandt
2025-11-13 21:06:43 +00:00
parent eb732ed26d
commit b8119920eb
3 changed files with 15 additions and 1 deletions

View File

@@ -2022,7 +2022,7 @@ ex_let_one(
void void
ex_unlet(exarg_T *eap) ex_unlet(exarg_T *eap)
{ {
ex_unletlock(eap, eap->arg, 0, 0, do_unlet_var, NULL); ex_unletlock(eap, eap->arg, 0, eap->forceit ? GLV_QUIET : 0, do_unlet_var, NULL);
} }
/* /*

View File

@@ -64,4 +64,16 @@ func Test_unlet_complete()
call assert_true(!exists('$FOOBAR') || empty($FOOBAR)) call assert_true(!exists('$FOOBAR') || empty($FOOBAR))
endfunc endfunc
func Test_unlet_nonexisting_key()
let g:base = {}
call assert_fails(':unlet g:base["foobar"]', 'E716:')
try
unlet! g:base["foobar"]
catch
call assert_report("error when unletting non-existing dict key")
endtry
unlet g:base
endfunc
" vim: shiftwidth=2 sts=2 expandtab " vim: shiftwidth=2 sts=2 expandtab

View File

@@ -729,6 +729,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1913,
/**/ /**/
1912, 1912,
/**/ /**/