Skip to content

Commit 8ac681a

Browse files
committed
patch 8.2.3004: Vim9: error for missing colon given while skipping
Problem: Vim9: error for missing colon given while skipping. Solution: Do not give the error when skipping. (closes #8385)
1 parent 968a5b6 commit 8ac681a

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

src/ex_docmd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1844,7 +1844,7 @@ do_one_cmd(
18441844

18451845
// If a ':' before the range is missing, give a clearer error
18461846
// message.
1847-
if (ar > ea.cmd)
1847+
if (ar > ea.cmd && !ea.skip)
18481848
{
18491849
semsg(_(e_colon_required_before_range_str), ea.cmd);
18501850
goto doend;

src/testdir/test_vim9_script.vim

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,19 @@ def Test_try_catch_throw()
590590
return 2
591591
enddef
592592
assert_equal(4, ReturnInFinally())
593+
594+
var lines =<< trim END
595+
vim9script
596+
try
597+
acos('0.5')
598+
->setline(1)
599+
catch
600+
g:caught = v:exception
601+
endtry
602+
END
603+
CheckScriptSuccess(lines)
604+
assert_match('E808: Number or Float required', g:caught)
605+
unlet g:caught
593606
enddef
594607

595608
" :while at the very start of a function that :continue jumps to

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
3004,
753755
/**/
754756
3003,
755757
/**/

0 commit comments

Comments
 (0)