changeset 29668:495dc54392fa v9.0.0174

patch 9.0.0174: no error for using "#{ comment" in a compiled function Commit: https://github.com/vim/vim/commit/ad6d9cc679259936b7c8453f17c0ec9d7ab7dcd0 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Aug 8 21:43:11 2022 +0100 patch 9.0.0174: no error for using "#{ comment" in a compiled function Problem: No error for using "#{ comment" in a compiled function. Solution: Make error checking for "#{" consistent. (closes https://github.com/vim/vim/issues/10855)
author Bram Moolenaar <Bram@vim.org>
date Mon, 08 Aug 2022 22:45:03 +0200
parents b12995f777e7
children 40343520113e
files src/testdir/test_vim9_func.vim src/version.c src/vim9compile.c
diffstat 3 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -74,6 +74,10 @@ def TestCompilingErrorInTry()
   delete('Xdir', 'rf')
 enddef
 
+def Test_comment_error()
+  v9.CheckDefFailure(['#{ comment'], 'E1170:')
+enddef
+
 def Test_compile_error_in_called_function()
   var lines =<< trim END
       vim9script
--- a/src/version.c
+++ b/src/version.c
@@ -736,6 +736,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    174,
+/**/
     173,
 /**/
     172,
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -2899,7 +2899,9 @@ compile_def_function(
 
 	if (*ea.cmd == '#')
 	{
-	    // "#" starts a comment
+	    // "#" starts a comment, but "#{" is an error
+	    if (vim9_bad_comment(ea.cmd))
+		goto erret;
 	    line = (char_u *)"";
 	    continue;
 	}