patch 9.1.0994: Vim9: not able to use comment after opening curly brace
Problem: Vim9: not able to use comment after opening curly brace
(lifepillar)
Solution: allow to use comments after curly braces of an inner-block,
modify the logic to search for comment in a line, update Vim9
tests to use specific class type instead of any
(Yegappan Lakshmanan)
fixes: #16363
closes: #16405
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index 82f8088..550c725 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -595,6 +595,27 @@
unlet g:otherVar
enddef
+def Test_block_in_a_string()
+ var lines =<< trim END
+ vim9script
+
+ def Foo(): string
+ var x = ' => { # abc'
+ return x
+ enddef
+
+ assert_equal(' => { # abc', Foo())
+
+ def Bar(): string
+ var x = " => { # abc"
+ return x
+ enddef
+
+ assert_equal(" => { # abc", Bar())
+ END
+ v9.CheckSourceSuccess(lines)
+enddef
+
func g:NoSuchFunc()
echo 'none'
endfunc