From b8119920eb8dbfed39af88f66d85c65ea4fd8ecf Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Thu, 13 Nov 2025 21:06:43 +0000 Subject: [PATCH] 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 --- src/evalvars.c | 2 +- src/testdir/test_unlet.vim | 12 ++++++++++++ src/version.c | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/evalvars.c b/src/evalvars.c index 2acfc429a5..fbbf57829d 100644 --- a/src/evalvars.c +++ b/src/evalvars.c @@ -2022,7 +2022,7 @@ ex_let_one( void 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); } /* diff --git a/src/testdir/test_unlet.vim b/src/testdir/test_unlet.vim index 6be963370a..88a293ec6b 100644 --- a/src/testdir/test_unlet.vim +++ b/src/testdir/test_unlet.vim @@ -64,4 +64,16 @@ func Test_unlet_complete() call assert_true(!exists('$FOOBAR') || empty($FOOBAR)) 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 diff --git a/src/version.c b/src/version.c index 99849aa8b0..5065b15ba1 100644 --- a/src/version.c +++ b/src/version.c @@ -729,6 +729,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1913, /**/ 1912, /**/