]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1923: wrong error when assigning to read-only register v9.1.1923
authorDoug Kearns <dougkearns@gmail.com>
Thu, 20 Nov 2025 20:59:10 +0000 (20:59 +0000)
committerChristian Brabandt <cb@256bit.org>
Thu, 20 Nov 2025 20:59:10 +0000 (20:59 +0000)
Problem:  When assigning to @. in a :let command an incorrect "E15"
          error is emitted.
Solution: Emit the correct "E354" error. (Doug Kearns).

An incorrect "E488" error was also emitted in Vim9 script assignments.

It appears that the code deleted in this commit was added to work around
a limitation in the returned value from find_name_end() that no longer
exists.

See commit 76b92b2830841fd4e05006cc3cad1d8f0bc8101b (tag: v7.0b).

closes: #18757

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/evalvars.c
src/testdir/test_registers.vim
src/testdir/test_vim9_expr.vim
src/version.c

index fbbf57829d219b013a338152b8047ff96672f80f..ca71562d422af6881dbb8bbe4b45e1657ba977c2 100644 (file)
@@ -1088,8 +1088,6 @@ ex_let(exarg_T *eap)
     argend = skip_var_list(arg, TRUE, &var_count, &semicolon, FALSE);
     if (argend == NULL)
        return;
-    if (argend > arg && argend[-1] == '.')  // for var.='str'
-       --argend;
     expr = skipwhite(argend);
     concat = expr[0] == '.'
        && ((expr[1] == '=' && in_old_script(2))
index 2720937cf517231b90957139f1972fe3a0c71387..dee1cd73966d6a32f21b22bd17f8eb80e2c55221 100644 (file)
@@ -1260,4 +1260,11 @@ func Test_insert_small_delete_linewise()
   bwipe!
 endfunc
 
+func Test_writing_readonly_regs()
+  call assert_fails('let @. = "foo"', 'E354:')
+  call assert_fails('let @% = "foo"', 'E354:')
+  call assert_fails('let @: = "foo"', 'E354:')
+  call assert_fails('let @~ = "foo"', 'E354:')
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index d47c4511e7ba09e723f55394787f767733ef333b..bbc9e1065321efa36e0876c4f9adea9cc157555d 100644 (file)
@@ -3352,7 +3352,7 @@ def Test_expr9_register()
   END
   v9.CheckDefAndScriptSuccess(lines)
 
-  v9.CheckDefAndScriptFailure(["@. = 'yes'"], ['E354:', 'E488:'], 1)
+  v9.CheckDefAndScriptFailure(["@. = 'yes'"], 'E354:', 1)
 enddef
 
 " This is slow when run under valgrind.
index fe2371cb1d857c93cc6a9b6ba1d1a8742a5578d8..d038dfdaac9434e1123ba1d0945905a13d3a4afa 100644 (file)
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1923,
 /**/
     1922,
 /**/