Mercurial > vim
changeset 28694:7f12fe85ed8b v8.2.4871
patch 8.2.4871: Vim9: in :def function no error for misplaced range
Commit: https://github.com/vim/vim/commit/09d9421b673366e5f6e56fbf74204a1c316fdea2
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu May 5 15:20:03 2022 +0100
patch 8.2.4871: Vim9: in :def function no error for misplaced range
Problem: Vim9: in :def function no error for using a range with a command
that does not accept one.
Solution: Check for the command to accept a range. (closes #10330)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 05 May 2022 16:30:03 +0200 |
parents | 615339bbac54 |
children | 7ad8f631bae5 |
files | src/testdir/test_vim9_script.vim src/version.c src/vim9compile.c |
diffstat | 3 files changed, 30 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -67,6 +67,29 @@ def Test_range_only() endif enddef +def Test_invalid_range() + var lines =<< trim END + :123 eval 1 + 2 + END + v9.CheckDefAndScriptFailure(lines, 'E481:', 1) + + lines =<< trim END + :123 if true + endif + END + v9.CheckDefAndScriptFailure(lines, 'E481:', 1) + + lines =<< trim END + :123 echo 'yes' + END + v9.CheckDefAndScriptFailure(lines, 'E481:', 1) + + lines =<< trim END + :123 cd there + END + v9.CheckDefAndScriptFailure(lines, 'E481:', 1) +enddef + let g:alist = [7] let g:astring = 'text' let g:anumber = 123