patch 8.2.3720: Vim9: Internal error when invoking closure in legacy context
Problem: Vim9: Internal error when invoking closure in legacy context.
Solution: Give a more appropriate error message. (closes #9251)
diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim
index 51b95ab..651da05 100644
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -2384,6 +2384,21 @@
delfunc g:Inner
enddef
+def Test_closure_called_from_legacy()
+ var lines =<< trim END
+ vim9script
+ def Func()
+ var outer = 'foo'
+ var F = () => {
+ outer = 'bar'
+ }
+ execute printf('call %s()', string(F))
+ enddef
+ Func()
+ END
+ CheckScriptFailure(lines, 'E1248')
+enddef
+
def Test_failure_in_called_function()
# this was using the frame index as the return value
var lines =<< trim END