[vim/vim] Error message with :unlet! and non-existing dictionary item (PR #18734)

8 views
Skip to first unread message

Christian Brabandt

unread,
Nov 12, 2025, 3:40:05 PM (13 hours ago) Nov 12
to vim/vim, Subscribed

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

fixes: #18516


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/18734

Commit Summary

  • 884cf81 Error message with :unlet! and non-existing dictionary item

File Changes

(2 files)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18734@github.com>

Yegappan Lakshmanan

unread,
Nov 12, 2025, 4:01:21 PM (13 hours ago) Nov 12
to vim/vim, Subscribed

@yegappan commented on this pull request.


In src/testdir/test_expr.vim:

> @@ -1114,4 +1114,17 @@ func Test_bitwise_shift()
   call assert_equal(64, MultBy2_A()(32))
 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_false(1, "no error when unletting non-existing dict key")

Can you use assert_report() here?


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18734/review/3455499572@github.com>

Christian Brabandt

unread,
Nov 12, 2025, 4:28:45 PM (12 hours ago) Nov 12
to vim/vim, Push

@chrisbra pushed 1 commit.


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18734/before/884cf81218f5a3b4ee6b416dfb643190988155bd/after/d625f87287c6036dba2a92231b6540bbedff415b@github.com>

Christian Brabandt

unread,
Nov 12, 2025, 4:30:13 PM (12 hours ago) Nov 12
to vim/vim, Subscribed

@chrisbra commented on this pull request.


In src/testdir/test_expr.vim:

> @@ -1114,4 +1114,17 @@ func Test_bitwise_shift()
   call assert_equal(64, MultBy2_A()(32))
 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_false(1, "no error when unletting non-existing dict key")

done


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18734/review/3455586622@github.com>

zeertzjq

unread,
Nov 12, 2025, 5:50:17 PM (11 hours ago) Nov 12
to vim/vim, Subscribed

@zeertzjq commented on this pull request.


In src/testdir/test_expr.vim:

> +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

Will it be better to put this test in test_unlet.vim or test_listdict.vim?


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18734/review/3455834566@github.com>

Reply all
Reply to author
Forward
0 new messages