patch 8.2.2264: Vim9: no error for mismatched :endfunc or :enddef
Problem: Vim9: no error for mismatched :endfunc or :enddef.
Solution: Check for the mismatch. (issue #7582)
diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim
index a2d1ed3..223b2fb 100644
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -79,6 +79,25 @@
set maxfuncdepth&
enddef
+def Test_endfunc_enddef()
+ var lines =<< trim END
+ def Test()
+ echo 'test'
+ endfunc
+ enddef
+ END
+ CheckScriptFailure(lines, 'E1151:', 3)
+
+ lines =<< trim END
+ def Test()
+ func Nested()
+ echo 'test'
+ enddef
+ enddef
+ END
+ CheckScriptFailure(lines, 'E1152:', 4)
+enddef
+
def ReturnString(): string
return 'string'
enddef