[vim/vim] Vim9: assigning a Number to $VAR or @r is not an error at script level (PR #21364)

4 views
Skip to first unread message

h_east

unread,
Sep 24, 2026, 1:46:18 AM (2 days ago) Sep 24
to vim/vim, Subscribed
Problem:  In Vim9 script, assigning a non-String value to an environment
          variable, a register or a String v: variable at the script
          level converts the value, while a :def function gives E1012.
Solution: Also check the type at the script level and give E1012, for
          "=", "..=" and a list assignment.  "@#" still takes a Number
          with "=".  Mention this in the list of incompatibilities in
          vim9.txt.

Add Test_assign_string_only(), which checks that these fail with E1012
both in a :def function and at the script level: "= 123", "..= 123"
and "= true" on $XSTRING_ONLY, @A and v:errmsg, "@# ..= 1" and
"[$XSTRING_ONLY, @A] = [1, 2]". It also checks that legacy :let still
converts a Number to a String for these three targets.


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

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

Commit Summary

  • 05a86af Vim9: assigning a Number to $VAR or @r is not an error at script level

File Changes

(4 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/21364@github.com>

Christian Brabandt

unread,
Sep 25, 2026, 4:39:22 PM (10 hours ago) Sep 25
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#21364)

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/21364/c5839246923@github.com>

Reply all
Reply to author
Forward
0 new messages