[vim/vim] Vim9: :call and :delfunction reject dict member funcref with E1017 (PR #20372)

4 views
Skip to first unread message

thinca

unread,
May 29, 2026, 2:24:42 PM (3 days ago) May 29
to vim/vim, Subscribed

Problem: In Vim9 script, ":call d.key()" and ":delfunction d.key" fail with "E1017: Variable already declared" when d is an existing dictionary. This is because trans_function_name_ext() forwards no GLV_NO_DECL hint to get_lval(), which then treats the dict subscript as a re-declaration of "d". The same holds for the bracket form "d['key']". :call is documented as supported in Vim9 script (vim9.txt "Omitting :call and :eval"), and is required after a range, so this is a genuine bug.

Solution: Pass TFN_NO_DECL from ex_call() and ex_delfunction() so that get_lval() does not flag the existing variable as a re-declaration. This is the smallest change that fixes the bug while leaving other callers of trans_function_name_ext() (notably the function-definition paths) unchanged.

Add a regression test in test_vim9_cmd.vim.

This PR is powered by Claude Code.


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

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

Commit Summary

  • 4b337b2 Vim9: :call and :delfunction reject dict member funcref with E1017

File Changes

(2 files)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20372@github.com>

Christian Brabandt

unread,
May 31, 2026, 2:36:24 PM (yesterday) May 31
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#20372)

thanks


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20372/c4587667960@github.com>

Christian Brabandt

unread,
May 31, 2026, 2:40:16 PM (yesterday) May 31
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#20372)

can you also add a test for the delfunction part?


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20372/c4587677224@github.com>

thinca

unread,
May 31, 2026, 3:25:01 PM (24 hours ago) May 31
to vim/vim, Subscribed
thinca left a comment (vim/vim#20372)

This patch appears to have been included as part of v9.2.0572, probably due to a mistake.
09f7fc6#diff-88f490a29a5cf6aea91d1446faa9978e0ad0c37861ff70ed498ef861b04eb7de
I (with Claude Code) have updated this PR to include additional tests.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20372/c4587829857@github.com>

Christian Brabandt

unread,
May 31, 2026, 3:42:19 PM (24 hours ago) May 31
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#20372)

oh you are right, sorry about that


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20372/c4587870285@github.com>

Reply all
Reply to author
Forward
0 new messages