Mercurial > vim
changeset 21584:d0c76ce48326 v8.2.1342
patch 8.2.1342: Vim9: accidentally using "t" gives a confusing error
Commit: https://github.com/vim/vim/commit/f5a48010ef9e47319185f1aaac1bc6d45cd4d47a
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 1 17:00:03 2020 +0200
patch 8.2.1342: Vim9: accidentally using "t" gives a confusing error
Problem: Vim9: accidentally using "x" gives a confusing error.
Solution: Disallow using ":t" in Vim9 script. (issue https://github.com/vim/vim/issues/6399)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 01 Aug 2020 17:15:03 +0200 |
parents | 84990b1adf55 |
children | 31cfab8f9ced |
files | runtime/doc/vim9.txt src/ex_docmd.c src/testdir/test_vim9_script.vim src/version.c src/vim9compile.c src/vim9script.c |
diffstat | 6 files changed, 22 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/runtime/doc/vim9.txt +++ b/runtime/doc/vim9.txt @@ -190,8 +190,8 @@ To intentionally avoid a variable being An existing variable cannot be assigned to with `:let`, since that implies a declaration. Global, window, tab, buffer and Vim variables can only be used -without `:let`, because they are are not really declared, they can also be -deleted with `:unlet`. +without `:let`, because they are not really declared, they can also be deleted +with `:unlet`. Variables cannot shadow previously defined variables. Variables may shadow Ex commands, rename the variable if needed. @@ -352,10 +352,11 @@ No curly braces expansion ~ |curly-braces-names| cannot be used. -No :xit, :append, :change or :insert ~ +No :xit, :t, :append, :change or :insert ~ -These commands are too easily confused with local variable names. Instead of -`:x` or `:xit` you can use `:exit`. +These commands are too easily confused with local variable names. +Instead of `:x` or `:xit` you can use `:exit`. +Instead of `:t` you can use `:copy`. Comparators ~
--- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -7276,6 +7276,9 @@ ex_copymove(exarg_T *eap) { long n; + if (not_in_vim9(eap) == FAIL) + return; + n = get_address(eap, &eap->arg, eap->addr_type, FALSE, FALSE, FALSE, 1); if (eap->arg == NULL) // error detected {
--- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -1628,18 +1628,21 @@ def Test_fixed_size_list() enddef def Test_no_insert_xit() - call CheckDefExecFailure(['x = 1'], 'E1100:') call CheckDefExecFailure(['a = 1'], 'E1100:') + call CheckDefExecFailure(['c = 1'], 'E1100:') call CheckDefExecFailure(['i = 1'], 'E1100:') - call CheckDefExecFailure(['c = 1'], 'E1100:') + call CheckDefExecFailure(['t = 1'], 'E1100:') + call CheckDefExecFailure(['x = 1'], 'E1100:') - CheckScriptFailure(['vim9script', 'x = 1'], 'E1100:') CheckScriptFailure(['vim9script', 'a = 1'], 'E488:') CheckScriptFailure(['vim9script', 'a'], 'E1100:') + CheckScriptFailure(['vim9script', 'c = 1'], 'E488:') + CheckScriptFailure(['vim9script', 'c'], 'E1100:') CheckScriptFailure(['vim9script', 'i = 1'], 'E488:') CheckScriptFailure(['vim9script', 'i'], 'E1100:') - CheckScriptFailure(['vim9script', 'c = 1'], 'E488:') - CheckScriptFailure(['vim9script', 'c'], 'E1100:') + CheckScriptFailure(['vim9script', 't'], 'E1100:') + CheckScriptFailure(['vim9script', 't = 1'], 'E1100:') + CheckScriptFailure(['vim9script', 'x = 1'], 'E1100:') enddef def IfElse(what: number): string
--- a/src/version.c +++ b/src/version.c @@ -755,6 +755,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1342, +/**/ 1341, /**/ 1340,