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.
https://github.com/vim/vim/pull/20372
(2 files)
—
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.![]()
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.![]()
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.![]()
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.![]()
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.![]()