From: Doug Kearns Date: Thu, 20 Nov 2025 20:59:10 +0000 (+0000) Subject: patch 9.1.1923: wrong error when assigning to read-only register X-Git-Tag: v9.1.1923^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2447131e00c40dbc4726308c937a5437668493c6;p=thirdparty%2Fvim.git patch 9.1.1923: wrong error when assigning to read-only register 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 Signed-off-by: Christian Brabandt --- diff --git a/src/evalvars.c b/src/evalvars.c index fbbf57829d..ca71562d42 100644 --- a/src/evalvars.c +++ b/src/evalvars.c @@ -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)) diff --git a/src/testdir/test_registers.vim b/src/testdir/test_registers.vim index 2720937cf5..dee1cd7396 100644 --- a/src/testdir/test_registers.vim +++ b/src/testdir/test_registers.vim @@ -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 diff --git a/src/testdir/test_vim9_expr.vim b/src/testdir/test_vim9_expr.vim index d47c4511e7..bbc9e10653 100644 --- a/src/testdir/test_vim9_expr.vim +++ b/src/testdir/test_vim9_expr.vim @@ -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. diff --git a/src/version.c b/src/version.c index fe2371cb1d..d038dfdaac 100644 --- a/src/version.c +++ b/src/version.c @@ -729,6 +729,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1923, /**/ 1922, /**/