Skip to content

Commit b811992

Browse files
committed
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 <[email protected]>
1 parent eb732ed commit b811992

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

src/evalvars.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2022,7 +2022,7 @@ ex_let_one(
20222022
void
20232023
ex_unlet(exarg_T *eap)
20242024
{
2025-
ex_unletlock(eap, eap->arg, 0, 0, do_unlet_var, NULL);
2025+
ex_unletlock(eap, eap->arg, 0, eap->forceit ? GLV_QUIET : 0, do_unlet_var, NULL);
20262026
}
20272027

20282028
/*

src/testdir/test_unlet.vim

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,16 @@ func Test_unlet_complete()
6464
call assert_true(!exists('$FOOBAR') || empty($FOOBAR))
6565
endfunc
6666

67+
func Test_unlet_nonexisting_key()
68+
let g:base = {}
69+
call assert_fails(':unlet g:base["foobar"]', 'E716:')
70+
71+
try
72+
unlet! g:base["foobar"]
73+
catch
74+
call assert_report("error when unletting non-existing dict key")
75+
endtry
76+
unlet g:base
77+
endfunc
78+
6779
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,8 @@ static char *(features[]) =
729729

730730
static int included_patches[] =
731731
{ /* Add new patch number below this line */
732+
/**/
733+
1913,
732734
/**/
733735
1912,
734736
/**/

0 commit comments

Comments
 (0)