Problem: Assignment to read-only registers @: and @% is allowed during
compilation.
Solution: Abort compilation and emit an E354 error when assigning to
these registers.
Fix the E354 error emitted when attempting to declare @: with :var so
that it references the correct register, @:, rather than the garbage
string "^@".
https://github.com/vim/vim/pull/18806
(3 files)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@yegappan approved this pull request.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@yegappan commented on this pull request.
In src/testdir/test_vim9_assign.vim:
> @@ -1592,12 +1592,21 @@ def Test_assignment_failure() v9.CheckDefFailure(['var $VAR = 5'], 'E1016: Cannot declare an environment variable:') v9.CheckScriptFailure(['vim9script', 'var $ENV = "xxx"'], 'E1016:') + # read-only registers + v9.CheckDefFailure(['var @. = 5'], 'E354:', 1) + v9.CheckDefFailure(['var @% = 5'], 'E354:', 1) + v9.CheckDefFailure(['var @: = 5'], 'E354:', 1) + v9.CheckScriptFailure(['vim9script', 'var @. = 5'], 'E1066:', 2) + v9.CheckScriptFailure(['vim9script', 'var @% = 5'], 'E1066:', 2) + v9.CheckScriptFailure(['vim9script', 'var @: = 5'], 'E1066:', 2)
Instead of using CheckDefFailure() and then CheckScriptFailure() for the same test, can you use the CheckDefAndScriptFailure() function instead?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@dkearns pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@dkearns commented on this pull request.
In src/testdir/test_vim9_assign.vim:
> @@ -1592,12 +1592,21 @@ def Test_assignment_failure() v9.CheckDefFailure(['var $VAR = 5'], 'E1016: Cannot declare an environment variable:') v9.CheckScriptFailure(['vim9script', 'var $ENV = "xxx"'], 'E1016:') + # read-only registers + v9.CheckDefFailure(['var @. = 5'], 'E354:', 1) + v9.CheckDefFailure(['var @% = 5'], 'E354:', 1) + v9.CheckDefFailure(['var @: = 5'], 'E354:', 1) + v9.CheckScriptFailure(['vim9script', 'var @. = 5'], 'E1066:', 2) + v9.CheckScriptFailure(['vim9script', 'var @% = 5'], 'E1066:', 2) + v9.CheckScriptFailure(['vim9script', 'var @: = 5'], 'E1066:', 2)
Done.
I was just matching the local use of the Check* functions there. I'll also do a separate pass to update that file and others to use v9.CheckDefAndScriptFailure as I prefer to keep these bug fix commits as tight as possible.
Thanks for looking it over.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()