[vim/vim] Vim9: :def in legacy script can create a script variable (PR #21379)

6 views
Skip to first unread message

h_east

unread,
Sep 27, 2026, 6:13:53 AM (yesterday) Sep 27
to vim/vim, Subscribed
Problem:  A :def function in a legacy script can create a script-local
          variable by assigning to it, while declaring one with "var"
          gives E1101.
Solution: Give E1089 for assigning to an unknown script-local variable
          in any :def function, not only in one defined in a Vim9
          script.  Remove uf_script_ctx_version, which was only used
          for this check.

fixes: #21378

Test_unlet() created s:somevar this way, define it at the script level instead. Test_using_s_var_in_function() checks that assigning to s:scriptlevel in a :def function of a legacy script gives E1089 when the variable does not exist.


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

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

Commit Summary

  • 4ab8a52 Vim9: :def in legacy script can create a script variable

File Changes

(6 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/21379@github.com>

Christian Brabandt

unread,
3:15 PM (7 hours ago) 3:15 PM
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#21379)

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/21379/c5876759366@github.com>

Reply all
Reply to author
Forward
0 new messages