1
0
forked from aniani/vim

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)
This commit is contained in:
Bram Moolenaar
2021-12-02 16:38:52 +00:00
parent f8bc0ce267
commit 69c76171f1
4 changed files with 26 additions and 1 deletions

View File

@@ -2384,6 +2384,21 @@ def Test_global_closure_called_directly()
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